-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Problem:** Selected grid items should show ruler markers on the borders of the grid to indicate their placement properties. **Fix:** Add the ruler markers to the grid controls for items. **Notes:** - markers currently target the cell bounds, it should change to the middle of the space between cells when we have offset indicator lines (future PR) https://github.com/user-attachments/assets/b0dd3450-70fa-47cc-b627-e9f792f13ad8 **Manual Tests:** I hereby swear that: - [x] I opened a hydrogen project and it loaded - [x] I could navigate to various routes in Play mode Fixes #6656
- Loading branch information
Showing
5 changed files
with
401 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
editor/src/components/canvas/controls/grid-controls-ruler-markers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import React from 'react' | ||
import { colorTheme } from '../../../uuiui' | ||
|
||
export type RulerMarkerType = 'span-start' | 'span-end' | 'auto' | 'pinned' | ||
|
||
const upFacingTriangle = ( | ||
<svg width='11' height='11' xmlns='http://www.w3.org/2000/svg'> | ||
<polygon | ||
points='5,1 10,10 0,10' | ||
fill={colorTheme.primary.value} | ||
stroke={colorTheme.white.value} | ||
strokeWidth='0.5' | ||
/> | ||
</svg> | ||
) | ||
|
||
const rightFacingTriangle = ( | ||
<svg width='11' height='11' xmlns='http://www.w3.org/2000/svg'> | ||
<polygon | ||
points='10,5 0,0 0,10' | ||
fill={colorTheme.primary.value} | ||
stroke={colorTheme.white.value} | ||
strokeWidth='0.5' | ||
/> | ||
</svg> | ||
) | ||
|
||
const downFacingTriangle = ( | ||
<svg width='11' height='11' xmlns='http://www.w3.org/2000/svg'> | ||
<polygon | ||
points='5,10 0,0 10,0' | ||
fill={colorTheme.primary.value} | ||
stroke={colorTheme.white.value} | ||
strokeWidth='0.5' | ||
/> | ||
</svg> | ||
) | ||
|
||
const leftFacingTriangle = ( | ||
<svg width='11' height='11' xmlns='http://www.w3.org/2000/svg'> | ||
<polygon | ||
points='0,5 10,0 10,10' | ||
fill={colorTheme.primary.value} | ||
stroke={colorTheme.white.value} | ||
strokeWidth='0.5' | ||
/> | ||
</svg> | ||
) | ||
|
||
const verticalPipe = ( | ||
<svg width='4' height='11' xmlns='http://www.w3.org/2000/svg'> | ||
<rect | ||
x='0.25' | ||
y='0.25' | ||
width='3' | ||
height='10' | ||
fill={colorTheme.primary.value} | ||
stroke={colorTheme.white.value} | ||
strokeWidth='0.5' | ||
/> | ||
</svg> | ||
) | ||
|
||
const horizontalPipe = ( | ||
<svg width='11' height='11' xmlns='http://www.w3.org/2000/svg'> | ||
<rect | ||
x='0.25' | ||
y='3.50' | ||
width='10' | ||
height='3' | ||
fill={colorTheme.primary.value} | ||
stroke={colorTheme.white.value} | ||
strokeWidth='0.5' | ||
/> | ||
</svg> | ||
) | ||
|
||
export const rulerMarkerIcons: { | ||
[key in RulerMarkerType]: { column: React.ReactNode; row: React.ReactNode } | ||
} = { | ||
'span-start': { | ||
column: rightFacingTriangle, | ||
row: downFacingTriangle, | ||
}, | ||
'span-end': { | ||
column: leftFacingTriangle, | ||
row: upFacingTriangle, | ||
}, | ||
auto: { | ||
column: verticalPipe, | ||
row: horizontalPipe, | ||
}, | ||
pinned: { | ||
column: downFacingTriangle, | ||
row: rightFacingTriangle, | ||
}, | ||
} |
Oops, something went wrong.