Skip to content

Commit

Permalink
add gridviz id to leaflet overlay pane
Browse files Browse the repository at this point in the history
  • Loading branch information
joewdavies committed Dec 5, 2024
1 parent dcedc06 commit df82a88
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16,036 deletions.
12 changes: 6 additions & 6 deletions build/leaflet-gridviz.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/leaflet-gridviz.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "leaflet-gridviz",
"version": "2.0.1",
"version": "2.0.2",
"description": "Leaflet plugin for gridviz",
"main": "src/main.js",
"scripts": {
Expand Down
22 changes: 10 additions & 12 deletions src/L.CanvasLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ L.DomUtil.setTransform =
var pos = offset || new L.Point(0, 0)

el.style[L.DomUtil.TRANSFORM] =
(L.Browser.ie3d
? 'translate(' + pos.x + 'px,' + pos.y + 'px)'
: 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +
(L.Browser.ie3d ? 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +
(scale ? ' scale(' + scale + ')' : '')
}

Expand Down Expand Up @@ -84,7 +82,11 @@ L.CanvasLayer = (L.Layer ? L.Layer : L.Class).extend({
var animated = this._map.options.zoomAnimation && L.Browser.any3d
L.DomUtil.addClass(this._canvas, 'leaflet-zoom-' + (animated ? 'animated' : 'hide'))

map._panes.overlayPane.appendChild(this._canvas)
// map._panes.overlayPane.appendChild(this._canvas)
//create our own gridviz pane
let ourPane = map.createPane('gridviz')
map.getPane('gridviz').style.zIndex = 399
ourPane.appendChild(this._canvas)

map.on(this.getEvents(), this)

Expand All @@ -104,7 +106,8 @@ L.CanvasLayer = (L.Layer ? L.Layer : L.Class).extend({
}

let panes = map.getPanes()
let overlayPane = panes.overlayPane
// let overlayPane = panes.overlayPane
let overlayPane = map.getPane('gridviz')

if (this._canvas) {
if (this._canvas.parentElement === overlayPane) {
Expand Down Expand Up @@ -159,9 +162,7 @@ L.CanvasLayer = (L.Layer ? L.Layer : L.Class).extend({
var pos = offset || new L.Point(0, 0)

el.style[L.DomUtil.TRANSFORM] =
(L.Browser.ie3d
? 'translate(' + pos.x + 'px,' + pos.y + 'px)'
: 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +
(L.Browser.ie3d ? 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +
(scale ? ' scale(' + scale + ')' : '')
},

Expand All @@ -171,10 +172,7 @@ L.CanvasLayer = (L.Layer ? L.Layer : L.Class).extend({
// -- different calc of animation zoom in leaflet 1.0.3 thanks @peterkarabinovic, @jduggan1
var offset = L.Layer
? this._map._latLngBoundsToNewLayerBounds(this._map.getBounds(), e.zoom, e.center).min
: this._map
._getCenterOffset(e.center)
._multiplyBy(-scale)
.subtract(this._map._getMapPanePos())
: this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos())

L.DomUtil.setTransform(this._canvas, offset, scale)
},
Expand Down
Loading

0 comments on commit df82a88

Please sign in to comment.