Sha256: 5afb39d0bd9ea0522aa74a5289a452c3000633a5abf2f600e7ef52da793b114c

Contents?: true

Size: 709 Bytes

Versions: 9

Compression:

Stored size: 709 Bytes

Contents

/*
 * L.Handler.DoubleClickZoom is used to handle double-click zoom on the map, enabled by default.
 */

L.Map.mergeOptions({
	doubleClickZoom: true
});

L.Map.DoubleClickZoom = L.Handler.extend({
	addHooks: function () {
		this._map.on('dblclick', this._onDoubleClick, this);
	},

	removeHooks: function () {
		this._map.off('dblclick', this._onDoubleClick, this);
	},

	_onDoubleClick: function (e) {
		var map = this._map,
		    zoom = map.getZoom() + (e.originalEvent.shiftKey ? -1 : 1);

		if (map.options.doubleClickZoom === 'center') {
			map.setZoom(zoom);
		} else {
			map.setZoomAround(e.containerPoint, zoom);
		}
	}
});

L.Map.addInitHook('addHandler', 'doubleClickZoom', L.Map.DoubleClickZoom);

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
leaflet-js-0.7.9 vendor/assets/Leaflet/src/map/handler/Map.DoubleClickZoom.js
leaflet-js-0.7.8 vendor/assets/Leaflet/src/map/handler/Map.DoubleClickZoom.js
leaflet-js-0.7.7 vendor/assets/Leaflet/src/map/handler/Map.DoubleClickZoom.js
leaflet-js-0.8.dev2 lib/leaflet/src/map/handler/Map.DoubleClickZoom.js
leaflet-js-0.7.0.4 lib/leaflet/src/map/handler/Map.DoubleClickZoom.js
leaflet-js-0.7.0.3 lib/leaflet/src/map/handler/Map.DoubleClickZoom.js
leaflet-js-0.7.0.2 lib/leaflet/src/map/handler/Map.DoubleClickZoom.js
leaflet-js-0.7.0.1 lib/leaflet/src/map/handler/Map.DoubleClickZoom.js
leaflet-js-0.7.0 lib/leaflet/src/map/handler/Map.DoubleClickZoom.js