diff --git a/editor/src/components/canvas/controls/grid-controls.tsx b/editor/src/components/canvas/controls/grid-controls.tsx index 928d646d4082..055b6413e673 100644 --- a/editor/src/components/canvas/controls/grid-controls.tsx +++ b/editor/src/components/canvas/controls/grid-controls.tsx @@ -126,6 +126,7 @@ interface GridResizingControlProps { setResizingIndex: (v: number | null) => void resizeLocked: boolean stripedAreaLength: number | null + labelsHovered: [boolean, React.Dispatch>] } const GridResizingControl = React.memo((props: GridResizingControlProps) => { @@ -211,6 +212,12 @@ const GridResizingControl = React.memo((props: GridResizingControlProps) => { [scale, props.padding], ) + const [labelsHovered, setLabelsHovered] = props.labelsHovered + + const onMouseOver = React.useCallback(() => { + setLabelsHovered(true) + }, [setLabelsHovered]) + return (
{ }} >
- {getLabelForAxis(props.dimension, props.dimensionIndex, props.fromPropsAxisValues)} +
+ {!labelsHovered + ? '' + : getLabelForAxis(props.dimension, props.dimensionIndex, props.fromPropsAxisValues)} +
{when( props.resizing !== 'not-resizing', @@ -314,6 +343,7 @@ interface GridResizingProps { padding: Sides | null justifyContent: string | null alignContent: string | null + labelsHovered: [boolean, React.Dispatch>] } const GridResizing = React.memo((props: GridResizingProps) => { @@ -440,6 +470,7 @@ const GridResizing = React.memo((props: GridResizingProps) => { ? props.padding.top ?? 0 : props.padding.left ?? 0 } + labelsHovered={props.labelsHovered} /> ) })} @@ -519,44 +550,50 @@ export const GridRowColumnResizingControlsComponent = ({ }) }, [scale, grids]) + const labelsHovered = React.useState(false) + return ( - {gridsWithVisibleResizeControls.flatMap((grid) => { - return ( - - ) - })} - {gridsWithVisibleResizeControls.flatMap((grid) => { - return ( - - ) - })} +
labelsHovered[1](false)}> + {gridsWithVisibleResizeControls.flatMap((grid) => { + return ( + + ) + })} + {gridsWithVisibleResizeControls.flatMap((grid) => { + return ( + + ) + })} +
) }