Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ImageOverlay zooming support done proper! :)

  • Loading branch information...
commit 9a979dd6d9418de84eaf8f07e183f2c6ca8ecf2b 1 parent b901708
@danzel authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 src/layer/ImageOverlay.js
View
9 src/layer/ImageOverlay.js
@@ -55,13 +55,12 @@ L.ImageOverlay = L.Class.extend({
_zoomAnimation: function (opt) {
var image = this._image,
+ scale = Math.pow(2, opt.zoom - this._map._zoom),
topLeft = this._map._latLngToNewLayerPoint(this._bounds.getNorthWest(), opt.zoom, opt.center),
- size = this._map._latLngToNewLayerPoint(this._bounds.getSouthEast(), opt.zoom, opt.center).subtract(topLeft);
+ size = this._map._latLngToNewLayerPoint(this._bounds.getSouthEast(), opt.zoom, opt.center).subtract(topLeft),
+ currentSize = this._map.latLngToLayerPoint(this._bounds.getSouthEast()).subtract(this._map.latLngToLayerPoint(this._bounds.getNorthWest()));
- L.DomUtil.setPosition(image, topLeft);
- //image.style.webkitTransform += ' scale(0.5)';
- image.style.width = size.x + 'px';
- image.style.height = size.y + 'px';
+ image.style[L.DomUtil.TRANSFORM] = L.DomUtil.getTranslateString(topLeft.add(size.subtract(currentSize).divideBy(2))) + ' scale(' + scale + ') ';
},
_reset: function () {
Please sign in to comment.
Something went wrong with that request. Please try again.