Skip to content

Commit db9bc24

Browse files
committed
fix: fix geometry edit on map's gl and gpu renderer, maptalks/issues#889
1 parent 03423a8 commit db9bc24

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/maptalks/src/renderer/map/MapAbstractRenderer.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,11 +692,19 @@ class MapAbstractRenderer extends MapRenderer {
692692

693693
// canvas for tops
694694
createTopCanvas() {
695-
this.topLayer = createEl('canvas') as HTMLCanvasElement;
695+
const topLayer = createEl('canvas') as HTMLCanvasElement;
696+
this.topLayer = topLayer;
697+
topLayer.width = this.canvas.width;
698+
topLayer.height = this.canvas.height;
699+
topLayer.style.position = 'absolute';
700+
topLayer.style.top = '0px';
701+
topLayer.style.left = '0px';
702+
topLayer.style.width = this.canvas.style.width;
703+
topLayer.style.height = this.canvas.style.height;
696704
const panels = this.map.getPanels();
697705
const canvasContainer = panels.canvasContainer;
698-
canvasContainer.insertBefore(this.topLayer, this.canvas);
699-
this.topCtx = this.topLayer.getContext('2d');
706+
canvasContainer.insertBefore(topLayer, this.canvas);
707+
this.topCtx = topLayer.getContext('2d');
700708
}
701709

702710
removeTopCanvas() {

0 commit comments

Comments
 (0)