Rename ol.control.DragZoom to ol.control.ShiftDragZoom
This commit is contained in:
@@ -8,10 +8,10 @@ goog.require('ol.MapProperty');
|
|||||||
goog.require('ol.Projection');
|
goog.require('ol.Projection');
|
||||||
goog.require('ol.control.DblClickZoom');
|
goog.require('ol.control.DblClickZoom');
|
||||||
goog.require('ol.control.DragPan');
|
goog.require('ol.control.DragPan');
|
||||||
goog.require('ol.control.DragZoom');
|
|
||||||
goog.require('ol.control.KeyboardPan');
|
goog.require('ol.control.KeyboardPan');
|
||||||
goog.require('ol.control.KeyboardZoom');
|
goog.require('ol.control.KeyboardZoom');
|
||||||
goog.require('ol.control.MouseWheelZoom');
|
goog.require('ol.control.MouseWheelZoom');
|
||||||
|
goog.require('ol.control.ShiftDragZoom');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.dom.Map');
|
goog.require('ol.dom.Map');
|
||||||
goog.require('ol.webgl');
|
goog.require('ol.webgl');
|
||||||
@@ -78,10 +78,10 @@ ol.createMap = function(target, opt_values, opt_rendererHints) {
|
|||||||
var controls = new ol.Array();
|
var controls = new ol.Array();
|
||||||
controls.push(new ol.control.DblClickZoom());
|
controls.push(new ol.control.DblClickZoom());
|
||||||
controls.push(new ol.control.DragPan());
|
controls.push(new ol.control.DragPan());
|
||||||
controls.push(new ol.control.DragZoom());
|
|
||||||
controls.push(new ol.control.KeyboardPan());
|
controls.push(new ol.control.KeyboardPan());
|
||||||
controls.push(new ol.control.KeyboardZoom());
|
controls.push(new ol.control.KeyboardZoom());
|
||||||
controls.push(new ol.control.MouseWheelZoom());
|
controls.push(new ol.control.MouseWheelZoom());
|
||||||
|
controls.push(new ol.control.ShiftDragZoom());
|
||||||
values[ol.MapProperty.CONTROLS] = controls;
|
values[ol.MapProperty.CONTROLS] = controls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// FIXME draw drag box
|
// FIXME draw drag box
|
||||||
|
|
||||||
goog.provide('ol.control.DragZoom');
|
goog.provide('ol.control.ShiftDragZoom');
|
||||||
|
|
||||||
goog.require('ol.Extent');
|
goog.require('ol.Extent');
|
||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
@@ -10,7 +10,14 @@ goog.require('ol.control.Drag');
|
|||||||
/**
|
/**
|
||||||
* @define {number} Hysterisis pixels.
|
* @define {number} Hysterisis pixels.
|
||||||
*/
|
*/
|
||||||
ol.DRAG_ZOOM_HYSTERESIS_PIXELS = 8;
|
ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS = 8;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const {number}
|
||||||
|
*/
|
||||||
|
ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS_SQUARED =
|
||||||
|
ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS * ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -18,18 +25,18 @@ ol.DRAG_ZOOM_HYSTERESIS_PIXELS = 8;
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.control.Drag}
|
* @extends {ol.control.Drag}
|
||||||
*/
|
*/
|
||||||
ol.control.DragZoom = function() {
|
ol.control.ShiftDragZoom = function() {
|
||||||
goog.base(this);
|
goog.base(this);
|
||||||
};
|
};
|
||||||
goog.inherits(ol.control.DragZoom, ol.control.Drag);
|
goog.inherits(ol.control.ShiftDragZoom, ol.control.Drag);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.control.DragZoom.prototype.handleDragEnd = function(mapBrowserEvent) {
|
ol.control.ShiftDragZoom.prototype.handleDragEnd = function(mapBrowserEvent) {
|
||||||
if (this.deltaX * this.deltaX + this.deltaY * this.deltaY >=
|
if (this.deltaX * this.deltaX + this.deltaY * this.deltaY >=
|
||||||
ol.DRAG_ZOOM_HYSTERESIS_PIXELS * ol.DRAG_ZOOM_HYSTERESIS_PIXELS) {
|
ol.SHIFT_DRAG_ZOOM_HYSTERESIS_PIXELS_SQUARED) {
|
||||||
var extent = ol.Extent.boundingExtent(
|
var extent = ol.Extent.boundingExtent(
|
||||||
this.startCoordinate,
|
this.startCoordinate,
|
||||||
mapBrowserEvent.getCoordinate());
|
mapBrowserEvent.getCoordinate());
|
||||||
@@ -41,7 +48,7 @@ ol.control.DragZoom.prototype.handleDragEnd = function(mapBrowserEvent) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.control.DragZoom.prototype.handleDragStart = function(mapBrowserEvent) {
|
ol.control.ShiftDragZoom.prototype.handleDragStart = function(mapBrowserEvent) {
|
||||||
var browserEvent = mapBrowserEvent.browserEvent;
|
var browserEvent = mapBrowserEvent.browserEvent;
|
||||||
if (browserEvent.shiftKey) {
|
if (browserEvent.shiftKey) {
|
||||||
browserEvent.preventDefault();
|
browserEvent.preventDefault();
|
||||||
Reference in New Issue
Block a user