Skip to content

Commit 4c73779

Browse files
committed
【update】mapboxgl heatmaplayer 代码优化; review by songym
1 parent 6f89e7c commit 4c73779

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mapboxgl/overlay/HeatMapLayer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export class HeatMapLayer extends mapboxgl.Evented {
227227
this.rootCanvas.width = this.maxWidth = parseInt(mapCanvas.style.width);
228228
this.rootCanvas.height = this.maxHeight = parseInt(mapCanvas.style.height);
229229
this.canvasContext = this.rootCanvas.getContext('2d');
230-
let devicePixelRatio = window.devicePixelRatio || 1;
230+
const devicePixelRatio = window.devicePixelRatio || 1;
231231
devicePixelRatio !== 1 && this.canvasContext && this.canvasContext.scale(devicePixelRatio, devicePixelRatio);
232232

233233
CommonUtil.modifyDOMElement(this.rootCanvas, null, {x: 0, y: 0}, {w: this.maxWidth, h: this.maxHeight},
@@ -626,7 +626,7 @@ export class HeatMapLayer extends mapboxgl.Evented {
626626
this.rootCanvas.style.height = canvas.style.height;
627627
this.rootCanvas.width = this.maxWidth = parseInt(canvas.style.width);
628628
this.rootCanvas.height = this.maxHeight = parseInt(canvas.style.height);
629-
let devicePixelRatio = window.devicePixelRatio || 1;
629+
const devicePixelRatio = window.devicePixelRatio || 1;
630630
devicePixelRatio !== 1 && this.canvasContext && this.canvasContext.scale(devicePixelRatio, devicePixelRatio);
631631
this.refresh();
632632
}

0 commit comments

Comments
 (0)