[fix] overlays stacking (#1849)

This PR fixes a small bug introduced by #1842 where overlays would be
stacked behind shapes.

### Change Type

- [x] `patch` — Bug fix
This commit is contained in:
Steve Ruiz 2023-09-06 14:55:40 +01:00 committed by GitHub
parent 3bc79260d8
commit 046718f241
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 15 deletions

View file

@ -230,6 +230,16 @@ input,
contain: strict; contain: strict;
} }
.tl-shapes {
position: relative;
z-index: 2;
}
.tl-overlays {
position: relative;
z-index: 3;
}
.tl-overlays__item { .tl-overlays__item {
position: absolute; position: absolute;
top: 0px; top: 0px;
@ -291,7 +301,6 @@ input,
width: 1px; width: 1px;
height: 1px; height: 1px;
contain: layout style size; contain: layout style size;
z-index: 3;
} }
/* ---------------------- Brush --------------------- */ /* ---------------------- Brush --------------------- */

View file

@ -52,18 +52,11 @@ export const Canvas = track(function Canvas({ className }: { className?: string
const offset = const offset =
z >= 1 ? modulate(z, [1, 8], [0.125, 0.5], true) : modulate(z, [0.1, 1], [-2, 0.125], true) z >= 1 ? modulate(z, [1, 8], [0.125, 0.5], true) : modulate(z, [0.1, 1], [-2, 0.125], true)
htmlElm.style.setProperty( const transform = `scale(${toDomPrecision(z)}) translate(${toDomPrecision(
'transform', x + offset
`scale(${toDomPrecision(z)}) translate(${toDomPrecision(x + offset)}px,${toDomPrecision( )}px,${toDomPrecision(y + offset)}px)`
y + offset htmlElm.style.setProperty('transform', transform)
)}px)` htmlElm2.style.setProperty('transform', transform)
)
htmlElm2.style.setProperty(
'transform',
`scale(${toDomPrecision(z)}) translate(${toDomPrecision(x + offset)}px,${toDomPrecision(
y + offset
)}px)`
)
}, },
[editor] [editor]
) )
@ -111,11 +104,11 @@ export const Canvas = track(function Canvas({ className }: { className?: string
{SvgDefs && <SvgDefs />} {SvgDefs && <SvgDefs />}
</defs> </defs>
</svg> </svg>
<div ref={rHtmlLayer} className="tl-html-layer" draggable={false}> <div ref={rHtmlLayer} className="tl-html-layer tl-shapes" draggable={false}>
<SelectionBackgroundWrapper /> <SelectionBackgroundWrapper />
<ShapesToDisplay /> <ShapesToDisplay />
</div> </div>
<div className="tl-fixed-layer"> <div className="tl-fixed-layer tl-overlays">
<div ref={rHtmlLayer2} className="tl-html-layer"> <div ref={rHtmlLayer2} className="tl-html-layer">
{/* <GeometryDebuggingView /> */} {/* <GeometryDebuggingView /> */}
<HandlesWrapper /> <HandlesWrapper />