Skip to content

Commit 336b5ed

Browse files
fix(ViewService): Fix layer styles in _updateViewport
1 parent 0baf7eb commit 336b5ed

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/view.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ export class ViewService {
103103
*/
104104
public autoLayoutImmersiveMode = true;
105105

106+
/**
107+
* Automatically style layer elements
108+
*/
109+
public autoStyleLayerElements = true;
110+
106111
/**
107112
* Automatically publish the viewport of the element during PresentationMode.EMBEDDED
108113
*/
@@ -360,6 +365,19 @@ export class ViewService {
360365
})
361366
}
362367

368+
if (this.layers && this.autoStyleLayerElements) {
369+
requestAnimationFrame(() => {
370+
for (const layer of this._layers) {
371+
const layerStyle = layer.source.style;
372+
layerStyle.position = 'absolute';
373+
layerStyle.left = viewport.x + 'px';
374+
layerStyle.bottom = viewport.y + 'px';
375+
layerStyle.width = viewport.width + 'px';
376+
layerStyle.height = viewport.height + 'px';
377+
}
378+
})
379+
}
380+
363381
this.viewportChangeEvent.raiseEvent(viewport);
364382
}
365383
}

0 commit comments

Comments
 (0)