updated leaflet canvas layer
This commit is contained in:
parent
7bcb2ef2f2
commit
8655d5cba2
@ -21,12 +21,18 @@ L.CanvasLayer = L.Class.extend({
|
|||||||
tileLoader: false // installs tile loading events
|
tileLoader: false // installs tile loading events
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
options = options || {};
|
||||||
//this.project = this._project.bind(this);
|
//this.project = this._project.bind(this);
|
||||||
this.render = this.render.bind(this);
|
this.render = this.render.bind(this);
|
||||||
L.Util.setOptions(this, options);
|
L.Util.setOptions(this, options);
|
||||||
this._canvas = document.createElement('canvas');
|
this._canvas = document.createElement('canvas');
|
||||||
|
this._canvas.style.position = 'absolute';
|
||||||
|
this._canvas.style.top = 0;
|
||||||
|
this._canvas.style.left = 0;
|
||||||
|
this._canvas.style.zIndex = options.zIndex || 0;
|
||||||
|
|
||||||
this._ctx = this._canvas.getContext('2d');
|
this._ctx = this._canvas.getContext('2d');
|
||||||
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
|
var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
|
||||||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
|
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
|
||||||
@ -38,7 +44,11 @@ L.CanvasLayer = L.Class.extend({
|
|||||||
onAdd: function (map) {
|
onAdd: function (map) {
|
||||||
this._map = map;
|
this._map = map;
|
||||||
|
|
||||||
this._staticPane = map._createPane('leaflet-tile-pane', map._container);
|
//this._staticPane = map._createPane('leaflet-tile-pane', map._container);
|
||||||
|
if (!map._panes.staticPane) {
|
||||||
|
map._panes.staticPane = map._createPane('leaflet-tile-pane', map._container);
|
||||||
|
}
|
||||||
|
this._staticPane = map._panes.staticPane
|
||||||
this._staticPane.appendChild(this._canvas);
|
this._staticPane.appendChild(this._canvas);
|
||||||
|
|
||||||
map.on({
|
map.on({
|
||||||
@ -88,6 +98,10 @@ L.CanvasLayer = L.Class.extend({
|
|||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setZIndex: function(zIndex) {
|
||||||
|
this._canvas.style.zIndex = zIndex;
|
||||||
|
},
|
||||||
|
|
||||||
bringToFront: function () {
|
bringToFront: function () {
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user