Skip to content

Commit c68bb45

Browse files
draganescuclaude
andcommitted
Grid: Address rotation review items
- Merge `components/grid/rotation.ts` into `utils/rotation.ts`, and import the rotation style helpers from there instead of the rotate hook module, so grid data code no longer imports the hook and its controls. - `GridTools` only keeps whether the previewed angle rotates the block, so dragging the rotate handle no longer re-renders the grid tools and the visualizer for every degree. The handle keeps the angle itself. - The Rotation control in the block settings turns stacking off for a grid stacked on mobile, like the rotate handle does, so an edit in the Mobile state has a visible effect. While the grid is stacked, it shows 0, as the stack shows the block unrotated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d9764b7 commit c68bb45

14 files changed

Lines changed: 507 additions & 411 deletions

‎packages/block-editor/src/components/grid/grid-item-rotator.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { rotateRight, Icon } from '@wordpress/icons';
55
import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
66
import BlockPopoverCover from '../block-popover/cover';
77
import { GridItemHandle } from './grid-item-handle';
8-
import { getPointerAngle, getRotationFromPointer } from './rotation';
8+
import { getPointerAngle, getRotationFromPointer } from '../../utils/rotation';
99
import { useRotatedOverlayStyle } from './use-rotated-overlay-style';
1010
import { setInlineStyle } from './utils';
1111

‎packages/block-editor/src/components/grid/grid-visualizer.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
getGridRectFromPixelRect,
3030
getInserterDragBlockNames,
3131
} from './utils';
32-
import { getRotatedBoundingRect } from './rotation';
32+
import { getRotatedBoundingRect } from '../../utils/rotation';
3333
import { useInserterDragBlockNames } from './use-inserter-drag-block-names';
3434
import { parseDropEvent } from '../use-on-block-drop';
3535
import {

‎packages/block-editor/src/components/grid/rotation.ts‎

Lines changed: 0 additions & 189 deletions
This file was deleted.

‎packages/block-editor/src/components/grid/test/get-grid-item-measurements.jsdom.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { afterEach, describe, expect, it, vi } from 'vitest';
22
import { getGridItemMeasurements } from '../utils';
3-
import { getRotatedBoundingRect } from '../rotation';
3+
import { getRotatedBoundingRect } from '../../../utils/rotation';
44

55
interface ChildBox {
66
clientId: string;

0 commit comments

Comments
 (0)