Map.js (Leaflet-1.8.0) | : | Map.js (Leaflet-1.9.0) | ||
---|---|---|---|---|
skipping to change at line 204 | skipping to change at line 204 | |||
this._tryAnimatedPan(center, options.pan); | this._tryAnimatedPan(center, options.pan); | |||
if (moved) { | if (moved) { | |||
// prevent resize handler call, the view will ref resh after animation anyway | // prevent resize handler call, the view will ref resh after animation anyway | |||
clearTimeout(this._sizeTimer); | clearTimeout(this._sizeTimer); | |||
return this; | return this; | |||
} | } | |||
} | } | |||
// animation didn't start, just reset the map view | // animation didn't start, just reset the map view | |||
this._resetView(center, zoom); | this._resetView(center, zoom, options.pan && options.pan.noMoveSt art); | |||
return this; | return this; | |||
}, | }, | |||
// @method setZoom(zoom: Number, options?: Zoom/pan options): this | // @method setZoom(zoom: Number, options?: Zoom/pan options): this | |||
// Sets the zoom of the map. | // Sets the zoom of the map. | |||
setZoom: function (zoom, options) { | setZoom: function (zoom, options) { | |||
if (!this._loaded) { | if (!this._loaded) { | |||
this._zoom = zoom; | this._zoom = zoom; | |||
return this; | return this; | |||
skipping to change at line 447 | skipping to change at line 447 | |||
flyToBounds: function (bounds, options) { | flyToBounds: function (bounds, options) { | |||
var target = this._getBoundsCenterZoom(bounds, options); | var target = this._getBoundsCenterZoom(bounds, options); | |||
return this.flyTo(target.center, target.zoom, options); | return this.flyTo(target.center, target.zoom, options); | |||
}, | }, | |||
// @method setMaxBounds(bounds: LatLngBounds): this | // @method setMaxBounds(bounds: LatLngBounds): this | |||
// Restricts the map view to the given bounds (see the [maxBounds](#map-m axbounds) option). | // Restricts the map view to the given bounds (see the [maxBounds](#map-m axbounds) option). | |||
setMaxBounds: function (bounds) { | setMaxBounds: function (bounds) { | |||
bounds = toLatLngBounds(bounds); | bounds = toLatLngBounds(bounds); | |||
if (this.listens('moveend', this._panInsideMaxBounds)) { | ||||
this.off('moveend', this._panInsideMaxBounds); | ||||
} | ||||
if (!bounds.isValid()) { | if (!bounds.isValid()) { | |||
this.options.maxBounds = null; | this.options.maxBounds = null; | |||
return this.off('moveend', this._panInsideMaxBounds); | return this; | |||
} else if (this.options.maxBounds) { | ||||
this.off('moveend', this._panInsideMaxBounds); | ||||
} | } | |||
this.options.maxBounds = bounds; | this.options.maxBounds = bounds; | |||
if (this._loaded) { | if (this._loaded) { | |||
this._panInsideMaxBounds(); | this._panInsideMaxBounds(); | |||
} | } | |||
return this.on('moveend', this._panInsideMaxBounds); | return this.on('moveend', this._panInsideMaxBounds); | |||
}, | }, | |||
skipping to change at line 821 | skipping to change at line 823 | |||
}, | }, | |||
// @section Methods for Getting Map State | // @section Methods for Getting Map State | |||
// @method getCenter(): LatLng | // @method getCenter(): LatLng | |||
// Returns the geographical center of the map view | // Returns the geographical center of the map view | |||
getCenter: function () { | getCenter: function () { | |||
this._checkIfLoaded(); | this._checkIfLoaded(); | |||
if (this._lastCenter && !this._moved()) { | if (this._lastCenter && !this._moved()) { | |||
return this._lastCenter; | return this._lastCenter.clone(); | |||
} | } | |||
return this.layerPointToLatLng(this._getCenterLayerPoint()); | return this.layerPointToLatLng(this._getCenterLayerPoint()); | |||
}, | }, | |||
// @method getZoom(): Number | // @method getZoom(): Number | |||
// Returns the current zoom level of the map view | // Returns the current zoom level of the map view | |||
getZoom: function () { | getZoom: function () { | |||
return this._zoom; | return this._zoom; | |||
}, | }, | |||
skipping to change at line 1167 | skipping to change at line 1169 | |||
if (!this.options.markerZoomAnimation) { | if (!this.options.markerZoomAnimation) { | |||
DomUtil.addClass(panes.markerPane, 'leaflet-zoom-hide'); | DomUtil.addClass(panes.markerPane, 'leaflet-zoom-hide'); | |||
DomUtil.addClass(panes.shadowPane, 'leaflet-zoom-hide'); | DomUtil.addClass(panes.shadowPane, 'leaflet-zoom-hide'); | |||
} | } | |||
}, | }, | |||
// private methods that modify map state | // private methods that modify map state | |||
// @section Map state change events | // @section Map state change events | |||
_resetView: function (center, zoom) { | _resetView: function (center, zoom, noMoveStart) { | |||
DomUtil.setPosition(this._mapPane, new Point(0, 0)); | DomUtil.setPosition(this._mapPane, new Point(0, 0)); | |||
var loading = !this._loaded; | var loading = !this._loaded; | |||
this._loaded = true; | this._loaded = true; | |||
zoom = this._limitZoom(zoom); | zoom = this._limitZoom(zoom); | |||
this.fire('viewprereset'); | this.fire('viewprereset'); | |||
var zoomChanged = this._zoom !== zoom; | var zoomChanged = this._zoom !== zoom; | |||
this | this | |||
._moveStart(zoomChanged, false) | ._moveStart(zoomChanged, noMoveStart) | |||
._move(center, zoom) | ._move(center, zoom) | |||
._moveEnd(zoomChanged); | ._moveEnd(zoomChanged); | |||
// @event viewreset: Event | // @event viewreset: Event | |||
// Fired when the map needs to redraw its content (this usually h appens | // Fired when the map needs to redraw its content (this usually h appens | |||
// on map zoom or load). Very useful for creating custom overlays . | // on map zoom or load). Very useful for creating custom overlays . | |||
this.fire('viewreset'); | this.fire('viewreset'); | |||
// @event load: Event | // @event load: Event | |||
// Fired when the map is initialized (when its center and zoom ar e set | // Fired when the map is initialized (when its center and zoom ar e set | |||
skipping to change at line 1375 | skipping to change at line 1377 | |||
if (src === this._container) { break; } | if (src === this._container) { break; } | |||
src = src.parentNode; | src = src.parentNode; | |||
} | } | |||
if (!targets.length && !dragging && !isHover && this.listens(type , true)) { | if (!targets.length && !dragging && !isHover && this.listens(type , true)) { | |||
targets = [this]; | targets = [this]; | |||
} | } | |||
return targets; | return targets; | |||
}, | }, | |||
_isClickDisabled: function (el) { | _isClickDisabled: function (el) { | |||
while (el !== this._container) { | while (el && el !== this._container) { | |||
if (el['_leaflet_disable_click']) { return true; } | if (el['_leaflet_disable_click']) { return true; } | |||
el = el.parentNode; | el = el.parentNode; | |||
} | } | |||
}, | }, | |||
_handleDOMEvent: function (e) { | _handleDOMEvent: function (e) { | |||
var el = (e.target || e.srcElement); | var el = (e.target || e.srcElement); | |||
if (!this._loaded || el['_leaflet_disable_events'] || e.type === 'click' && this._isClickDisabled(el)) { | if (!this._loaded || el['_leaflet_disable_events'] || e.type === 'click' && this._isClickDisabled(el)) { | |||
return; | return; | |||
} | } | |||
End of changes. 7 change blocks. | ||||
8 lines changed or deleted | 10 lines changed or added |