diff --git a/editor/src/components/canvas/controls/grid-controls.tsx b/editor/src/components/canvas/controls/grid-controls.tsx index c0d0b99be34f..756944ad8a37 100644 --- a/editor/src/components/canvas/controls/grid-controls.tsx +++ b/editor/src/components/canvas/controls/grid-controls.tsx @@ -74,7 +74,11 @@ import { windowToCanvasCoordinates } from '../dom-lookup' import type { Axis } from '../gap-utils' import { useCanvasAnimation } from '../ui-jsx-canvas-renderer/animation-context' import { CanvasOffsetWrapper } from './canvas-offset-wrapper' -import type { GridControlsProps, GridData } from './grid-controls-for-strategies' +import type { + GridControlsProps, + GridData, + GridMeasurementHelperData, +} from './grid-controls-for-strategies' import { edgePositionToGridResizeEdge, GridCellTestId, @@ -112,7 +116,6 @@ function getLabelForAxis( return gridCSSNumberToLabel(defaultEither(fromDOM, fromPropsAtIndex)) } -const GRID_RESIZE_HANDLE_CONTAINER_SIZE = 30 // px const GRID_RESIZE_HANDLE_SIZE = 15 // px interface GridResizingControlProps { @@ -128,7 +131,7 @@ interface GridResizingControlProps { stripedAreaLength: number | null } -const GridResizingControl = React.memo((props: GridResizingControlProps) => { +const GridTrackSizeLabel = React.memo((props: GridResizingControlProps) => { const { setResizingIndex } = props const canvasOffset = useEditorState( @@ -200,15 +203,18 @@ const GridResizingControl = React.memo((props: GridResizingControlProps) => { const labelId = `grid-${props.axis}-handle-${props.dimensionIndex}` const containerId = `${labelId}-container` - const shadowSize = React.useMemo(() => { - return props.axis === 'column' - ? props.containingFrame.height + GRID_RESIZE_HANDLE_CONTAINER_SIZE - : props.containingFrame.width + GRID_RESIZE_HANDLE_CONTAINER_SIZE - }, [props.containingFrame, props.axis]) - - const stripedAreaSkew = React.useMemo( - () => GRID_RESIZE_HANDLE_CONTAINER_SIZE / scale + props.padding, - [scale, props.padding], + const cssProp = React.useMemo( + () => ({ + backgroundColor: + props.resizing === 'resize-target' + ? colorTheme.primary.value + : colorTheme.primarySubdued.value, + '&:hover': { + zIndex: 1, + backgroundColor: colorTheme.primary.value, + }, + }), + [props.resizing, colorTheme], ) return ( @@ -219,20 +225,22 @@ const GridResizingControl = React.memo((props: GridResizingControlProps) => { display: 'flex', alignItems: props.axis === 'column' ? 'flex-start' : 'center', justifyContent: props.axis === 'column' ? 'center' : 'flex-start', - height: props.axis === 'column' && props.resizing !== 'not-resizing' ? shadowSize : '100%', - width: props.axis === 'row' && props.resizing !== 'not-resizing' ? shadowSize : '100%', + height: '100%', + width: '100%', position: 'relative', }} >