diff --git a/editor/src/components/canvas/controls/grid-controls.tsx b/editor/src/components/canvas/controls/grid-controls.tsx
index 7992c4155988..a6f18b1d6e64 100644
--- a/editor/src/components/canvas/controls/grid-controls.tsx
+++ b/editor/src/components/canvas/controls/grid-controls.tsx
@@ -28,6 +28,7 @@ import {
import type { CanvasPoint, CanvasRectangle, LocalRectangle } from '../../../core/shared/math-utils'
import {
canvasPoint,
+ canvasRectangle,
isFiniteRectangle,
isInfinityRectangle,
nullIfInfinity,
@@ -2160,6 +2161,8 @@ const rulerMarkerIconSize = 12 // px
type RulerMarkerData = {
parentGrid: GridContainerProperties
+ cellRect: CanvasRectangle
+ gridRect: CanvasRectangle
columnStart: RulerMarkerPositionData
columnEnd: RulerMarkerPositionData
rowStart: RulerMarkerPositionData
@@ -2243,8 +2246,18 @@ const RulerMarkers = React.memo((props: { path: ElementPath }) => {
store.editor.jsxMetadata,
)
+ const cellRect = parentGridCellGlobalFrames[cellBounds.row - 1][cellBounds.column - 1]
+ const cellRectResized = canvasRectangle({
+ x: cellRect.x,
+ y: cellRect.y,
+ width: width,
+ height: height,
+ })
+
return {
parentGrid: parentGrid,
+ cellRect: cellRectResized,
+ gridRect: gridRect,
columnStart: {
top: gridRect.y,
left: left,
@@ -2280,6 +2293,7 @@ const RulerMarkers = React.memo((props: { path: ElementPath }) => {
return (
+ {/* Indicators */}
{
axis={'row'}
/>
+ {/* Offset lines */}
+
+
+
+
+ {/* Cell outline */}
+
)
})
@@ -2496,16 +2542,17 @@ function skewMarkerPosition(
// span-end triangle, on the column
const spanEndColumn = axis === 'column' && markerType === 'span-end'
if (spanEndColumn) {
- return 10
+ return 9
}
- const pinnedEndColumn = axis === 'column' && markerType === 'pinned'
+ // pinned triangle, on the column
+ const pinnedEndColumn = axis === 'column' && markerType === 'pinned' && bound === 'end'
if (pinnedEndColumn) {
return 5
}
// any other ending marker, on the column
const endColumn = bound === 'end' && axis === 'column'
if (endColumn) {
- return 2
+ return 1
}
// span-end triangle, on the row
@@ -2516,7 +2563,7 @@ function skewMarkerPosition(
// any other ending marker, on the row
const endRow = bound === 'end' && axis === 'row'
if (endRow) {
- return 6
+ return 4
}
// span-start triangle, on the column
@@ -2524,10 +2571,14 @@ function skewMarkerPosition(
if (spanStartColumn) {
return 0
}
+ const pinnedStartColumn = axis === 'column' && markerType === 'pinned' && bound === 'start'
+ if (pinnedStartColumn) {
+ return 5
+ }
// any starting marker, on the column
const startColumn = bound === 'start' && axis === 'column'
if (startColumn) {
- return 5
+ return 1
}
// span-start starting triangle, on the row
@@ -2543,3 +2594,50 @@ function skewMarkerPosition(
return 0
}
+
+const GridCellOffsetLine = React.memo(
+ (props: { top: number; left: number; size: number; orientation: 'vertical' | 'horizontal' }) => {
+ const colorTheme = useColorTheme()
+
+ return (
+
+ )
+ },
+)
+GridCellOffsetLine.displayName = 'GridCellOffsetLine'
+
+const GridCellOutline = React.memo(
+ (props: { top: number; left: number; width: number; height: number }) => {
+ const colorTheme = useColorTheme()
+
+ return (
+
+ )
+ },
+)
+GridCellOutline.displayName = 'GridCellOutline'