Skip to content

Commit 31fa1e3

Browse files
committed
reset map's fpsOnInteracting, close #526
1 parent 1f02d42 commit 31fa1e3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/map/Map.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import SpatialReference from './spatial-reference/SpatialReference';
3434
* @property {Boolean} [options.enableInfoWindow=true] - whether to enable infowindow on this map.
3535
* @property {Boolean} [options.hitDetect=true] - whether to enable hit detecting of layers for cursor style on this map, disable it to improve performance.
3636
* @property {Boolean} [options.hitDetectLimit=5] - the maximum number of layers to perform hit detect.
37-
* @property {Boolean} [options.fpsOnInteracting=0] - fps when map is interacting.
37+
* @property {Boolean} [options.fpsOnInteracting=25] - fps when map is interacting.
3838
* @property {Boolean} [options.layerCanvasLimitOnInteracting=-1] - limit of layer canvas to draw on map when interacting, set it to improve perf.
3939
* @property {Number} [options.maxZoom=null] - the maximum zoom the map can be zooming to.
4040
* @property {Number} [options.minZoom=null] - the minimum zoom the map can be zooming to.
@@ -94,7 +94,7 @@ const options = {
9494

9595
'hitDetectLimit' : 5,
9696

97-
'fpsOnInteracting' : 0,
97+
'fpsOnInteracting' : 25,
9898

9999
'layerCanvasLimitOnInteracting' : -1,
100100

src/renderer/layer/CanvasRenderer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,14 @@ class CanvasRenderer extends Class {
637637
if (!this.getMap()) {
638638
return;
639639
}
640+
const painted = this._painted;
640641
this._painted = true;
641-
const t = now();
642+
let t = now();
642643
this.draw();
643-
this._drawTime = now() - t;
644-
if (this.layer.options['logDrawTime']) {
644+
t = now() - t;
645+
//reduce some time in the first draw
646+
this._drawTime = painted ? t : t / 2;
647+
if (painted && this.layer.options['logDrawTime']) {
645648
console.log('drawTime:', this.layer.getId(), this._drawTime);
646649
}
647650
}

0 commit comments

Comments
 (0)