Defines in a namespace that can be required
For consistency, all defines are in the ol namespace. If they are to be moved to another namespace, they need to be requireable.
This commit is contained in:
@@ -5,6 +5,7 @@ goog.provide('ol.interaction.DragRotateAndZoom');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.functions');
|
||||
goog.require('goog.math.Vec2');
|
||||
goog.require('ol');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.events.ConditionType');
|
||||
goog.require('ol.events.condition');
|
||||
@@ -12,12 +13,6 @@ goog.require('ol.interaction.Interaction');
|
||||
goog.require('ol.interaction.Pointer');
|
||||
|
||||
|
||||
/**
|
||||
* @define {number} Animation duration.
|
||||
*/
|
||||
ol.interaction.DRAGROTATEANDZOOM_ANIMATION_DURATION = 400;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows the user to zoom and rotate the map by clicking and dragging
|
||||
@@ -125,7 +120,7 @@ ol.interaction.DragRotateAndZoom.prototype.handlePointerUp =
|
||||
var direction = this.lastScaleDelta_ - 1;
|
||||
ol.interaction.Interaction.rotate(map, view2D, view2DState.rotation);
|
||||
ol.interaction.Interaction.zoom(map, view2D, view2DState.resolution,
|
||||
undefined, ol.interaction.DRAGROTATEANDZOOM_ANIMATION_DURATION,
|
||||
undefined, ol.DRAGROTATEANDZOOM_ANIMATION_DURATION,
|
||||
direction);
|
||||
this.lastScaleDelta_ = 0;
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
goog.provide('ol.interaction.DragRotate');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.events.ConditionType');
|
||||
goog.require('ol.events.condition');
|
||||
@@ -8,12 +9,6 @@ goog.require('ol.interaction.Interaction');
|
||||
goog.require('ol.interaction.Pointer');
|
||||
|
||||
|
||||
/**
|
||||
* @define {number} Animation duration.
|
||||
*/
|
||||
ol.interaction.DRAGROTATE_ANIMATION_DURATION = 250;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows the user to rotate the map by clicking and dragging on the map,
|
||||
@@ -93,7 +88,7 @@ ol.interaction.DragRotate.prototype.handlePointerUp =
|
||||
var view2D = view.getView2D();
|
||||
var view2DState = view2D.getView2DState();
|
||||
ol.interaction.Interaction.rotate(map, view2D, view2DState.rotation,
|
||||
undefined, ol.interaction.DRAGROTATE_ANIMATION_DURATION);
|
||||
undefined, ol.DRAGROTATE_ANIMATION_DURATION);
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
goog.provide('ol.interaction.DragZoom');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol');
|
||||
goog.require('ol.events.condition');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.interaction.DragBox');
|
||||
@@ -9,12 +10,6 @@ goog.require('ol.style.Stroke');
|
||||
goog.require('ol.style.Style');
|
||||
|
||||
|
||||
/**
|
||||
* @define {number} Animation duration.
|
||||
*/
|
||||
ol.interaction.DRAGZOOM_ANIMATION_DURATION = 200;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows the user to zoom the map by clicking and dragging on the map,
|
||||
@@ -62,5 +57,5 @@ ol.interaction.DragZoom.prototype.onBoxEnd = function() {
|
||||
var center = ol.extent.getCenter(extent);
|
||||
ol.interaction.Interaction.zoom(map, view,
|
||||
view.getResolutionForExtent(extent, map.getSize()),
|
||||
center, ol.interaction.DRAGZOOM_ANIMATION_DURATION);
|
||||
center, ol.DRAGZOOM_ANIMATION_DURATION);
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ goog.require('goog.asserts');
|
||||
goog.require('goog.events.KeyCodes');
|
||||
goog.require('goog.events.KeyHandler.EventType');
|
||||
goog.require('goog.functions');
|
||||
goog.require('ol');
|
||||
goog.require('ol.View2D');
|
||||
goog.require('ol.coordinate');
|
||||
goog.require('ol.events.ConditionType');
|
||||
@@ -13,12 +14,6 @@ goog.require('ol.events.condition');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
|
||||
|
||||
/**
|
||||
* @define {number} Pan duration.
|
||||
*/
|
||||
ol.interaction.KEYBOARD_PAN_DURATION = 100;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows the user to pan the map using keyboard arrows.
|
||||
@@ -93,7 +88,7 @@ ol.interaction.KeyboardPan.prototype.handleMapBrowserEvent =
|
||||
var delta = [deltaX, deltaY];
|
||||
ol.coordinate.rotate(delta, view2DState.rotation);
|
||||
ol.interaction.Interaction.pan(
|
||||
map, view, delta, ol.interaction.KEYBOARD_PAN_DURATION);
|
||||
map, view, delta, ol.KEYBOARD_PAN_DURATION);
|
||||
mapBrowserEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
}
|
||||
|
||||
@@ -6,22 +6,11 @@ goog.require('goog.asserts');
|
||||
goog.require('goog.events.MouseWheelEvent');
|
||||
goog.require('goog.events.MouseWheelHandler.EventType');
|
||||
goog.require('goog.math');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
|
||||
|
||||
/**
|
||||
* @define {number} Maximum delta.
|
||||
*/
|
||||
ol.interaction.MOUSEWHEELZOOM_MAXDELTA = 1;
|
||||
|
||||
|
||||
/**
|
||||
* @define {number} Timeout duration.
|
||||
*/
|
||||
ol.interaction.MOUSEWHEELZOOM_TIMEOUT_DURATION = 80;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows the user to zoom the map by scrolling the mouse wheel.
|
||||
@@ -89,7 +78,7 @@ ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
||||
this.startTime_ = goog.now();
|
||||
}
|
||||
|
||||
var duration = ol.interaction.MOUSEWHEELZOOM_TIMEOUT_DURATION;
|
||||
var duration = ol.MOUSEWHEELZOOM_TIMEOUT_DURATION;
|
||||
var timeLeft = Math.max(duration - (goog.now() - this.startTime_), 0);
|
||||
|
||||
goog.global.clearTimeout(this.timeoutId_);
|
||||
@@ -108,7 +97,7 @@ ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent =
|
||||
* @param {ol.Map} map Map.
|
||||
*/
|
||||
ol.interaction.MouseWheelZoom.prototype.doZoom_ = function(map) {
|
||||
var maxDelta = ol.interaction.MOUSEWHEELZOOM_MAXDELTA;
|
||||
var maxDelta = ol.MOUSEWHEELZOOM_MAXDELTA;
|
||||
var delta = goog.math.clamp(this.delta_, -maxDelta, maxDelta);
|
||||
|
||||
// FIXME works for View2D only
|
||||
|
||||
@@ -4,18 +4,13 @@ goog.provide('ol.interaction.PinchRotate');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('goog.style');
|
||||
goog.require('ol');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.ViewHint');
|
||||
goog.require('ol.interaction.Interaction');
|
||||
goog.require('ol.interaction.Pointer');
|
||||
|
||||
|
||||
/**
|
||||
* @define {number} Animation duration.
|
||||
*/
|
||||
ol.interaction.ROTATE_ANIMATION_DURATION = 250;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Allows the user to rotate the map by twisting with two fingers
|
||||
@@ -131,7 +126,7 @@ ol.interaction.PinchRotate.prototype.handlePointerUp =
|
||||
var view2DState = view2D.getView2DState();
|
||||
ol.interaction.Interaction.rotate(
|
||||
map, view2D, view2DState.rotation, this.anchor_,
|
||||
ol.interaction.ROTATE_ANIMATION_DURATION);
|
||||
ol.ROTATE_ANIMATION_DURATION);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user