leaflet
Advanced tools
Comparing version 1.8.0-alpha.0 to 1.8.0-beta.0
{ | ||
"name": "leaflet", | ||
"version": "1.8.0-alpha.0", | ||
"version": "1.8.0-beta.0", | ||
"homepage": "https://leafletjs.com/", | ||
@@ -5,0 +5,0 @@ "description": "JavaScript library for mobile-friendly interactive maps", |
@@ -5,3 +5,5 @@ import {Layer} from '../Layer'; | ||
import {toLatLng as latLng} from '../../geo/LatLng'; | ||
import {toPoint as point} from '../../geometry/Point'; | ||
import * as DomUtil from '../../dom/DomUtil'; | ||
import * as DomEvent from '../../dom/DomEvent'; | ||
import {MarkerDrag} from './Marker.Drag'; | ||
@@ -77,2 +79,8 @@ | ||
// @option autoPanOnFocus: Boolean = true | ||
// When `true`, the map will pan whenever the marker is focused (via | ||
// e.g. pressing `tab` on the keyboard) to ensure the marker is | ||
// visible within the map's bounds | ||
autoPanOnFocus: true, | ||
// @section Draggable marker options | ||
@@ -242,2 +250,6 @@ // @option draggable: Boolean = false | ||
if (this.options.autoPanOnFocus) { | ||
DomEvent.on(icon, 'focus', this._panOnFocus, this); | ||
} | ||
var newShadow = options.icon.createShadow(this._shadow), | ||
@@ -280,2 +292,6 @@ addShadow = false; | ||
if (this.options.autoPanOnFocus) { | ||
DomEvent.off(this._icon, 'focus', this._panOnFocus, this); | ||
} | ||
DomUtil.remove(this._icon); | ||
@@ -375,2 +391,16 @@ this.removeInteractiveTarget(this._icon); | ||
_panOnFocus: function () { | ||
var map = this._map; | ||
if (!map) { return; } | ||
var iconOpts = this.options.icon.options; | ||
var size = point(iconOpts.iconSize); | ||
var anchor = point(iconOpts.iconAnchor); | ||
map.panInside(this._latlng, { | ||
paddingTopLeft: anchor, | ||
paddingBottomRight: size.subtract(anchor) | ||
}); | ||
}, | ||
_getPopupAnchor: function () { | ||
@@ -377,0 +407,0 @@ return this.options.icon.options.popupAnchor; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
3352662
35946