Rename interactions
The idea behind the naming scheme is that for example for `DragRotate`, `Rotate` is the action and `Drag` the gesture that issues the action.
This commit is contained in:
@@ -432,10 +432,12 @@
|
|||||||
* desired. Default is `true`.
|
* desired. Default is `true`.
|
||||||
* @property {boolean|undefined} shiftDragZoom Whether Shift-drag zoom is
|
* @property {boolean|undefined} shiftDragZoom Whether Shift-drag zoom is
|
||||||
* desired. Default is `true`.
|
* desired. Default is `true`.
|
||||||
* @property {boolean|undefined} pan Whether pan is
|
* @property {boolean|undefined} dragPan Whether drag pan is
|
||||||
|
* desired. Default is `true`.
|
||||||
|
* @property {boolean|undefined} pinchRotate Whether pinch rotate is
|
||||||
|
* desired. Default is `true`.
|
||||||
|
* @property {boolean|undefined} pinchZoom Whether pinch zoom is
|
||||||
* desired. Default is `true`.
|
* desired. Default is `true`.
|
||||||
* @property {boolean|undefined} rotate Whether rotate is desired. Default is `true`.
|
|
||||||
* @property {boolean|undefined} zoom Whether zoom is desired. Default is `true`.
|
|
||||||
* @property {number|undefined} zoomDelta Zoom delta.
|
* @property {number|undefined} zoomDelta Zoom delta.
|
||||||
* @property {number|undefined} zoomDuration Zoom duration.
|
* @property {number|undefined} zoomDuration Zoom duration.
|
||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
@@ -502,7 +504,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} olx.interaction.PanOptions
|
* @typedef {Object} olx.interaction.DragPanOptions
|
||||||
* @property {ol.Kinetic|undefined} kinetic Kinetic inertia to apply to the
|
* @property {ol.Kinetic|undefined} kinetic Kinetic inertia to apply to the
|
||||||
* pan.
|
* pan.
|
||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
@@ -517,14 +519,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} olx.interaction.RotateOptions
|
* @typedef {Object} olx.interaction.PinchRotateOptions
|
||||||
* @property {number|undefined} threshold Minimal angle in radians to start a rotation.
|
* @property {number|undefined} threshold Minimal angle in radians to start a rotation.
|
||||||
* Default is `0.3`.
|
* Default is `0.3`.
|
||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} olx.interaction.ZoomOptions
|
* @typedef {Object} olx.interaction.PinchZoomOptions
|
||||||
* @property {number|undefined} duration Animation duration in milliseconds. Default is `400`.
|
* @property {number|undefined} duration Animation duration in milliseconds. Default is `400`.
|
||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
*/
|
*/
|
||||||
|
|||||||
1
src/ol/interaction/dragpaninteraction.exports
Normal file
1
src/ol/interaction/dragpaninteraction.exports
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@exportSymbol ol.interaction.DragPan
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// FIXME works for View2D only
|
// FIXME works for View2D only
|
||||||
goog.provide('ol.interaction.Pan');
|
goog.provide('ol.interaction.DragPan');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('ol.Kinetic');
|
goog.require('ol.Kinetic');
|
||||||
@@ -16,10 +16,10 @@ goog.require('ol.interaction.Pointer');
|
|||||||
* Allows the user to pan the map by dragging the map.
|
* Allows the user to pan the map by dragging the map.
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Pointer}
|
* @extends {ol.interaction.Pointer}
|
||||||
* @param {olx.interaction.PanOptions=} opt_options Options.
|
* @param {olx.interaction.DragPanOptions=} opt_options Options.
|
||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
*/
|
*/
|
||||||
ol.interaction.Pan = function(opt_options) {
|
ol.interaction.DragPan = function(opt_options) {
|
||||||
|
|
||||||
goog.base(this);
|
goog.base(this);
|
||||||
|
|
||||||
@@ -56,13 +56,13 @@ ol.interaction.Pan = function(opt_options) {
|
|||||||
this.noKinetic_ = false;
|
this.noKinetic_ = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.interaction.Pan, ol.interaction.Pointer);
|
goog.inherits(ol.interaction.DragPan, ol.interaction.Pointer);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.interaction.Pan.prototype.handlePointerDrag = function(mapBrowserEvent) {
|
ol.interaction.DragPan.prototype.handlePointerDrag = function(mapBrowserEvent) {
|
||||||
goog.asserts.assert(this.targetPointers.length >= 1);
|
goog.asserts.assert(this.targetPointers.length >= 1);
|
||||||
var centroid =
|
var centroid =
|
||||||
ol.interaction.Pointer.centroid(this.targetPointers);
|
ol.interaction.Pointer.centroid(this.targetPointers);
|
||||||
@@ -91,7 +91,7 @@ ol.interaction.Pan.prototype.handlePointerDrag = function(mapBrowserEvent) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.interaction.Pan.prototype.handlePointerUp =
|
ol.interaction.DragPan.prototype.handlePointerUp =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
var view2D = map.getView().getView2D();
|
var view2D = map.getView().getView2D();
|
||||||
@@ -124,7 +124,7 @@ ol.interaction.Pan.prototype.handlePointerUp =
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.interaction.Pan.prototype.handlePointerDown =
|
ol.interaction.DragPan.prototype.handlePointerDown =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {
|
if (this.targetPointers.length > 0 && this.condition_(mapBrowserEvent)) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
@@ -3,14 +3,14 @@ goog.provide('ol.interaction');
|
|||||||
goog.require('ol.Collection');
|
goog.require('ol.Collection');
|
||||||
goog.require('ol.Kinetic');
|
goog.require('ol.Kinetic');
|
||||||
goog.require('ol.interaction.DoubleClickZoom');
|
goog.require('ol.interaction.DoubleClickZoom');
|
||||||
|
goog.require('ol.interaction.DragPan');
|
||||||
goog.require('ol.interaction.DragRotate');
|
goog.require('ol.interaction.DragRotate');
|
||||||
goog.require('ol.interaction.DragZoom');
|
goog.require('ol.interaction.DragZoom');
|
||||||
goog.require('ol.interaction.KeyboardPan');
|
goog.require('ol.interaction.KeyboardPan');
|
||||||
goog.require('ol.interaction.KeyboardZoom');
|
goog.require('ol.interaction.KeyboardZoom');
|
||||||
goog.require('ol.interaction.MouseWheelZoom');
|
goog.require('ol.interaction.MouseWheelZoom');
|
||||||
goog.require('ol.interaction.Pan');
|
goog.require('ol.interaction.PinchRotate');
|
||||||
goog.require('ol.interaction.Rotate');
|
goog.require('ol.interaction.PinchZoom');
|
||||||
goog.require('ol.interaction.Zoom');
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,24 +50,24 @@ ol.interaction.defaults = function(opt_options) {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
var pan = goog.isDef(options.pan) ?
|
var dragPan = goog.isDef(options.dragPan) ?
|
||||||
options.pan : true;
|
options.dragPan : true;
|
||||||
if (pan) {
|
if (dragPan) {
|
||||||
interactions.push(new ol.interaction.Pan({
|
interactions.push(new ol.interaction.DragPan({
|
||||||
kinetic: kinetic
|
kinetic: kinetic
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
var rotate = goog.isDef(options.rotate) ?
|
var pinchRotate = goog.isDef(options.pinchRotate) ?
|
||||||
options.rotate : true;
|
options.pinchRotate : true;
|
||||||
if (rotate) {
|
if (pinchRotate) {
|
||||||
interactions.push(new ol.interaction.Rotate());
|
interactions.push(new ol.interaction.PinchRotate());
|
||||||
}
|
}
|
||||||
|
|
||||||
var zoom = goog.isDef(options.zoom) ?
|
var pinchZoom = goog.isDef(options.pinchZoom) ?
|
||||||
options.zoom : true;
|
options.pinchZoom : true;
|
||||||
if (zoom) {
|
if (pinchZoom) {
|
||||||
interactions.push(new ol.interaction.Zoom({
|
interactions.push(new ol.interaction.PinchZoom({
|
||||||
duration: options.zoomDuration
|
duration: options.zoomDuration
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
@exportSymbol ol.interaction.Pan
|
|
||||||
1
src/ol/interaction/pinchrotateinteraction.exports
Normal file
1
src/ol/interaction/pinchrotateinteraction.exports
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@exportSymbol ol.interaction.PinchRotate
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// FIXME works for View2D only
|
// FIXME works for View2D only
|
||||||
|
|
||||||
goog.provide('ol.interaction.Rotate');
|
goog.provide('ol.interaction.PinchRotate');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.style');
|
goog.require('goog.style');
|
||||||
@@ -21,10 +21,10 @@ ol.interaction.ROTATE_ANIMATION_DURATION = 250;
|
|||||||
* on a touch screen.
|
* on a touch screen.
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Pointer}
|
* @extends {ol.interaction.Pointer}
|
||||||
* @param {olx.interaction.RotateOptions=} opt_options Options.
|
* @param {olx.interaction.PinchRotateOptions=} opt_options Options.
|
||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
*/
|
*/
|
||||||
ol.interaction.Rotate = function(opt_options) {
|
ol.interaction.PinchRotate = function(opt_options) {
|
||||||
|
|
||||||
goog.base(this);
|
goog.base(this);
|
||||||
|
|
||||||
@@ -61,13 +61,13 @@ ol.interaction.Rotate = function(opt_options) {
|
|||||||
this.threshold_ = goog.isDef(options.threshold) ? options.threshold : 0.3;
|
this.threshold_ = goog.isDef(options.threshold) ? options.threshold : 0.3;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.interaction.Rotate, ol.interaction.Pointer);
|
goog.inherits(ol.interaction.PinchRotate, ol.interaction.Pointer);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.interaction.Rotate.prototype.handlePointerDrag =
|
ol.interaction.PinchRotate.prototype.handlePointerDrag =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
goog.asserts.assert(this.targetPointers.length >= 2);
|
goog.asserts.assert(this.targetPointers.length >= 2);
|
||||||
var rotationDelta = 0.0;
|
var rotationDelta = 0.0;
|
||||||
@@ -118,7 +118,7 @@ ol.interaction.Rotate.prototype.handlePointerDrag =
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.interaction.Rotate.prototype.handlePointerUp =
|
ol.interaction.PinchRotate.prototype.handlePointerUp =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
if (this.targetPointers.length < 2) {
|
if (this.targetPointers.length < 2) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
@@ -140,7 +140,7 @@ ol.interaction.Rotate.prototype.handlePointerUp =
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.interaction.Rotate.prototype.handlePointerDown =
|
ol.interaction.PinchRotate.prototype.handlePointerDown =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
if (this.targetPointers.length >= 2) {
|
if (this.targetPointers.length >= 2) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
1
src/ol/interaction/pinchzoominteraction.exports
Normal file
1
src/ol/interaction/pinchzoominteraction.exports
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@exportSymbol ol.interaction.PinchZoom
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
// FIXME works for View2D only
|
// FIXME works for View2D only
|
||||||
|
|
||||||
goog.provide('ol.interaction.Zoom');
|
goog.provide('ol.interaction.PinchZoom');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.style');
|
goog.require('goog.style');
|
||||||
@@ -15,10 +15,10 @@ goog.require('ol.interaction.Pointer');
|
|||||||
* on a touch screen.
|
* on a touch screen.
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Pointer}
|
* @extends {ol.interaction.Pointer}
|
||||||
* @param {olx.interaction.ZoomOptions=} opt_options Options.
|
* @param {olx.interaction.PinchZoomOptions=} opt_options Options.
|
||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
*/
|
*/
|
||||||
ol.interaction.Zoom = function(opt_options) {
|
ol.interaction.PinchZoom = function(opt_options) {
|
||||||
|
|
||||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||||
|
|
||||||
@@ -49,13 +49,13 @@ ol.interaction.Zoom = function(opt_options) {
|
|||||||
this.lastScaleDelta_ = 1;
|
this.lastScaleDelta_ = 1;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.interaction.Zoom, ol.interaction.Pointer);
|
goog.inherits(ol.interaction.PinchZoom, ol.interaction.Pointer);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.interaction.Zoom.prototype.handlePointerDrag =
|
ol.interaction.PinchZoom.prototype.handlePointerDrag =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
goog.asserts.assert(this.targetPointers.length >= 2);
|
goog.asserts.assert(this.targetPointers.length >= 2);
|
||||||
var scaleDelta = 1.0;
|
var scaleDelta = 1.0;
|
||||||
@@ -100,7 +100,7 @@ ol.interaction.Zoom.prototype.handlePointerDrag =
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.interaction.Zoom.prototype.handlePointerUp =
|
ol.interaction.PinchZoom.prototype.handlePointerUp =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
if (this.targetPointers.length < 2) {
|
if (this.targetPointers.length < 2) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
@@ -123,7 +123,7 @@ ol.interaction.Zoom.prototype.handlePointerUp =
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.interaction.Zoom.prototype.handlePointerDown =
|
ol.interaction.PinchZoom.prototype.handlePointerDown =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
if (this.targetPointers.length >= 2) {
|
if (this.targetPointers.length >= 2) {
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
@@ -1 +0,0 @@
|
|||||||
@exportSymbol ol.interaction.Rotate
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
@exportSymbol ol.interaction.Zoom
|
|
||||||
@@ -144,9 +144,9 @@ describe('ol.Map', function() {
|
|||||||
keyboard: false,
|
keyboard: false,
|
||||||
mouseWheelZoom: false,
|
mouseWheelZoom: false,
|
||||||
shiftDragZoom: false,
|
shiftDragZoom: false,
|
||||||
pan: false,
|
dragPan: false,
|
||||||
rotate: false,
|
pinchRotate: false,
|
||||||
zoom: false
|
pinchZoom: false
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user