Skip to content

Commit 942fc7d

Browse files
grid rearrange's pink outline no longer partially overlapped (#6530)
**Problem:** ![image](https://github.com/user-attachments/assets/268bb1ae-28f9-4384-a4ea-d1bc93a50c1c) The active grid cell's pink outline would sometimes appear under the grey outline drawn for non-hovered cells. **Fix:** ![image](https://github.com/user-attachments/assets/e51e0198-5bba-447a-9816-40ba30e4202a) - The cell that has the pink outline is now drawn with a z-index: 1 - The outline no longer uses opacity which causes errors in color when they overlap - This means the cell outlines no longer need to predict overlap and avoid drawing right and bottom borders
1 parent ad39087 commit 942fc7d

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

editor/src/components/canvas/controls/grid-controls.tsx

+8-16
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,11 @@ const GridControl = React.memo<GridControlProps>(({ grid }) => {
821821
const isActiveCell =
822822
countedColumn === currentHoveredCell?.column && countedRow === currentHoveredCell?.row
823823

824-
const borderColor =
825-
isActiveCell && targetsAreCellsWithPositioning
826-
? colorTheme.brandNeonPink.value
827-
: colorTheme.blackOpacity35.value
824+
const activePositioningTarget = isActiveCell && targetsAreCellsWithPositioning
825+
826+
const borderColor = activePositioningTarget
827+
? colorTheme.brandNeonPink.value
828+
: colorTheme.grey65.value
828829
return (
829830
<div
830831
key={id}
@@ -834,6 +835,7 @@ const GridControl = React.memo<GridControlProps>(({ grid }) => {
834835
style={{
835836
position: 'relative',
836837
pointerEvents: 'initial',
838+
zIndex: activePositioningTarget ? 1 : undefined,
837839
}}
838840
data-grid-row={countedRow}
839841
data-grid-column={countedColumn}
@@ -851,18 +853,8 @@ const GridControl = React.memo<GridControlProps>(({ grid }) => {
851853
height: gridPlaceholderWidthOrHeight(scale),
852854
borderTop: gridPlaceholderBorder(borderColor, scale),
853855
borderLeft: gridPlaceholderBorder(borderColor, scale),
854-
borderBottom:
855-
isActiveCell ||
856-
countedRow >= grid.rows ||
857-
(grid.rowGap != null && grid.rowGap > 0)
858-
? gridPlaceholderBorder(borderColor, scale)
859-
: undefined,
860-
borderRight:
861-
isActiveCell ||
862-
countedColumn >= grid.columns ||
863-
(grid.columnGap != null && grid.columnGap > 0)
864-
? gridPlaceholderBorder(borderColor, scale)
865-
: undefined,
856+
borderBottom: gridPlaceholderBorder(borderColor, scale),
857+
borderRight: gridPlaceholderBorder(borderColor, scale),
866858
}}
867859
/>
868860
</React.Fragment>

editor/src/uuiui/styles/theme/dark.ts

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ const colorsWithOpacity = {
134134
whiteOpacity20: createUtopiColor('oklch(100% 0 0 /20%)'),
135135
whiteOpacity30: createUtopiColor('oklch(100% 0 0 /30%)'),
136136
whiteOpacity35: createUtopiColor('oklch(100% 0 0 /35%)'),
137+
grey65: createUtopiColor('oklch(65% 0 0)'),
137138
blackOpacity35: createUtopiColor('oklch(0% 0 0 / 35%)'),
138139
canvasControlsSizeBoxShadowColor20: createUtopiColor('rgba(255,255,255,0.20)'),
139140
canvasControlsSizeBoxShadowColor50: createUtopiColor('rgba(255,255,255,0.5)'),

editor/src/uuiui/styles/theme/light.ts

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ const colorsWithOpacity = {
136136
whiteOpacity30: createUtopiColor('oklch(100% 0 0 /30%)'),
137137
whiteOpacity35: createUtopiColor('oklch(100% 0 0 /35%)'),
138138
blackOpacity35: createUtopiColor('oklch(0% 0 0 / 35%)'),
139+
grey65: createUtopiColor('oklch(65% 0 0)'),
139140
canvasControlsSizeBoxShadowColor20: createUtopiColor('rgba(0,0,0,0.20)'),
140141
canvasControlsSizeBoxShadowColor50: createUtopiColor('rgba(0,0,0,0.5)'),
141142
neutralInvertedBackground10: createUtopiColor('hsla(0,0%,0%,0.1)'),

0 commit comments

Comments
 (0)