Use Alt key instead of Shift for rotation
This commit is contained in:
@@ -34,11 +34,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Zoom:</td>
|
<td>Zoom:</td>
|
||||||
<td>double-click, shift+double-click, mouse wheel, <code>+</code>/<code>-</code> keys; shift+drag (DOM only)</td>
|
<td>double-click, <code>Shift</code>+double-click, mouse wheel, <code>+</code>/<code>-</code> keys; <code>Shift</code>+drag</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Rotate:</td>
|
<td>Rotate:</td>
|
||||||
<td>shift+drag (WebGL only)</td>
|
<td><code>Alt</code>+drag (WebGL only)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Brightness/contrast:</td>
|
<td>Brightness/contrast:</td>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ goog.require('ol.Collection');
|
|||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.MapProperty');
|
goog.require('ol.MapProperty');
|
||||||
goog.require('ol.Projection');
|
goog.require('ol.Projection');
|
||||||
|
goog.require('ol.control.AltDragRotate');
|
||||||
goog.require('ol.control.CenterConstraint');
|
goog.require('ol.control.CenterConstraint');
|
||||||
goog.require('ol.control.Constraints');
|
goog.require('ol.control.Constraints');
|
||||||
goog.require('ol.control.DblClickZoom');
|
goog.require('ol.control.DblClickZoom');
|
||||||
@@ -15,7 +16,6 @@ goog.require('ol.control.KeyboardZoom');
|
|||||||
goog.require('ol.control.MouseWheelZoom');
|
goog.require('ol.control.MouseWheelZoom');
|
||||||
goog.require('ol.control.ResolutionConstraint');
|
goog.require('ol.control.ResolutionConstraint');
|
||||||
goog.require('ol.control.RotationConstraint');
|
goog.require('ol.control.RotationConstraint');
|
||||||
goog.require('ol.control.ShiftDragRotate');
|
|
||||||
goog.require('ol.control.ShiftDragZoom');
|
goog.require('ol.control.ShiftDragZoom');
|
||||||
goog.require('ol.dom');
|
goog.require('ol.dom');
|
||||||
goog.require('ol.dom.Map');
|
goog.require('ol.dom.Map');
|
||||||
@@ -89,12 +89,12 @@ ol.createMap = function(target, opt_values, opt_rendererHints) {
|
|||||||
|
|
||||||
if (!goog.object.containsKey(values, ol.MapProperty.CONTROLS)) {
|
if (!goog.object.containsKey(values, ol.MapProperty.CONTROLS)) {
|
||||||
var controls = new ol.Collection();
|
var controls = new ol.Collection();
|
||||||
|
controls.push(new ol.control.AltDragRotate(constraints));
|
||||||
controls.push(new ol.control.DblClickZoom(constraints));
|
controls.push(new ol.control.DblClickZoom(constraints));
|
||||||
controls.push(new ol.control.DragPan(constraints));
|
controls.push(new ol.control.DragPan(constraints));
|
||||||
controls.push(new ol.control.KeyboardPan(constraints, 16));
|
controls.push(new ol.control.KeyboardPan(constraints, 16));
|
||||||
controls.push(new ol.control.KeyboardZoom(constraints));
|
controls.push(new ol.control.KeyboardZoom(constraints));
|
||||||
controls.push(new ol.control.MouseWheelZoom(constraints));
|
controls.push(new ol.control.MouseWheelZoom(constraints));
|
||||||
controls.push(new ol.control.ShiftDragRotate(constraints));
|
|
||||||
controls.push(new ol.control.ShiftDragZoom(constraints));
|
controls.push(new ol.control.ShiftDragZoom(constraints));
|
||||||
values[ol.MapProperty.CONTROLS] = controls;
|
values[ol.MapProperty.CONTROLS] = controls;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
goog.provide('ol.control.ShiftDragRotate');
|
goog.provide('ol.control.AltDragRotate');
|
||||||
|
|
||||||
goog.require('ol.MapBrowserEvent');
|
goog.require('ol.MapBrowserEvent');
|
||||||
goog.require('ol.control.Drag');
|
goog.require('ol.control.Drag');
|
||||||
@@ -10,23 +10,23 @@ goog.require('ol.control.Drag');
|
|||||||
* @extends {ol.control.Drag}
|
* @extends {ol.control.Drag}
|
||||||
* @param {ol.control.Constraints} constraints Constraints.
|
* @param {ol.control.Constraints} constraints Constraints.
|
||||||
*/
|
*/
|
||||||
ol.control.ShiftDragRotate = function(constraints) {
|
ol.control.AltDragRotate = function(constraints) {
|
||||||
goog.base(this, constraints);
|
goog.base(this, constraints);
|
||||||
};
|
};
|
||||||
goog.inherits(ol.control.ShiftDragRotate, ol.control.Drag);
|
goog.inherits(ol.control.AltDragRotate, ol.control.Drag);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
ol.control.ShiftDragRotate.prototype.startRotation_;
|
ol.control.AltDragRotate.prototype.startRotation_;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.control.ShiftDragRotate.prototype.handleDrag = function(mapBrowserEvent) {
|
ol.control.AltDragRotate.prototype.handleDrag = function(mapBrowserEvent) {
|
||||||
var browserEvent = mapBrowserEvent.browserEvent;
|
var browserEvent = mapBrowserEvent.browserEvent;
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
var size = map.getSize();
|
var size = map.getSize();
|
||||||
@@ -40,11 +40,11 @@ ol.control.ShiftDragRotate.prototype.handleDrag = function(mapBrowserEvent) {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
ol.control.ShiftDragRotate.prototype.handleDragStart =
|
ol.control.AltDragRotate.prototype.handleDragStart =
|
||||||
function(mapBrowserEvent) {
|
function(mapBrowserEvent) {
|
||||||
var browserEvent = mapBrowserEvent.browserEvent;
|
var browserEvent = mapBrowserEvent.browserEvent;
|
||||||
var map = mapBrowserEvent.map;
|
var map = mapBrowserEvent.map;
|
||||||
if (map.canRotate() && browserEvent.shiftKey) {
|
if (map.canRotate() && browserEvent.altKey) {
|
||||||
var size = map.getSize();
|
var size = map.getSize();
|
||||||
var theta = Math.atan2(
|
var theta = Math.atan2(
|
||||||
size.height / 2 - browserEvent.offsetY,
|
size.height / 2 - browserEvent.offsetY,
|
||||||
Reference in New Issue
Block a user