Skip to content

Commit

Permalink
reset map's fpsOnInteracting, close #526
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzhenn committed Oct 23, 2017
1 parent 1f02d42 commit 31fa1e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import SpatialReference from './spatial-reference/SpatialReference';
* @property {Boolean} [options.enableInfoWindow=true] - whether to enable infowindow on this map.
* @property {Boolean} [options.hitDetect=true] - whether to enable hit detecting of layers for cursor style on this map, disable it to improve performance.
* @property {Boolean} [options.hitDetectLimit=5] - the maximum number of layers to perform hit detect.
* @property {Boolean} [options.fpsOnInteracting=0] - fps when map is interacting.
* @property {Boolean} [options.fpsOnInteracting=25] - fps when map is interacting.
* @property {Boolean} [options.layerCanvasLimitOnInteracting=-1] - limit of layer canvas to draw on map when interacting, set it to improve perf.
* @property {Number} [options.maxZoom=null] - the maximum zoom the map can be zooming to.
* @property {Number} [options.minZoom=null] - the minimum zoom the map can be zooming to.
Expand Down Expand Up @@ -94,7 +94,7 @@ const options = {

'hitDetectLimit' : 5,

'fpsOnInteracting' : 0,
'fpsOnInteracting' : 25,

'layerCanvasLimitOnInteracting' : -1,

Expand Down
9 changes: 6 additions & 3 deletions src/renderer/layer/CanvasRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,11 +637,14 @@ class CanvasRenderer extends Class {
if (!this.getMap()) {
return;
}
const painted = this._painted;
this._painted = true;
const t = now();
let t = now();
this.draw();
this._drawTime = now() - t;
if (this.layer.options['logDrawTime']) {
t = now() - t;
//reduce some time in the first draw
this._drawTime = painted ? t : t / 2;
if (painted && this.layer.options['logDrawTime']) {
console.log('drawTime:', this.layer.getId(), this._drawTime);
}
}
Expand Down

0 comments on commit 31fa1e3

Please sign in to comment.