diff --git a/packages/editor/editor.css b/packages/editor/editor.css index 6ea8e18bd..9633b2573 100644 --- a/packages/editor/editor.css +++ b/packages/editor/editor.css @@ -221,14 +221,13 @@ input, contain: strict; } -.tl-shapes { - position: relative; - z-index: 1; -} - -.tl-overlays { - position: relative; - z-index: 2; +.tl-fixed-layer { + position: absolute; + top: 0px; + left: 0px; + width: 100%; + height: 100%; + contain: strict; } .tl-overlays__item { diff --git a/packages/editor/src/lib/components/Canvas.tsx b/packages/editor/src/lib/components/Canvas.tsx index 16773f04a..08130c1c2 100644 --- a/packages/editor/src/lib/components/Canvas.tsx +++ b/packages/editor/src/lib/components/Canvas.tsx @@ -27,6 +27,7 @@ export const Canvas = track(function Canvas({ className }: { className?: string const rCanvas = React.useRef(null) const rHtmlLayer = React.useRef(null) + const rHtmlLayer2 = React.useRef(null) useScreenBounds() useDocumentEvents() @@ -40,6 +41,8 @@ export const Canvas = track(function Canvas({ className }: { className?: string () => { const htmlElm = rHtmlLayer.current if (!htmlElm) return + const htmlElm2 = rHtmlLayer2.current + if (!htmlElm2) return const { x, y, z } = editor.camera @@ -55,6 +58,12 @@ export const Canvas = track(function Canvas({ className }: { className?: string y + offset )}px)` ) + htmlElm2.style.setProperty( + 'transform', + `scale(${toDomPrecision(z)}) translate(${toDomPrecision(x + offset)}px,${toDomPrecision( + y + offset + )}px)` + ) }, [editor] ) @@ -92,22 +101,22 @@ export const Canvas = track(function Canvas({ className }: { className?: string {Background && } + + + {shapeSvgDefs} + {Cursor && } + + + + {SvgDefs && } + +
- - - {shapeSvgDefs} - {Cursor && } - - - - {SvgDefs && } - - -
- -
-
+ +
+
+
{/* */} diff --git a/packages/editor/src/lib/editor/Editor.ts b/packages/editor/src/lib/editor/Editor.ts index b44d275b9..df41d8f4a 100644 --- a/packages/editor/src/lib/editor/Editor.ts +++ b/packages/editor/src/lib/editor/Editor.ts @@ -3039,8 +3039,8 @@ export class Editor extends EventEmitter { maskedPageBounds: Box2d | undefined }[] = [] - let nextIndex = MAX_SHAPES_PER_PAGE - let nextBackgroundIndex = 0 + let nextIndex = MAX_SHAPES_PER_PAGE * 2 + let nextBackgroundIndex = MAX_SHAPES_PER_PAGE // We only really need these if we're using editor state, but that's ok const editingShapeId = this.editingShapeId