Skip to content

Commit 986a92d

Browse files
authored
Merge pull request #123 from node-projects/copilot/update-content-size-to-designer-canvas
Use designerCanvas pixel size instead of content bounds for miniature view
2 parents 11098e3 + 5040645 commit 986a92d

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/miniature-view.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,14 @@ export class MiniatureView extends BaseCustomWebComponentConstructorAppend imple
103103
const designerCanvas = this._instanceServiceContainer?.designerCanvas;
104104
this._innerShadow.adoptedStyleSheets = [...designerCanvas.rootDesignItem.element.shadowRoot.adoptedStyleSheets];
105105

106-
this._maxX = 0;
107-
this._maxY = 0;
106+
const pixelSize = designerCanvas.designerPixelSize;
107+
this._maxX = pixelSize.width;
108+
this._maxY = pixelSize.height;
108109

109110
console.time('miniature render');
110111
let el = document.createDocumentFragment();
111112
for (const e of designerCanvas.rootDesignItem.children()) {
112113
//if (!(e.element instanceof UiMove)) { //TODO: maybe add an option to hide some elements in the miniature view
113-
const { x, y, width, height } = designerCanvas.getNormalizedElementCoordinates(e.element);
114-
this._maxX = Math.max(this._maxX, x + width);
115-
this._maxY = Math.max(this._maxY, y + height);
116114
el.appendChild(e.element.cloneNode(true));
117115
//}
118116
}

0 commit comments

Comments
 (0)