Skip to content

Commit ddd55e0

Browse files
Thinner grid cell borders (#6525)
**Details:** - Removing the "insertion dots" - Aligning the outer edge of the grid cells with the selection outline - Making the grid cell borders thinner **Before** <img width="697" alt="image" src="https://github.com/user-attachments/assets/f1f85fa5-ab84-4c71-84d8-3a5fa0c183dd"> **Now** <img width="675" alt="image" src="https://github.com/user-attachments/assets/5aa74828-8336-4c48-8ab0-bdf79139e92b">
1 parent aebb64f commit ddd55e0

File tree

1 file changed

+5
-61
lines changed

1 file changed

+5
-61
lines changed

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

+5-61
Original file line numberDiff line numberDiff line change
@@ -870,62 +870,6 @@ const GridControl = React.memo<GridControlProps>(({ grid }) => {
870870
: undefined,
871871
}}
872872
/>
873-
<React.Fragment>
874-
<div
875-
style={{
876-
position: 'absolute',
877-
top: -1,
878-
bottom: -1,
879-
left: -1,
880-
right: -1,
881-
display: 'flex',
882-
alignItems: 'center',
883-
justifyContent: 'center',
884-
}}
885-
>
886-
<div style={{ width: 2, height: 2, backgroundColor: dotgridColor }} />
887-
</div>
888-
<div
889-
style={{
890-
width: 2,
891-
height: 2,
892-
backgroundColor: dotgridColor,
893-
position: 'absolute',
894-
top: -1,
895-
left: -1,
896-
}}
897-
/>
898-
<div
899-
style={{
900-
width: 2,
901-
height: 2,
902-
backgroundColor: dotgridColor,
903-
position: 'absolute',
904-
bottom: -1,
905-
left: -1,
906-
}}
907-
/>
908-
<div
909-
style={{
910-
width: 2,
911-
height: 2,
912-
backgroundColor: dotgridColor,
913-
position: 'absolute',
914-
top: -1,
915-
right: -1,
916-
}}
917-
/>
918-
<div
919-
style={{
920-
width: 2,
921-
height: 2,
922-
backgroundColor: dotgridColor,
923-
position: 'absolute',
924-
bottom: -1,
925-
right: -1,
926-
}}
927-
/>
928-
</React.Fragment>
929873
</React.Fragment>
930874
</div>
931875
)
@@ -1676,16 +1620,16 @@ function gridKeyFromPath(path: ElementPath): string {
16761620
return `grid-${EP.toString(path)}`
16771621
}
16781622

1679-
const placeholderBorderBaseWidth = 2
1680-
1623+
const borderWidth = 1
16811624
function gridPlaceholderBorder(color: string, scale: number): string {
1682-
return `${placeholderBorderBaseWidth / scale}px solid ${color}`
1625+
return `${borderWidth / scale}px solid ${color}`
16831626
}
16841627

1628+
const borderExtension = 0.5
16851629
function gridPlaceholderTopOrLeftPosition(scale: number): string {
1686-
return `${-placeholderBorderBaseWidth / scale}px`
1630+
return `${-borderExtension / scale}px`
16871631
}
16881632

16891633
function gridPlaceholderWidthOrHeight(scale: number): string {
1690-
return `calc(100% + ${(placeholderBorderBaseWidth * 2) / scale}px)`
1634+
return `calc(100% + ${(borderExtension * 2) / scale}px)`
16911635
}

0 commit comments

Comments
 (0)