Make transform controls only update the props that are being manipulated in the current mode of the transform controls (#279)
Only update the transform that is being manipulated in the current mode
This commit is contained in:
parent
766c55f9e7
commit
14603bccbd
1 changed files with 15 additions and 9 deletions
|
@ -201,25 +201,31 @@ const ProxyManager: VFC<ProxyManagerProps> = ({orbitControlsRef}) => {
|
||||||
const sheetObject = editableProxyOfSelected.editable.sheetObject
|
const sheetObject = editableProxyOfSelected.editable.sheetObject
|
||||||
const obj = editableProxyOfSelected.object
|
const obj = editableProxyOfSelected.object
|
||||||
|
|
||||||
|
// interestingly, for some reason, only updating a transform when it actually changes breaks it
|
||||||
scrub.current.capture(({set}) => {
|
scrub.current.capture(({set}) => {
|
||||||
set(sheetObject.props, {
|
if (transformControlsMode === 'translate') {
|
||||||
...sheetObject.value,
|
set(sheetObject.props.position, {
|
||||||
position: {
|
...sheetObject.value.position,
|
||||||
x: obj.position.x,
|
x: obj.position.x,
|
||||||
y: obj.position.y,
|
y: obj.position.y,
|
||||||
z: obj.position.z,
|
z: obj.position.z,
|
||||||
},
|
})
|
||||||
rotation: {
|
}
|
||||||
|
if (transformControlsMode === 'rotate') {
|
||||||
|
set(sheetObject.props.rotation, {
|
||||||
|
...sheetObject.value.rotation,
|
||||||
x: obj.rotation.x,
|
x: obj.rotation.x,
|
||||||
y: obj.rotation.y,
|
y: obj.rotation.y,
|
||||||
z: obj.rotation.z,
|
z: obj.rotation.z,
|
||||||
},
|
})
|
||||||
scale: {
|
}
|
||||||
|
if (transformControlsMode === 'scale') {
|
||||||
|
set(sheetObject.props.scale, {
|
||||||
x: obj.scale.x,
|
x: obj.scale.x,
|
||||||
y: obj.scale.y,
|
y: obj.scale.y,
|
||||||
z: obj.scale.z,
|
z: obj.scale.z,
|
||||||
},
|
})
|
||||||
})
|
}
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
onDraggingChange={(event) => {
|
onDraggingChange={(event) => {
|
||||||
|
|
Loading…
Reference in a new issue