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 obj = editableProxyOfSelected.object
|
||||
|
||||
// interestingly, for some reason, only updating a transform when it actually changes breaks it
|
||||
scrub.current.capture(({set}) => {
|
||||
set(sheetObject.props, {
|
||||
...sheetObject.value,
|
||||
position: {
|
||||
if (transformControlsMode === 'translate') {
|
||||
set(sheetObject.props.position, {
|
||||
...sheetObject.value.position,
|
||||
x: obj.position.x,
|
||||
y: obj.position.y,
|
||||
z: obj.position.z,
|
||||
},
|
||||
rotation: {
|
||||
})
|
||||
}
|
||||
if (transformControlsMode === 'rotate') {
|
||||
set(sheetObject.props.rotation, {
|
||||
...sheetObject.value.rotation,
|
||||
x: obj.rotation.x,
|
||||
y: obj.rotation.y,
|
||||
z: obj.rotation.z,
|
||||
},
|
||||
scale: {
|
||||
})
|
||||
}
|
||||
if (transformControlsMode === 'scale') {
|
||||
set(sheetObject.props.scale, {
|
||||
x: obj.scale.x,
|
||||
y: obj.scale.y,
|
||||
z: obj.scale.z,
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
}}
|
||||
onDraggingChange={(event) => {
|
||||
|
|
Loading…
Reference in a new issue