Interaction in ol.interaction namespace.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
goog.provide('ol.interaction.DblClickZoom');
|
goog.provide('ol.interaction.DblClickZoom');
|
||||||
|
|
||||||
goog.require('goog.events.EventType');
|
goog.require('goog.events.EventType');
|
||||||
goog.require('ol.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
goog.require('ol.interaction.Constraints');
|
goog.require('ol.interaction.Constraints');
|
||||||
|
|
||||||
@@ -9,13 +9,13 @@ goog.require('ol.interaction.Constraints');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Interaction}
|
* @extends {ol.interaction.Interaction}
|
||||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||||
*/
|
*/
|
||||||
ol.interaction.DblClickZoom = function(constraints) {
|
ol.interaction.DblClickZoom = function(constraints) {
|
||||||
goog.base(this, constraints);
|
goog.base(this, constraints);
|
||||||
};
|
};
|
||||||
goog.inherits(ol.interaction.DblClickZoom, ol.Interaction);
|
goog.inherits(ol.interaction.DblClickZoom, ol.interaction.Interaction);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ goog.require('goog.asserts');
|
|||||||
goog.require('goog.events.EventType');
|
goog.require('goog.events.EventType');
|
||||||
goog.require('goog.functions');
|
goog.require('goog.functions');
|
||||||
goog.require('ol.Coordinate');
|
goog.require('ol.Coordinate');
|
||||||
goog.require('ol.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
goog.require('ol.interaction.Constraints');
|
goog.require('ol.interaction.Constraints');
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ goog.require('ol.interaction.Constraints');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Interaction}
|
* @extends {ol.interaction.Interaction}
|
||||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||||
*/
|
*/
|
||||||
ol.interaction.Drag = function(constraints) {
|
ol.interaction.Drag = function(constraints) {
|
||||||
@@ -57,7 +57,7 @@ ol.interaction.Drag = function(constraints) {
|
|||||||
this.startCoordinate = null;
|
this.startCoordinate = null;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.interaction.Drag, ol.Interaction);
|
goog.inherits(ol.interaction.Drag, ol.interaction.Interaction);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// FIXME factor out key precondition (shift et. al)
|
// FIXME factor out key precondition (shift et. al)
|
||||||
|
|
||||||
goog.provide('ol.Interaction');
|
goog.provide('ol.interaction.Interaction');
|
||||||
|
|
||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
goog.require('ol.interaction.Constraints');
|
goog.require('ol.interaction.Constraints');
|
||||||
@@ -11,7 +11,7 @@ goog.require('ol.interaction.Constraints');
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||||
*/
|
*/
|
||||||
ol.Interaction = function(constraints) {
|
ol.interaction.Interaction = function(constraints) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
@@ -26,7 +26,7 @@ ol.Interaction = function(constraints) {
|
|||||||
* @param {ol.Map} map Map.
|
* @param {ol.Map} map Map.
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
*/
|
*/
|
||||||
ol.Interaction.prototype.fitExtent = function(map, extent) {
|
ol.interaction.Interaction.prototype.fitExtent = function(map, extent) {
|
||||||
var resolution = map.getResolutionForExtent(extent);
|
var resolution = map.getResolutionForExtent(extent);
|
||||||
resolution = this.constraints.resolution(resolution, 0);
|
resolution = this.constraints.resolution(resolution, 0);
|
||||||
var center = extent.getCenter();
|
var center = extent.getCenter();
|
||||||
@@ -41,7 +41,7 @@ ol.Interaction.prototype.fitExtent = function(map, extent) {
|
|||||||
/**
|
/**
|
||||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
|
||||||
*/
|
*/
|
||||||
ol.Interaction.prototype.handleMapBrowserEvent = goog.abstractMethod;
|
ol.interaction.Interaction.prototype.handleMapBrowserEvent = goog.abstractMethod;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,7 +49,7 @@ ol.Interaction.prototype.handleMapBrowserEvent = goog.abstractMethod;
|
|||||||
* @param {ol.Coordinate} delta Delta.
|
* @param {ol.Coordinate} delta Delta.
|
||||||
* @param {ol.Coordinate=} opt_anchor Anchor.
|
* @param {ol.Coordinate=} opt_anchor Anchor.
|
||||||
*/
|
*/
|
||||||
ol.Interaction.prototype.pan = function(map, delta, opt_anchor) {
|
ol.interaction.Interaction.prototype.pan = function(map, delta, opt_anchor) {
|
||||||
var center = opt_anchor ? opt_anchor : map.getCenter();
|
var center = opt_anchor ? opt_anchor : map.getCenter();
|
||||||
var resolution = map.getResolution();
|
var resolution = map.getResolution();
|
||||||
center = this.constraints.center(center, resolution, delta);
|
center = this.constraints.center(center, resolution, delta);
|
||||||
@@ -63,7 +63,7 @@ ol.Interaction.prototype.pan = function(map, delta, opt_anchor) {
|
|||||||
* @param {number} delta Delta.
|
* @param {number} delta Delta.
|
||||||
* @param {ol.Coordinate=} opt_anchor Anchor.
|
* @param {ol.Coordinate=} opt_anchor Anchor.
|
||||||
*/
|
*/
|
||||||
ol.Interaction.prototype.rotate = function(map, rotation, delta, opt_anchor) {
|
ol.interaction.Interaction.prototype.rotate = function(map, rotation, delta, opt_anchor) {
|
||||||
// FIXME handle rotation about anchor
|
// FIXME handle rotation about anchor
|
||||||
rotation = this.constraints.rotation(rotation, delta);
|
rotation = this.constraints.rotation(rotation, delta);
|
||||||
map.setRotation(rotation);
|
map.setRotation(rotation);
|
||||||
@@ -74,7 +74,7 @@ ol.Interaction.prototype.rotate = function(map, rotation, delta, opt_anchor) {
|
|||||||
* @param {ol.Map} map Map.
|
* @param {ol.Map} map Map.
|
||||||
* @param {number|undefined} resolution Resolution.
|
* @param {number|undefined} resolution Resolution.
|
||||||
*/
|
*/
|
||||||
ol.Interaction.prototype.setResolution = function(map, resolution) {
|
ol.interaction.Interaction.prototype.setResolution = function(map, resolution) {
|
||||||
resolution = this.constraints.resolution(resolution, 0);
|
resolution = this.constraints.resolution(resolution, 0);
|
||||||
map.setResolution(resolution);
|
map.setResolution(resolution);
|
||||||
};
|
};
|
||||||
@@ -86,7 +86,7 @@ ol.Interaction.prototype.setResolution = function(map, resolution) {
|
|||||||
* @param {number} delta Delta.
|
* @param {number} delta Delta.
|
||||||
* @param {ol.Coordinate=} opt_anchor Anchor.
|
* @param {ol.Coordinate=} opt_anchor Anchor.
|
||||||
*/
|
*/
|
||||||
ol.Interaction.prototype.zoom = function(map, resolution, delta, opt_anchor) {
|
ol.interaction.Interaction.prototype.zoom = function(map, resolution, delta, opt_anchor) {
|
||||||
if (goog.isDefAndNotNull(opt_anchor)) {
|
if (goog.isDefAndNotNull(opt_anchor)) {
|
||||||
var anchor = opt_anchor;
|
var anchor = opt_anchor;
|
||||||
var mapCenter = /** @type {!ol.Coordinate} */ map.getCenter();
|
var mapCenter = /** @type {!ol.Coordinate} */ map.getCenter();
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
goog.provide('ol.interaction.Keyboard');
|
goog.provide('ol.interaction.Keyboard');
|
||||||
|
|
||||||
goog.require('ol.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Interaction}
|
* @extends {ol.interaction.Interaction}
|
||||||
*/
|
*/
|
||||||
ol.interaction.Keyboard = function() {
|
ol.interaction.Keyboard = function() {
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ ol.interaction.Keyboard = function() {
|
|||||||
this.charCodeCallbacks_ = {};
|
this.charCodeCallbacks_ = {};
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.interaction.Keyboard, ol.Interaction);
|
goog.inherits(ol.interaction.Keyboard, ol.interaction.Interaction);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ goog.provide('ol.interaction.KeyboardPan');
|
|||||||
|
|
||||||
goog.require('goog.events.KeyCodes');
|
goog.require('goog.events.KeyCodes');
|
||||||
goog.require('goog.events.KeyHandler.EventType');
|
goog.require('goog.events.KeyHandler.EventType');
|
||||||
goog.require('ol.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
goog.require('ol.interaction.Constraints');
|
goog.require('ol.interaction.Constraints');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Interaction}
|
* @extends {ol.interaction.Interaction}
|
||||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||||
* @param {number} pixelDelta Pixel delta.
|
* @param {number} pixelDelta Pixel delta.
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +24,7 @@ ol.interaction.KeyboardPan = function(constraints, pixelDelta) {
|
|||||||
this.pixelDelta_ = pixelDelta;
|
this.pixelDelta_ = pixelDelta;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.interaction.KeyboardPan, ol.Interaction);
|
goog.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,20 +2,20 @@ goog.provide('ol.interaction.KeyboardZoom');
|
|||||||
|
|
||||||
goog.require('goog.events.KeyCodes');
|
goog.require('goog.events.KeyCodes');
|
||||||
goog.require('goog.events.KeyHandler.EventType');
|
goog.require('goog.events.KeyHandler.EventType');
|
||||||
goog.require('ol.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
goog.require('ol.interaction.ResolutionConstraintType');
|
goog.require('ol.interaction.ResolutionConstraintType');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Interaction}
|
* @extends {ol.interaction.Interaction}
|
||||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||||
*/
|
*/
|
||||||
ol.interaction.KeyboardZoom = function(constraints) {
|
ol.interaction.KeyboardZoom = function(constraints) {
|
||||||
goog.base(this, constraints);
|
goog.base(this, constraints);
|
||||||
};
|
};
|
||||||
goog.inherits(ol.interaction.KeyboardZoom, ol.Interaction);
|
goog.inherits(ol.interaction.KeyboardZoom, ol.interaction.Interaction);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ goog.require('ol.interaction.Constraints');
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.Interaction}
|
* @extends {ol.interaction.Interaction}
|
||||||
* @param {ol.interaction.Constraints} constraints Constraints.
|
* @param {ol.interaction.Constraints} constraints Constraints.
|
||||||
*/
|
*/
|
||||||
ol.interaction.MouseWheelZoom = function(constraints) {
|
ol.interaction.MouseWheelZoom = function(constraints) {
|
||||||
goog.base(this, constraints);
|
goog.base(this, constraints);
|
||||||
};
|
};
|
||||||
goog.inherits(ol.interaction.MouseWheelZoom, ol.Interaction);
|
goog.inherits(ol.interaction.MouseWheelZoom, ol.interaction.Interaction);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+2
-2
@@ -31,7 +31,7 @@ goog.require('ol.Collection');
|
|||||||
goog.require('ol.Color');
|
goog.require('ol.Color');
|
||||||
goog.require('ol.Coordinate');
|
goog.require('ol.Coordinate');
|
||||||
goog.require('ol.Extent');
|
goog.require('ol.Extent');
|
||||||
goog.require('ol.Interaction');
|
goog.require('ol.interaction.Interaction');
|
||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
goog.require('ol.Object');
|
goog.require('ol.Object');
|
||||||
goog.require('ol.Pixel');
|
goog.require('ol.Pixel');
|
||||||
@@ -494,7 +494,7 @@ ol.Map.prototype.handleBrowserEvent = function(browserEvent, opt_type) {
|
|||||||
var type = opt_type || browserEvent.type;
|
var type = opt_type || browserEvent.type;
|
||||||
var mapBrowserEvent = new ol.MapBrowserEvent(type, this, browserEvent);
|
var mapBrowserEvent = new ol.MapBrowserEvent(type, this, browserEvent);
|
||||||
var interactions = this.getInteractions();
|
var interactions = this.getInteractions();
|
||||||
var interactionsArray = /** @type {Array.<ol.Interaction>} */
|
var interactionsArray = /** @type {Array.<ol.interaction.Interaction>} */
|
||||||
interactions.getArray();
|
interactions.getArray();
|
||||||
goog.array.every(interactionsArray, function(interaction) {
|
goog.array.every(interactionsArray, function(interaction) {
|
||||||
interaction.handleMapBrowserEvent(mapBrowserEvent);
|
interaction.handleMapBrowserEvent(mapBrowserEvent);
|
||||||
|
|||||||
Reference in New Issue
Block a user