s/Control/Interaction/, thanks @elemoine
This commit is contained in:
@@ -6,19 +6,19 @@ goog.require('ol.Collection');
|
||||
goog.require('ol.Map');
|
||||
goog.require('ol.MapProperty');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.control.AltDragRotate');
|
||||
goog.require('ol.control.CenterConstraint');
|
||||
goog.require('ol.control.Constraints');
|
||||
goog.require('ol.control.DblClickZoom');
|
||||
goog.require('ol.control.DragPan');
|
||||
goog.require('ol.control.KeyboardPan');
|
||||
goog.require('ol.control.KeyboardZoom');
|
||||
goog.require('ol.control.MouseWheelZoom');
|
||||
goog.require('ol.control.ResolutionConstraint');
|
||||
goog.require('ol.control.RotationConstraint');
|
||||
goog.require('ol.control.ShiftDragZoom');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.dom.Map');
|
||||
goog.require('ol.interaction.AltDragRotate');
|
||||
goog.require('ol.interaction.CenterConstraint');
|
||||
goog.require('ol.interaction.Constraints');
|
||||
goog.require('ol.interaction.DblClickZoom');
|
||||
goog.require('ol.interaction.DragPan');
|
||||
goog.require('ol.interaction.KeyboardPan');
|
||||
goog.require('ol.interaction.KeyboardZoom');
|
||||
goog.require('ol.interaction.MouseWheelZoom');
|
||||
goog.require('ol.interaction.ResolutionConstraint');
|
||||
goog.require('ol.interaction.RotationConstraint');
|
||||
goog.require('ol.interaction.ShiftDragZoom');
|
||||
goog.require('ol.webgl');
|
||||
goog.require('ol.webgl.Map');
|
||||
|
||||
@@ -80,23 +80,24 @@ ol.createMap = function(target, opt_values, opt_rendererHints) {
|
||||
}
|
||||
|
||||
// FIXME this should be a configuration option
|
||||
var centerConstraint = ol.control.CenterConstraint.snapToPixel;
|
||||
var resolutionConstraint = ol.control.ResolutionConstraint.createSnapToPower(
|
||||
Math.exp(Math.log(2) / 8), ol.Projection.EPSG_3857_HALF_SIZE / 128);
|
||||
var rotationConstraint = ol.control.RotationConstraint.none;
|
||||
var constraints = new ol.control.Constraints(
|
||||
var centerConstraint = ol.interaction.CenterConstraint.snapToPixel;
|
||||
var resolutionConstraint =
|
||||
ol.interaction.ResolutionConstraint.createSnapToPower(
|
||||
Math.exp(Math.log(2) / 8), ol.Projection.EPSG_3857_HALF_SIZE / 128);
|
||||
var rotationConstraint = ol.interaction.RotationConstraint.none;
|
||||
var constraints = new ol.interaction.Constraints(
|
||||
centerConstraint, resolutionConstraint, rotationConstraint);
|
||||
|
||||
if (!goog.object.containsKey(values, ol.MapProperty.CONTROLS)) {
|
||||
var controls = new ol.Collection();
|
||||
controls.push(new ol.control.AltDragRotate(constraints));
|
||||
controls.push(new ol.control.DblClickZoom(constraints));
|
||||
controls.push(new ol.control.DragPan(constraints));
|
||||
controls.push(new ol.control.KeyboardPan(constraints, 16));
|
||||
controls.push(new ol.control.KeyboardZoom(constraints));
|
||||
controls.push(new ol.control.MouseWheelZoom(constraints));
|
||||
controls.push(new ol.control.ShiftDragZoom(constraints));
|
||||
values[ol.MapProperty.CONTROLS] = controls;
|
||||
if (!goog.object.containsKey(values, ol.MapProperty.INTERACTIONS)) {
|
||||
var interactions = new ol.Collection();
|
||||
interactions.push(new ol.interaction.AltDragRotate(constraints));
|
||||
interactions.push(new ol.interaction.DblClickZoom(constraints));
|
||||
interactions.push(new ol.interaction.DragPan(constraints));
|
||||
interactions.push(new ol.interaction.KeyboardPan(constraints, 16));
|
||||
interactions.push(new ol.interaction.KeyboardZoom(constraints));
|
||||
interactions.push(new ol.interaction.MouseWheelZoom(constraints));
|
||||
interactions.push(new ol.interaction.ShiftDragZoom(constraints));
|
||||
values[ol.MapProperty.INTERACTIONS] = interactions;
|
||||
}
|
||||
|
||||
if (!goog.object.containsKey(values, ol.MapProperty.LAYERS)) {
|
||||
|
||||
@@ -30,9 +30,9 @@ goog.require('goog.object');
|
||||
goog.require('goog.vec.Mat4');
|
||||
goog.require('ol.Collection');
|
||||
goog.require('ol.Color');
|
||||
goog.require('ol.Control');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.Interaction');
|
||||
goog.require('ol.LayerRenderer');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.Object');
|
||||
@@ -48,7 +48,7 @@ goog.require('ol.TransformFunction');
|
||||
ol.MapProperty = {
|
||||
BACKGROUND_COLOR: 'backgroundColor',
|
||||
CENTER: 'center',
|
||||
CONTROLS: 'controls',
|
||||
INTERACTIONS: 'interactions',
|
||||
LAYERS: 'layers',
|
||||
PROJECTION: 'projection',
|
||||
RESOLUTION: 'resolution',
|
||||
@@ -349,18 +349,6 @@ goog.exportProperty(
|
||||
ol.Map.prototype.getCenter);
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Collection} Controls.
|
||||
*/
|
||||
ol.Map.prototype.getControls = function() {
|
||||
return /** @type {ol.Collection} */ this.get(ol.MapProperty.CONTROLS);
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.Map.prototype,
|
||||
'getControls',
|
||||
ol.Map.prototype.getControls);
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Pixel} pixel Pixel.
|
||||
* @return {ol.Coordinate|undefined} Coordinate.
|
||||
@@ -396,6 +384,18 @@ ol.Map.prototype.getExtent = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Collection} Interactions.
|
||||
*/
|
||||
ol.Map.prototype.getInteractions = function() {
|
||||
return /** @type {ol.Collection} */ this.get(ol.MapProperty.INTERACTIONS);
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.Map.prototype,
|
||||
'getInteractions',
|
||||
ol.Map.prototype.getInteractions);
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Layer} layer Layer.
|
||||
* @protected
|
||||
@@ -581,10 +581,11 @@ ol.Map.prototype.handleBackgroundColorChanged = goog.nullFunction;
|
||||
ol.Map.prototype.handleBrowserEvent = function(browserEvent, opt_type) {
|
||||
var type = opt_type || browserEvent.type;
|
||||
var mapBrowserEvent = new ol.MapBrowserEvent(type, this, browserEvent);
|
||||
var controls = this.getControls();
|
||||
var controlsArray = /** @type {Array.<ol.Control>} */ controls.getArray();
|
||||
goog.array.every(controlsArray, function(control) {
|
||||
control.handleMapBrowserEvent(mapBrowserEvent);
|
||||
var interactions = this.getInteractions();
|
||||
var interactionsArray = /** @type {Array.<ol.Interaction>} */
|
||||
interactions.getArray();
|
||||
goog.array.every(interactionsArray, function(interaction) {
|
||||
interaction.handleMapBrowserEvent(mapBrowserEvent);
|
||||
return !mapBrowserEvent.defaultPrevented;
|
||||
});
|
||||
};
|
||||
@@ -813,15 +814,15 @@ goog.exportProperty(
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Collection} controls Controls.
|
||||
* @param {ol.Collection} interactions Interactions.
|
||||
*/
|
||||
ol.Map.prototype.setControls = function(controls) {
|
||||
this.set(ol.MapProperty.CONTROLS, controls);
|
||||
ol.Map.prototype.setInteractions = function(interactions) {
|
||||
this.set(ol.MapProperty.INTERACTIONS, interactions);
|
||||
};
|
||||
goog.exportProperty(
|
||||
ol.Map.prototype,
|
||||
'setControls',
|
||||
ol.Map.prototype.setControls);
|
||||
'setInteractions',
|
||||
ol.Map.prototype.setInteractions);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
goog.provide('ol.control.Constraints');
|
||||
|
||||
goog.require('ol.control.CenterConstraintType');
|
||||
goog.require('ol.control.ResolutionConstraintType');
|
||||
goog.require('ol.control.RotationConstraintType');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {ol.control.CenterConstraintType} centerConstraint Center constraint.
|
||||
* @param {ol.control.ResolutionConstraintType} resolutionConstraint
|
||||
* Resolution constraint.
|
||||
* @param {ol.control.RotationConstraintType} rotationConstraint
|
||||
* Rotation constraint.
|
||||
*/
|
||||
ol.control.Constraints =
|
||||
function(centerConstraint, resolutionConstraint, rotationConstraint) {
|
||||
|
||||
/**
|
||||
* @type {ol.control.CenterConstraintType}
|
||||
*/
|
||||
this.center = centerConstraint;
|
||||
|
||||
/**
|
||||
* @type {ol.control.ResolutionConstraintType}
|
||||
*/
|
||||
this.resolution = resolutionConstraint;
|
||||
|
||||
/**
|
||||
* @type {ol.control.RotationConstraintType}
|
||||
*/
|
||||
this.rotation = rotationConstraint;
|
||||
|
||||
};
|
||||
@@ -1,32 +1,32 @@
|
||||
goog.provide('ol.control.AltDragRotate');
|
||||
goog.provide('ol.interaction.AltDragRotate');
|
||||
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.control.Drag');
|
||||
goog.require('ol.interaction.Drag');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Drag}
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @extends {ol.interaction.Drag}
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
*/
|
||||
ol.control.AltDragRotate = function(constraints) {
|
||||
ol.interaction.AltDragRotate = function(constraints) {
|
||||
goog.base(this, constraints);
|
||||
};
|
||||
goog.inherits(ol.control.AltDragRotate, ol.control.Drag);
|
||||
goog.inherits(ol.interaction.AltDragRotate, ol.interaction.Drag);
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
ol.control.AltDragRotate.prototype.startRotation_;
|
||||
ol.interaction.AltDragRotate.prototype.startRotation_;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.AltDragRotate.prototype.handleDrag = function(mapBrowserEvent) {
|
||||
ol.interaction.AltDragRotate.prototype.handleDrag = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var map = mapBrowserEvent.map;
|
||||
var size = map.getSize();
|
||||
@@ -40,7 +40,7 @@ ol.control.AltDragRotate.prototype.handleDrag = function(mapBrowserEvent) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.AltDragRotate.prototype.handleDragStart =
|
||||
ol.interaction.AltDragRotate.prototype.handleDragStart =
|
||||
function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var map = mapBrowserEvent.map;
|
||||
@@ -1,5 +1,5 @@
|
||||
goog.provide('ol.control.CenterConstraint');
|
||||
goog.provide('ol.control.CenterConstraintType');
|
||||
goog.provide('ol.interaction.CenterConstraint');
|
||||
goog.provide('ol.interaction.CenterConstraintType');
|
||||
|
||||
goog.require('ol.Coordinate');
|
||||
|
||||
@@ -9,7 +9,7 @@ goog.require('ol.Coordinate');
|
||||
* (number|undefined),
|
||||
* ol.Coordinate): (ol.Coordinate|undefined)}
|
||||
*/
|
||||
ol.control.CenterConstraintType;
|
||||
ol.interaction.CenterConstraintType;
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ ol.control.CenterConstraintType;
|
||||
* @param {ol.Coordinate} delta Delta.
|
||||
* @return {ol.Coordinate|undefined} Center.
|
||||
*/
|
||||
ol.control.CenterConstraint.none = function(center, resolution, delta) {
|
||||
ol.interaction.CenterConstraint.none = function(center, resolution, delta) {
|
||||
if (goog.isDefAndNotNull(center) && goog.isDef(resolution)) {
|
||||
var x = center.x + delta.x;
|
||||
var y = center.y + delta.y;
|
||||
@@ -35,7 +35,8 @@ ol.control.CenterConstraint.none = function(center, resolution, delta) {
|
||||
* @param {ol.Coordinate} delta Delta.
|
||||
* @return {ol.Coordinate|undefined} Center.
|
||||
*/
|
||||
ol.control.CenterConstraint.snapToPixel = function(center, resolution, delta) {
|
||||
ol.interaction.CenterConstraint.snapToPixel =
|
||||
function(center, resolution, delta) {
|
||||
if (goog.isDefAndNotNull(center) && goog.isDef(resolution)) {
|
||||
var x = Math.floor((center.x + delta.x) / resolution + 0.5) * resolution;
|
||||
var y = Math.floor((center.y + delta.y) / resolution + 0.5) * resolution;
|
||||
36
src/ol/interaction/constraints.js
Normal file
36
src/ol/interaction/constraints.js
Normal file
@@ -0,0 +1,36 @@
|
||||
goog.provide('ol.interaction.Constraints');
|
||||
|
||||
goog.require('ol.interaction.CenterConstraintType');
|
||||
goog.require('ol.interaction.ResolutionConstraintType');
|
||||
goog.require('ol.interaction.RotationConstraintType');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {ol.interaction.CenterConstraintType} centerConstraint
|
||||
* Center constraint.
|
||||
* @param {ol.interaction.ResolutionConstraintType} resolutionConstraint
|
||||
* Resolution constraint.
|
||||
* @param {ol.interaction.RotationConstraintType} rotationConstraint
|
||||
* Rotation constraint.
|
||||
*/
|
||||
ol.interaction.Constraints =
|
||||
function(centerConstraint, resolutionConstraint, rotationConstraint) {
|
||||
|
||||
/**
|
||||
* @type {ol.interaction.CenterConstraintType}
|
||||
*/
|
||||
this.center = centerConstraint;
|
||||
|
||||
/**
|
||||
* @type {ol.interaction.ResolutionConstraintType}
|
||||
*/
|
||||
this.resolution = resolutionConstraint;
|
||||
|
||||
/**
|
||||
* @type {ol.interaction.RotationConstraintType}
|
||||
*/
|
||||
this.rotation = rotationConstraint;
|
||||
|
||||
};
|
||||
@@ -1,27 +1,27 @@
|
||||
goog.provide('ol.control.DblClickZoom');
|
||||
goog.provide('ol.interaction.DblClickZoom');
|
||||
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('ol.Control');
|
||||
goog.require('ol.Interaction');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.control.Constraints');
|
||||
goog.require('ol.interaction.Constraints');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Control}
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @extends {ol.Interaction}
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
*/
|
||||
ol.control.DblClickZoom = function(constraints) {
|
||||
ol.interaction.DblClickZoom = function(constraints) {
|
||||
goog.base(this, constraints);
|
||||
};
|
||||
goog.inherits(ol.control.DblClickZoom, ol.Control);
|
||||
goog.inherits(ol.interaction.DblClickZoom, ol.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.DblClickZoom.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.DblClickZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
if (mapBrowserEvent.type == goog.events.EventType.DBLCLICK) {
|
||||
var map = mapBrowserEvent.map;
|
||||
@@ -1,22 +1,22 @@
|
||||
|
||||
goog.provide('ol.control.Drag');
|
||||
goog.provide('ol.interaction.Drag');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.events.EventType');
|
||||
goog.require('goog.functions');
|
||||
goog.require('ol.Control');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Interaction');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.control.Constraints');
|
||||
goog.require('ol.interaction.Constraints');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Control}
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @extends {ol.Interaction}
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
*/
|
||||
ol.control.Drag = function(constraints) {
|
||||
ol.interaction.Drag = function(constraints) {
|
||||
|
||||
goog.base(this, constraints);
|
||||
|
||||
@@ -57,14 +57,14 @@ ol.control.Drag = function(constraints) {
|
||||
this.startCoordinate = null;
|
||||
|
||||
};
|
||||
goog.inherits(ol.control.Drag, ol.Control);
|
||||
goog.inherits(ol.interaction.Drag, ol.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Event.
|
||||
* @protected
|
||||
*/
|
||||
ol.control.Drag.prototype.handleDrag = goog.nullFunction;
|
||||
ol.interaction.Drag.prototype.handleDrag = goog.nullFunction;
|
||||
|
||||
|
||||
/**
|
||||
@@ -72,20 +72,21 @@ ol.control.Drag.prototype.handleDrag = goog.nullFunction;
|
||||
* @protected
|
||||
* @return {boolean} Capture dragging.
|
||||
*/
|
||||
ol.control.Drag.prototype.handleDragStart = goog.functions.FALSE;
|
||||
ol.interaction.Drag.prototype.handleDragStart = goog.functions.FALSE;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Event.
|
||||
* @protected
|
||||
*/
|
||||
ol.control.Drag.prototype.handleDragEnd = goog.nullFunction;
|
||||
ol.interaction.Drag.prototype.handleDragEnd = goog.nullFunction;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.Drag.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
|
||||
ol.interaction.Drag.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
var map = mapBrowserEvent.map;
|
||||
if (!map.isDef()) {
|
||||
return;
|
||||
@@ -1,29 +1,29 @@
|
||||
// FIXME cope with rotation
|
||||
|
||||
goog.provide('ol.control.DragPan');
|
||||
goog.provide('ol.interaction.DragPan');
|
||||
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.control.Constraints');
|
||||
goog.require('ol.control.Drag');
|
||||
goog.require('ol.interaction.Constraints');
|
||||
goog.require('ol.interaction.Drag');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Drag}
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @extends {ol.interaction.Drag}
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
*/
|
||||
ol.control.DragPan = function(constraints) {
|
||||
ol.interaction.DragPan = function(constraints) {
|
||||
goog.base(this, constraints);
|
||||
};
|
||||
goog.inherits(ol.control.DragPan, ol.control.Drag);
|
||||
goog.inherits(ol.interaction.DragPan, ol.interaction.Drag);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
|
||||
ol.interaction.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var resolution = map.getResolution();
|
||||
var delta =
|
||||
@@ -35,7 +35,7 @@ ol.control.DragPan.prototype.handleDrag = function(mapBrowserEvent) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.DragPan.prototype.handleDragStart = function(mapBrowserEvent) {
|
||||
ol.interaction.DragPan.prototype.handleDragStart = function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (!browserEvent.shiftKey) {
|
||||
browserEvent.preventDefault();
|
||||
@@ -1,21 +1,21 @@
|
||||
// FIXME factor out key precondition (shift et. al)
|
||||
|
||||
goog.provide('ol.Control');
|
||||
goog.provide('ol.Interaction');
|
||||
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.control.Constraints');
|
||||
goog.require('ol.interaction.Constraints');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
*/
|
||||
ol.Control = function(constraints) {
|
||||
ol.Interaction = function(constraints) {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {ol.control.Constraints}
|
||||
* @type {ol.interaction.Constraints}
|
||||
*/
|
||||
this.constraints = constraints;
|
||||
|
||||
@@ -25,14 +25,14 @@ ol.Control = function(constraints) {
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||
*/
|
||||
ol.Control.prototype.handleMapBrowserEvent = goog.abstractMethod;
|
||||
ol.Interaction.prototype.handleMapBrowserEvent = goog.abstractMethod;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {ol.Extent} extent Extent.
|
||||
*/
|
||||
ol.Control.prototype.fitExtent = function(map, extent) {
|
||||
ol.Interaction.prototype.fitExtent = function(map, extent) {
|
||||
var resolution = map.getResolutionForExtent(extent);
|
||||
resolution = this.constraints.resolution(resolution, 0);
|
||||
var center = extent.getCenter();
|
||||
@@ -49,7 +49,7 @@ ol.Control.prototype.fitExtent = function(map, extent) {
|
||||
* @param {ol.Coordinate} delta Delta.
|
||||
* @param {ol.Coordinate=} opt_anchor Anchor.
|
||||
*/
|
||||
ol.Control.prototype.pan = function(map, delta, opt_anchor) {
|
||||
ol.Interaction.prototype.pan = function(map, delta, opt_anchor) {
|
||||
var center = opt_anchor ? opt_anchor : map.getCenter();
|
||||
var resolution = map.getResolution();
|
||||
center = this.constraints.center(center, resolution, delta);
|
||||
@@ -63,7 +63,7 @@ ol.Control.prototype.pan = function(map, delta, opt_anchor) {
|
||||
* @param {number} delta Delta.
|
||||
* @param {ol.Coordinate=} opt_anchor Anchor.
|
||||
*/
|
||||
ol.Control.prototype.rotate = function(map, rotation, delta, opt_anchor) {
|
||||
ol.Interaction.prototype.rotate = function(map, rotation, delta, opt_anchor) {
|
||||
// FIXME handle rotation about anchor
|
||||
rotation = this.constraints.rotation(rotation, delta);
|
||||
map.setRotation(rotation);
|
||||
@@ -74,7 +74,7 @@ ol.Control.prototype.rotate = function(map, rotation, delta, opt_anchor) {
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {number|undefined} resolution Resolution.
|
||||
*/
|
||||
ol.Control.prototype.setResolution = function(map, resolution) {
|
||||
ol.Interaction.prototype.setResolution = function(map, resolution) {
|
||||
resolution = this.constraints.resolution(resolution, 0);
|
||||
map.setResolution(resolution);
|
||||
};
|
||||
@@ -86,7 +86,7 @@ ol.Control.prototype.setResolution = function(map, resolution) {
|
||||
* @param {number} delta Delta.
|
||||
* @param {ol.Coordinate=} opt_anchor Anchor.
|
||||
*/
|
||||
ol.Control.prototype.zoom = function(map, resolution, delta, opt_anchor) {
|
||||
ol.Interaction.prototype.zoom = function(map, resolution, delta, opt_anchor) {
|
||||
if (goog.isDefAndNotNull(opt_anchor)) {
|
||||
var anchor = opt_anchor;
|
||||
var mapCenter = /** @type {!ol.Coordinate} */ map.getCenter();
|
||||
@@ -1,16 +1,16 @@
|
||||
// FIXME this class is ugly and should be removed
|
||||
|
||||
goog.provide('ol.control.Keyboard');
|
||||
goog.provide('ol.interaction.Keyboard');
|
||||
|
||||
goog.require('ol.Control');
|
||||
goog.require('ol.Interaction');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Control}
|
||||
* @extends {ol.Interaction}
|
||||
*/
|
||||
ol.control.Keyboard = function() {
|
||||
ol.interaction.Keyboard = function() {
|
||||
|
||||
goog.base(this, null);
|
||||
|
||||
@@ -21,14 +21,14 @@ ol.control.Keyboard = function() {
|
||||
this.charCodeCallbacks_ = {};
|
||||
|
||||
};
|
||||
goog.inherits(ol.control.Keyboard, ol.Control);
|
||||
goog.inherits(ol.interaction.Keyboard, ol.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} s String.
|
||||
* @param {Function} callback Callback.
|
||||
*/
|
||||
ol.control.Keyboard.prototype.addCallback = function(s, callback) {
|
||||
ol.interaction.Keyboard.prototype.addCallback = function(s, callback) {
|
||||
var i;
|
||||
for (i = 0; i < s.length; ++i) {
|
||||
this.charCodeCallbacks_[s.charCodeAt(i)] = callback;
|
||||
@@ -39,7 +39,7 @@ ol.control.Keyboard.prototype.addCallback = function(s, callback) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.Keyboard.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.Keyboard.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) {
|
||||
var keyEvent = /** @type {goog.events.KeyEvent} */
|
||||
@@ -1,19 +1,19 @@
|
||||
goog.provide('ol.control.KeyboardPan');
|
||||
goog.provide('ol.interaction.KeyboardPan');
|
||||
|
||||
goog.require('goog.events.KeyCodes');
|
||||
goog.require('goog.events.KeyHandler.EventType');
|
||||
goog.require('ol.Control');
|
||||
goog.require('ol.control.Constraints');
|
||||
goog.require('ol.Interaction');
|
||||
goog.require('ol.interaction.Constraints');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Control}
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @extends {ol.Interaction}
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
* @param {number} pixelDelta Pixel delta.
|
||||
*/
|
||||
ol.control.KeyboardPan = function(constraints, pixelDelta) {
|
||||
ol.interaction.KeyboardPan = function(constraints, pixelDelta) {
|
||||
|
||||
goog.base(this, constraints);
|
||||
|
||||
@@ -24,13 +24,13 @@ ol.control.KeyboardPan = function(constraints, pixelDelta) {
|
||||
this.pixelDelta_ = pixelDelta;
|
||||
|
||||
};
|
||||
goog.inherits(ol.control.KeyboardPan, ol.Control);
|
||||
goog.inherits(ol.interaction.KeyboardPan, ol.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.KeyboardPan.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) {
|
||||
var keyEvent = /** @type {goog.events.KeyEvent} */
|
||||
@@ -1,27 +1,27 @@
|
||||
goog.provide('ol.control.KeyboardZoom');
|
||||
goog.provide('ol.interaction.KeyboardZoom');
|
||||
|
||||
goog.require('goog.events.KeyCodes');
|
||||
goog.require('goog.events.KeyHandler.EventType');
|
||||
goog.require('ol.Control');
|
||||
goog.require('ol.control.ResolutionConstraintType');
|
||||
goog.require('ol.Interaction');
|
||||
goog.require('ol.interaction.ResolutionConstraintType');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Control}
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @extends {ol.Interaction}
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
*/
|
||||
ol.control.KeyboardZoom = function(constraints) {
|
||||
ol.interaction.KeyboardZoom = function(constraints) {
|
||||
goog.base(this, constraints);
|
||||
};
|
||||
goog.inherits(ol.control.KeyboardZoom, ol.Control);
|
||||
goog.inherits(ol.interaction.KeyboardZoom, ol.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.KeyboardZoom.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.KeyboardZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
if (mapBrowserEvent.type == goog.events.KeyHandler.EventType.KEY) {
|
||||
var keyEvent = /** @type {goog.events.KeyEvent} */
|
||||
@@ -1,27 +1,27 @@
|
||||
goog.provide('ol.control.MouseWheelZoom');
|
||||
goog.provide('ol.interaction.MouseWheelZoom');
|
||||
|
||||
goog.require('goog.events.MouseWheelEvent');
|
||||
goog.require('goog.events.MouseWheelHandler.EventType');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.control.Constraints');
|
||||
goog.require('ol.interaction.Constraints');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.Control}
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @extends {ol.Interaction}
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
*/
|
||||
ol.control.MouseWheelZoom = function(constraints) {
|
||||
ol.interaction.MouseWheelZoom = function(constraints) {
|
||||
goog.base(this, constraints);
|
||||
};
|
||||
goog.inherits(ol.control.MouseWheelZoom, ol.Control);
|
||||
goog.inherits(ol.interaction.MouseWheelZoom, ol.Interaction);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
||||
ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
||||
function(mapBrowserEvent) {
|
||||
if (mapBrowserEvent.type ==
|
||||
goog.events.MouseWheelHandler.EventType.MOUSEWHEEL) {
|
||||
@@ -1,5 +1,5 @@
|
||||
goog.provide('ol.control.ResolutionConstraint');
|
||||
goog.provide('ol.control.ResolutionConstraintType');
|
||||
goog.provide('ol.interaction.ResolutionConstraint');
|
||||
goog.provide('ol.interaction.ResolutionConstraintType');
|
||||
|
||||
goog.require('goog.math');
|
||||
goog.require('ol.array');
|
||||
@@ -8,16 +8,16 @@ goog.require('ol.array');
|
||||
/**
|
||||
* @typedef {function((number|undefined), number): (number|undefined)}
|
||||
*/
|
||||
ol.control.ResolutionConstraintType;
|
||||
ol.interaction.ResolutionConstraintType;
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} power Power.
|
||||
* @param {number} maxResolution Maximum resolution.
|
||||
* @param {number=} opt_minResolution Minimum resolution.
|
||||
* @return {ol.control.ResolutionConstraintType} Zoom function.
|
||||
* @return {ol.interaction.ResolutionConstraintType} Zoom function.
|
||||
*/
|
||||
ol.control.ResolutionConstraint.createContinuous =
|
||||
ol.interaction.ResolutionConstraint.createContinuous =
|
||||
function(power, maxResolution, opt_minResolution) {
|
||||
var minResolution = opt_minResolution || 0;
|
||||
return function(resolution, delta) {
|
||||
@@ -33,9 +33,9 @@ ol.control.ResolutionConstraint.createContinuous =
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} resolutions Resolutions.
|
||||
* @return {ol.control.ResolutionConstraintType} Zoom function.
|
||||
* @return {ol.interaction.ResolutionConstraintType} Zoom function.
|
||||
*/
|
||||
ol.control.ResolutionConstraint.createSnapToResolutions =
|
||||
ol.interaction.ResolutionConstraint.createSnapToResolutions =
|
||||
function(resolutions) {
|
||||
return function(resolution, delta) {
|
||||
if (goog.isDef(resolution)) {
|
||||
@@ -53,9 +53,9 @@ ol.control.ResolutionConstraint.createSnapToResolutions =
|
||||
* @param {number} power Power.
|
||||
* @param {number} maxResolution Maximum resolution.
|
||||
* @param {number=} opt_maxLevel Maximum level.
|
||||
* @return {ol.control.ResolutionConstraintType} Zoom function.
|
||||
* @return {ol.interaction.ResolutionConstraintType} Zoom function.
|
||||
*/
|
||||
ol.control.ResolutionConstraint.createSnapToPower =
|
||||
ol.interaction.ResolutionConstraint.createSnapToPower =
|
||||
function(power, maxResolution, opt_maxLevel) {
|
||||
return function(resolution, delta) {
|
||||
if (goog.isDef(resolution)) {
|
||||
@@ -1,10 +1,10 @@
|
||||
goog.require('goog.testing.jsunit');
|
||||
goog.require('ol.control.ResolutionConstraint');
|
||||
goog.require('ol.interaction.ResolutionConstraint');
|
||||
|
||||
|
||||
function testSnapToResolutionsZero() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToResolutions(
|
||||
ol.interaction.ResolutionConstraint.createSnapToResolutions(
|
||||
[1000, 500, 250, 100]);
|
||||
assertEquals(1000, resolutionConstraint(1000, 0));
|
||||
assertEquals(500, resolutionConstraint(500, 0));
|
||||
@@ -15,7 +15,7 @@ function testSnapToResolutionsZero() {
|
||||
|
||||
function testSnapToResolutionsZoomIn() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToResolutions(
|
||||
ol.interaction.ResolutionConstraint.createSnapToResolutions(
|
||||
[1000, 500, 250, 100]);
|
||||
assertEquals(500, resolutionConstraint(1000, 1));
|
||||
assertEquals(250, resolutionConstraint(500, 1));
|
||||
@@ -26,7 +26,7 @@ function testSnapToResolutionsZoomIn() {
|
||||
|
||||
function testSnapToResolutionsZoomOut() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToResolutions(
|
||||
ol.interaction.ResolutionConstraint.createSnapToResolutions(
|
||||
[1000, 500, 250, 100]);
|
||||
assertEquals(1000, resolutionConstraint(1000, -1));
|
||||
assertEquals(1000, resolutionConstraint(500, -1));
|
||||
@@ -37,7 +37,7 @@ function testSnapToResolutionsZoomOut() {
|
||||
|
||||
function testSnapToResolutionsNearestZero() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToResolutions(
|
||||
ol.interaction.ResolutionConstraint.createSnapToResolutions(
|
||||
[1000, 500, 250, 100]);
|
||||
assertEquals(1000, resolutionConstraint(1050, 0));
|
||||
assertEquals(1000, resolutionConstraint(950, 0));
|
||||
@@ -52,7 +52,7 @@ function testSnapToResolutionsNearestZero() {
|
||||
|
||||
function testSnapToResolutionsNearestZoomIn() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToResolutions(
|
||||
ol.interaction.ResolutionConstraint.createSnapToResolutions(
|
||||
[1000, 500, 250, 100]);
|
||||
assertEquals(500, resolutionConstraint(1050, 1));
|
||||
assertEquals(500, resolutionConstraint(950, 1));
|
||||
@@ -67,7 +67,7 @@ function testSnapToResolutionsNearestZoomIn() {
|
||||
|
||||
function testSnapToResolutionsNearestZoomOut() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToResolutions(
|
||||
ol.interaction.ResolutionConstraint.createSnapToResolutions(
|
||||
[1000, 500, 250, 100]);
|
||||
assertEquals(1000, resolutionConstraint(1050, -1));
|
||||
assertEquals(1000, resolutionConstraint(950, -1));
|
||||
@@ -82,7 +82,7 @@ function testSnapToResolutionsNearestZoomOut() {
|
||||
|
||||
function testSnapToPowerZero() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToPower(2, 1024, 10);
|
||||
ol.interaction.ResolutionConstraint.createSnapToPower(2, 1024, 10);
|
||||
assertEquals(1024, resolutionConstraint(1024, 0));
|
||||
assertEquals(512, resolutionConstraint(512, 0));
|
||||
assertEquals(256, resolutionConstraint(256, 0));
|
||||
@@ -99,7 +99,7 @@ function testSnapToPowerZero() {
|
||||
|
||||
function testSnapToPowerZoomIn() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToPower(2, 1024, 10);
|
||||
ol.interaction.ResolutionConstraint.createSnapToPower(2, 1024, 10);
|
||||
assertEquals(512, resolutionConstraint(1024, 1));
|
||||
assertEquals(256, resolutionConstraint(512, 1));
|
||||
assertEquals(128, resolutionConstraint(256, 1));
|
||||
@@ -116,7 +116,7 @@ function testSnapToPowerZoomIn() {
|
||||
|
||||
function testSnapToPowerZoomOut() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToPower(2, 1024, 10);
|
||||
ol.interaction.ResolutionConstraint.createSnapToPower(2, 1024, 10);
|
||||
assertEquals(1024, resolutionConstraint(1024, -1));
|
||||
assertEquals(1024, resolutionConstraint(512, -1));
|
||||
assertEquals(512, resolutionConstraint(256, -1));
|
||||
@@ -133,7 +133,7 @@ function testSnapToPowerZoomOut() {
|
||||
|
||||
function testSnapToPowerNearestZero() {
|
||||
var resolutionConstraint =
|
||||
ol.control.ResolutionConstraint.createSnapToPower(2, 1024, 10);
|
||||
ol.interaction.ResolutionConstraint.createSnapToPower(2, 1024, 10);
|
||||
assertEquals(1024, resolutionConstraint(1050, 0));
|
||||
assertEquals(1024, resolutionConstraint(9050, 0));
|
||||
assertEquals(512, resolutionConstraint(550, 0));
|
||||
@@ -1,11 +1,11 @@
|
||||
goog.provide('ol.control.RotationConstraint');
|
||||
goog.provide('ol.control.RotationConstraintType');
|
||||
goog.provide('ol.interaction.RotationConstraint');
|
||||
goog.provide('ol.interaction.RotationConstraintType');
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {function((number|undefined), number): (number|undefined)}
|
||||
*/
|
||||
ol.control.RotationConstraintType;
|
||||
ol.interaction.RotationConstraintType;
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,7 +13,7 @@ ol.control.RotationConstraintType;
|
||||
* @param {number} delta Delta.
|
||||
* @return {number|undefined} Rotation.
|
||||
*/
|
||||
ol.control.RotationConstraint.none = function(rotation, delta) {
|
||||
ol.interaction.RotationConstraint.none = function(rotation, delta) {
|
||||
if (goog.isDef(rotation)) {
|
||||
return rotation + delta;
|
||||
} else {
|
||||
@@ -24,9 +24,9 @@ ol.control.RotationConstraint.none = function(rotation, delta) {
|
||||
|
||||
/**
|
||||
* @param {number} n N.
|
||||
* @return {ol.control.RotationConstraintType} Rotation constraint.
|
||||
* @return {ol.interaction.RotationConstraintType} Rotation constraint.
|
||||
*/
|
||||
ol.control.RotationConstraint.createSnapToN = function(n) {
|
||||
ol.interaction.RotationConstraint.createSnapToN = function(n) {
|
||||
var theta = 2 * Math.PI / n;
|
||||
return function(rotation, delta) {
|
||||
if (goog.isDef(rotation)) {
|
||||
@@ -1,41 +1,41 @@
|
||||
goog.provide('ol.control.ShiftDragRotateAndZoom');
|
||||
goog.provide('ol.interaction.ShiftDragRotateAndZoom');
|
||||
|
||||
goog.require('goog.math.Vec2');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.control.Constraints');
|
||||
goog.require('ol.control.Drag');
|
||||
goog.require('ol.interaction.Constraints');
|
||||
goog.require('ol.interaction.Drag');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Drag}
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @extends {ol.interaction.Drag}
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
*/
|
||||
ol.control.ShiftDragRotateAndZoom = function(constraints) {
|
||||
ol.interaction.ShiftDragRotateAndZoom = function(constraints) {
|
||||
goog.base(this, constraints);
|
||||
};
|
||||
goog.inherits(ol.control.ShiftDragRotateAndZoom, ol.control.Drag);
|
||||
goog.inherits(ol.interaction.ShiftDragRotateAndZoom, ol.interaction.Drag);
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
ol.control.ShiftDragRotateAndZoom.prototype.startRatio_;
|
||||
ol.interaction.ShiftDragRotateAndZoom.prototype.startRatio_;
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
ol.control.ShiftDragRotateAndZoom.prototype.startRotation_;
|
||||
ol.interaction.ShiftDragRotateAndZoom.prototype.startRotation_;
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.ShiftDragRotateAndZoom.prototype.handleDrag =
|
||||
ol.interaction.ShiftDragRotateAndZoom.prototype.handleDrag =
|
||||
function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var map = mapBrowserEvent.map;
|
||||
@@ -54,7 +54,7 @@ ol.control.ShiftDragRotateAndZoom.prototype.handleDrag =
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.ShiftDragRotateAndZoom.prototype.handleDragStart =
|
||||
ol.interaction.ShiftDragRotateAndZoom.prototype.handleDragStart =
|
||||
function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
var map = mapBrowserEvent.map;
|
||||
@@ -1,11 +1,11 @@
|
||||
// FIXME draw drag box
|
||||
|
||||
goog.provide('ol.control.ShiftDragZoom');
|
||||
goog.provide('ol.interaction.ShiftDragZoom');
|
||||
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.MapBrowserEvent');
|
||||
goog.require('ol.control.Constraints');
|
||||
goog.require('ol.control.Drag');
|
||||
goog.require('ol.interaction.Constraints');
|
||||
goog.require('ol.interaction.Drag');
|
||||
|
||||
|
||||
/**
|
||||
@@ -24,19 +24,20 @@ ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS_SQUARED =
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.control.Drag}
|
||||
* @param {ol.control.Constraints} constraints Constraints.
|
||||
* @extends {ol.interaction.Drag}
|
||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||
*/
|
||||
ol.control.ShiftDragZoom = function(constraints) {
|
||||
ol.interaction.ShiftDragZoom = function(constraints) {
|
||||
goog.base(this, constraints);
|
||||
};
|
||||
goog.inherits(ol.control.ShiftDragZoom, ol.control.Drag);
|
||||
goog.inherits(ol.interaction.ShiftDragZoom, ol.interaction.Drag);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.ShiftDragZoom.prototype.handleDragEnd = function(mapBrowserEvent) {
|
||||
ol.interaction.ShiftDragZoom.prototype.handleDragEnd =
|
||||
function(mapBrowserEvent) {
|
||||
if (this.deltaX * this.deltaX + this.deltaY * this.deltaY >=
|
||||
ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS_SQUARED) {
|
||||
var map = mapBrowserEvent.map;
|
||||
@@ -51,7 +52,8 @@ ol.control.ShiftDragZoom.prototype.handleDragEnd = function(mapBrowserEvent) {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.control.ShiftDragZoom.prototype.handleDragStart = function(mapBrowserEvent) {
|
||||
ol.interaction.ShiftDragZoom.prototype.handleDragStart =
|
||||
function(mapBrowserEvent) {
|
||||
var browserEvent = mapBrowserEvent.browserEvent;
|
||||
if (browserEvent.shiftKey) {
|
||||
browserEvent.preventDefault();
|
||||
Reference in New Issue
Block a user