@@ -2,26 +2,21 @@ import type { CSSProperties } from 'react'
2
2
import React from 'react'
3
3
import { createArrayWithLength , interleaveArray } from '../../../../core/shared/array-utils'
4
4
import type { GridAutoOrTemplateBase } from '../../../../core/shared/element-template'
5
- import type { CanvasVector , Size } from '../../../../core/shared/math-utils'
6
- import { size , windowPoint } from '../../../../core/shared/math-utils'
5
+ import type { Size } from '../../../../core/shared/math-utils'
6
+ import { size } from '../../../../core/shared/math-utils'
7
7
import type { ElementPath } from '../../../../core/shared/project-file-types'
8
8
import { assertNever } from '../../../../core/shared/utils'
9
- import { Modifier } from '../../../../utils/modifiers'
10
9
import { when } from '../../../../utils/react-conditionals'
11
10
import type { UtopiColor } from '../../../../uuiui'
12
11
import { useColorTheme , UtopiaStyles } from '../../../../uuiui'
13
12
import { CSSCursor } from '../../../../uuiui-deps'
14
- import type { EditorDispatch } from '../../../editor/action-types'
15
13
import { useDispatch } from '../../../editor/store/dispatch-context'
16
14
import { Substores , useEditorState , useRefEditorState } from '../../../editor/store/store-hook'
17
15
import {
18
16
cssNumber ,
19
17
printCSSNumber ,
20
18
stringifyGridDimension ,
21
19
} from '../../../inspector/common/css-utils'
22
- import CanvasActions from '../../canvas-actions'
23
- import { createInteractionViaMouse , gridGapHandle } from '../../canvas-strategies/interaction-state'
24
- import { windowToCanvasCoordinates } from '../../dom-lookup'
25
20
import type { Axis } from '../../gap-utils'
26
21
import { maybeGridGapData } from '../../gap-utils'
27
22
import { CanvasOffsetWrapper } from '../canvas-offset-wrapper'
@@ -31,6 +26,7 @@ import { getGridHelperStyleMatchingTargetGrid } from '../grid-controls-helpers'
31
26
import type { CSSNumberWithRenderedValue } from './controls-common'
32
27
import { CanvasLabel , PillHandle , useHoverWithDelay } from './controls-common'
33
28
import { startGapControlInteraction } from './grid-gap-control-helpers'
29
+ import type { AlignContent , FlexJustifyContent } from '../../../inspector/inspector-common'
34
30
35
31
export interface GridGapControlProps {
36
32
selectedElement : ElementPath
@@ -187,7 +183,7 @@ export const GridPaddingOutlineForDimension = (props: {
187
183
{ createArrayWithLength ( length , ( index ) => {
188
184
const hide = index === 0 || index === length - 1 || index % 2 === 0
189
185
return (
190
- < GridRowHighlight
186
+ < GridRowOrColumnHighlight
191
187
key = { index }
192
188
hide = { hide } // we only want to show the divs that fall in where the gaps are in the original grid
193
189
gapId = { `${ dimension } -${ index } ` }
@@ -202,6 +198,8 @@ export const GridPaddingOutlineForDimension = (props: {
202
198
beingDragged = { beingDragged }
203
199
onMouseOver = { onMouseOver }
204
200
elementHovered = { elementHovered }
201
+ gridJustifyContent = { grid . justifyContent }
202
+ gridAlignContent = { grid . alignContent }
205
203
draggedOutlineColor = { draggedOutlineColor }
206
204
/>
207
205
)
@@ -210,7 +208,7 @@ export const GridPaddingOutlineForDimension = (props: {
210
208
)
211
209
}
212
210
213
- const GridRowHighlight = ( props : {
211
+ const GridRowOrColumnHighlight = ( props : {
214
212
gapId : string
215
213
onMouseDown : React . MouseEventHandler
216
214
hide : boolean
@@ -222,6 +220,8 @@ const GridRowHighlight = (props: {
222
220
beingDragged : boolean
223
221
onMouseOver : ( ) => void
224
222
elementHovered : boolean
223
+ gridJustifyContent : FlexJustifyContent | null
224
+ gridAlignContent : AlignContent | null
225
225
draggedOutlineColor ?: UtopiColor
226
226
} ) => {
227
227
const {
@@ -236,6 +236,8 @@ const GridRowHighlight = (props: {
236
236
beingDragged,
237
237
onMouseOver,
238
238
elementHovered,
239
+ gridJustifyContent,
240
+ gridAlignContent,
239
241
draggedOutlineColor,
240
242
} = props
241
243
@@ -302,8 +304,8 @@ const GridRowHighlight = (props: {
302
304
boxShadow : `inset 0 0 0 ${ lineWidth } px ${ outlineColor } ` ,
303
305
opacity : hide ? 0 : 1 ,
304
306
305
- alignItems : 'center' ,
306
- justifyContent : 'center' ,
307
+ alignContent : axis === 'row' ? undefined : gridAlignContent ?? undefined ,
308
+ justifyContent : axis === 'row' ? gridJustifyContent ?? undefined : undefined ,
307
309
placeItems : 'center' ,
308
310
309
311
gap : gap ?? 0 ,
0 commit comments