Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more performance enhancements

  • Loading branch information...
commit a4b591034969eb7f53300161947253ca80bd5d7a 1 parent a3e49f3
@aeskreis aeskreis authored
View
12 src/layer/tile/TileLayer.js
@@ -42,6 +42,7 @@ L.TileLayer = L.Class.extend({
this._visibility = true;
}
this.setVisibility(this._visibility);
+ this.options.updateWhenIdle = true;
},
onAdd: function (map, insertAtTheBottom) {
@@ -205,12 +206,13 @@ L.TileLayer = L.Class.extend({
}
if(addTiles) {
- var tileBounds = new L.Bounds(nwTilePoint, seTilePoint);
+ //console.log("tile bounds changed");
+ this.tileBounds = new L.Bounds(nwTilePoint, seTilePoint);
this._boundsChanged = true;
- this._addTilesFromCenterOut(tileBounds);
- this.tileBounds = tileBounds;
+ this._addTilesFromCenterOut(this.tileBounds);
+
if (this.options.unloadInvisibleTiles || this.options.reuseTiles) {
- this._removeOtherTiles(tileBounds);
+ this._removeOtherTiles(this.tileBounds);
}
}
@@ -312,7 +314,7 @@ L.TileLayer = L.Class.extend({
addTileCalls = 0;
}
addTileCalls++;
- console.log("addTile call: "+addTileCalls);
+ //console.log("addTile call: "+addTileCalls);
var tile = this._createTile();
L.DomUtil.setPosition(tile, tilePos);
View
6 src/map/handler/Map.Drag.js
@@ -6,9 +6,9 @@ L.Map.mergeOptions({
dragging: true,
inertia: !L.Browser.android,
- inertiaDeceleration: L.Browser.touch ? 3000 : 20000, // px/s^2
- inertiaMaxSpeed: L.Browser.touch ? 1500 : 4000, // px/s
- inertiaThreshold: L.Browser.touch ? 32 : 1000, // ms
+ inertiaDeceleration: L.Browser.touch ? 3000 : 3000, // px/s^2
+ inertiaMaxSpeed: L.Browser.touch ? 1500 : 100000, // px/s
+ inertiaThreshold: L.Browser.touch ? 32 : 10000, // ms
// TODO refactor, move to CRS
worldCopyJump: true,
View
29 src/map/handler/Map.KineticDrag.js
@@ -34,10 +34,13 @@ L.Map.KineticDrag = L.Map.Drag.extend({
}
this.points = [];
L.Map.Drag.prototype._onDragStart.apply(this);
- if(this.profiling) {
- //console.profileEnd();
+ this.profilingEnabled = true;
+ if(this.profilingEnabled) {
+ if(this.profiling) {
+ console.profileEnd();
+ }
+ console.profile();
}
- //console.profile();
this.profiling = true;
},
@@ -77,8 +80,10 @@ L.Map.KineticDrag = L.Map.Drag.extend({
var callback = function() {
if(this.intervalID == null) {
- //console.profileEnd();
- this.profiling = false;
+ if(this.profilingEnabled) {
+ console.profileEnd();
+ this.profiling = false;
+ }
this._map.fire('moveend');
this._map.fire('dragend');
return;
@@ -121,8 +126,10 @@ L.Map.KineticDrag = L.Map.Drag.extend({
L.Util.bind(callback, this),
this.interval);
} else {
- //console.profileEnd();
- this.profiling = false;
+ if(this.profilingEnabled) {
+ console.profileEnd();
+ this.profiling = false;
+ }
this._map.fire('moveend');
this._map.fire('dragend');
}
@@ -132,8 +139,10 @@ L.Map.KineticDrag = L.Map.Drag.extend({
clearInterval(this.intervalID);
this.intervalID = null;
this.moveEndTimer = window.setTimeout(L.Util.bind(function() {
- //console.profileEnd();
- this.profiling = false;
+ if(this.profilingEnabled) {
+ console.profileEnd();
+ this.profiling = false;
+ }
this._map.fire('moveend');
this._map.fire('dragend');
},this), 200);
@@ -172,4 +181,4 @@ L.Map.KineticDrag = L.Map.Drag.extend({
});
-L.Map.addInitHook('addHandler', 'dragging', L.Map.KineticDrag);
+//L.Map.addInitHook('addHandler', 'dragging', L.Map.KineticDrag);
Please sign in to comment.
Something went wrong with that request. Please try again.