aframevr / aframe-inspector

:mag: Visual inspector tool for A-Frame. Hit *<ctrl> + <alt> + i* on any A-Frame scene.
https://aframe.io/aframe-inspector/examples/
MIT License
654 stars 201 forks source link

Don't trigger onChange when mounting NumberWidget component #728

Closed vincentfretin closed 3 months ago

vincentfretin commented 3 months ago

When clicking an entity that have a position with 5 decimals, it opens the right panel, triggering props.onChange on the NumberWidget react component for position x y z, thus truncating to 3 decimals the coordinates and adding a change to the undo stack I'm currently implementing. We don't want to do any change when just mounting the react component.

vincentfretin commented 3 months ago

Note that when you change the value with the input field, it keeps the 5 decimals precision while using arrows but it truncates to 3 decimals on blur at the end. Only while using mouse that the precision is kept at 5 decimals because the input doesn't have the focus, so not blur. It would probably make sense to use 3 decimals instead of 5 for TransformControls as well.

vincentfretin commented 3 months ago

I need this PR to be merged before doing the undo position/rotation/scale PR @dmarcos

dmarcos commented 3 months ago

Thanks!