Skip to content

Commit

Permalink
tweak resizing grid stretching item
Browse files Browse the repository at this point in the history
  • Loading branch information
ruggi committed Dec 10, 2024
1 parent 544461a commit 178c515
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
import { gridContainerIdentifier, gridItemIdentifier } from '../../../editor/store/editor-state'
import { cssKeyword } from '../../../inspector/common/css-utils'
import { isFillOrStretchModeAppliedOnAnySide } from '../../../inspector/inspector-common'
import { CSSCursor } from '../../canvas-types'
import { setCursorCommand } from '../../commands/set-cursor-command'
import {
controlsForGridPlaceholders,
gridEdgeToEdgePosition,
Expand Down Expand Up @@ -172,9 +174,18 @@ export const gridResizeElementStrategy: CanvasStrategyFactory = (
),
}

const cursor =
interactionSession.activeControl.edge === 'column-start' ||
interactionSession.activeControl.edge === 'column-end'
? CSSCursor.ColResize
: CSSCursor.RowResize

return strategyApplicationResult(
getCommandsForGridItemPlacement(selectedElement, gridTemplate, gridProps),
[EP.parentPath(selectedElement), selectedElement],
[
...getCommandsForGridItemPlacement(selectedElement, gridTemplate, gridProps),
setCursorCommand(cursor),
],
[(EP.parentPath(selectedElement), selectedElement)],
)
},
}
Expand Down
3 changes: 1 addition & 2 deletions editor/src/components/canvas/controls/grid-controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,6 @@ interface GridResizeControlProps {

export const GridResizeControlsComponent = ({ target }: GridResizeControlProps) => {
const gridTarget = getGridIdentifierContainerOrComponentPath(target)
const colorTheme = useColorTheme()

const element = useEditorState(
Substores.metadata,
Expand Down Expand Up @@ -1854,7 +1853,7 @@ export const GridResizeControlsComponent = ({ target }: GridResizeControlProps)
left: bounds?.x ?? element.globalFrame.x,
width: bounds?.width ?? element.globalFrame.width,
height: bounds?.height ?? element.globalFrame.height,
backgroundColor: isResizing ? colorTheme.primary25.value : 'transparent',
backgroundColor: 'transparent',
}}
>
<div
Expand Down

0 comments on commit 178c515

Please sign in to comment.