UAT-8a: rotate the rect, not a separate axis vector
reduceAxisState 'rotate' now changes state.rect.angle and re-derives state.axis via axisFromRect(newRect). The rectangle rotates as a whole; the axis for Measure is derived from the rotated rect's long side. 2 new regression tests: rect.angle changes on rotate, axis is re-derived from rotated rect. 109/109 tests green.
This commit is contained in:
@@ -274,8 +274,10 @@ export function reduceAxisState(state, action) {
|
||||
case 'rotate': {
|
||||
const angle = action.angle;
|
||||
if (angle === 0) return state;
|
||||
const newAxis = rotateAxis(state.axis, angle);
|
||||
return { ...state, axis: newAxis, approved: false };
|
||||
// Rotate the RECTANGLE, not a separate axis vector. The rect's angle
|
||||
// changes, and the axis is re-derived from the rotated rect.
|
||||
const newRect = { ...state.rect, angle: state.rect.angle + angle };
|
||||
return { ...state, rect: newRect, axis: axisFromRect(newRect), approved: false };
|
||||
}
|
||||
case 'approve': {
|
||||
return { ...state, approved: true };
|
||||
|
||||
Reference in New Issue
Block a user