Skip to content

Commit 812c20a

Browse files
georginahalpernGeorgina Halpern
andauthored
[Fluent/InspectorV2] QuaternionPropertyLine bug fix (#17340)
- Don't send 'rad' for units - Ensure udpated when props.value changes Co-authored-by: Georgina Halpern <[email protected]>
1 parent dd61227 commit 812c20a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/dev/sharedUiComponents/src/fluent/hoc/propertyLines/vectorPropertyLine.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ export const QuaternionPropertyLine: FunctionComponent<QuaternionPropertyLinePro
167167
const max = props.useDegrees ? 360 : undefined;
168168
const [quat, setQuat] = useState(props.value);
169169

170+
useEffect(() => {
171+
setQuat(props.value);
172+
}, [props.value]);
173+
170174
// Extract only the properties that exist on QuaternionPropertyLineProps
171175
const { useDegrees, ...restProps } = props;
172176

@@ -177,8 +181,7 @@ export const QuaternionPropertyLine: FunctionComponent<QuaternionPropertyLinePro
177181

178182
const onEulerChange = (val: Vector3) => {
179183
const quat = Quaternion.FromEulerAngles(val.x, val.y, val.z);
180-
setQuat(quat);
181-
props.onChange(quat);
184+
onQuatChange(quat);
182185
};
183186

184187
return useDegrees ? (
@@ -194,7 +197,7 @@ export const QuaternionPropertyLine: FunctionComponent<QuaternionPropertyLinePro
194197
unit="deg"
195198
/>
196199
) : (
197-
<QuaternionPropertyLineInternal {...props} unit={"rad"} nullable={false} value={quat} min={min} max={max} onChange={onQuatChange} />
200+
<QuaternionPropertyLineInternal {...props} nullable={false} value={quat} min={min} max={max} onChange={onQuatChange} />
198201
);
199202
};
200203
export const Vector2PropertyLine = TensorPropertyLine as FunctionComponent<TensorPropertyLineProps<Vector2>>;

0 commit comments

Comments
 (0)