Use Alt key instead of Shift for rotation

This commit is contained in:
Tom Payne
2012-08-07 17:20:42 +02:00
parent f76b34bc38
commit eab38e9042
3 changed files with 11 additions and 11 deletions

View File

@@ -34,11 +34,11 @@
</tr>
<tr>
<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>
<td>Rotate:</td>
<td>shift+drag (WebGL only)</td>
<td><code>Alt</code>+drag (WebGL only)</td>
</tr>
<tr>
<td>Brightness/contrast:</td>

View File

@@ -6,6 +6,7 @@ goog.require('ol.Collection');
goog.require('ol.Map');
goog.require('ol.MapProperty');
goog.require('ol.Projection');
goog.require('ol.control.AltDragRotate');
goog.require('ol.control.CenterConstraint');
goog.require('ol.control.Constraints');
goog.require('ol.control.DblClickZoom');
@@ -15,7 +16,6 @@ goog.require('ol.control.KeyboardZoom');
goog.require('ol.control.MouseWheelZoom');
goog.require('ol.control.ResolutionConstraint');
goog.require('ol.control.RotationConstraint');
goog.require('ol.control.ShiftDragRotate');
goog.require('ol.control.ShiftDragZoom');
goog.require('ol.dom');
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)) {
var controls = new ol.Collection();
controls.push(new ol.control.AltDragRotate(constraints));
controls.push(new ol.control.DblClickZoom(constraints));
controls.push(new ol.control.DragPan(constraints));
controls.push(new ol.control.KeyboardPan(constraints, 16));
controls.push(new ol.control.KeyboardZoom(constraints));
controls.push(new ol.control.MouseWheelZoom(constraints));
controls.push(new ol.control.ShiftDragRotate(constraints));
controls.push(new ol.control.ShiftDragZoom(constraints));
values[ol.MapProperty.CONTROLS] = controls;
}

View File

@@ -1,4 +1,4 @@
goog.provide('ol.control.ShiftDragRotate');
goog.provide('ol.control.AltDragRotate');
goog.require('ol.MapBrowserEvent');
goog.require('ol.control.Drag');
@@ -10,23 +10,23 @@ goog.require('ol.control.Drag');
* @extends {ol.control.Drag}
* @param {ol.control.Constraints} constraints Constraints.
*/
ol.control.ShiftDragRotate = function(constraints) {
ol.control.AltDragRotate = function(constraints) {
goog.base(this, constraints);
};
goog.inherits(ol.control.ShiftDragRotate, ol.control.Drag);
goog.inherits(ol.control.AltDragRotate, ol.control.Drag);
/**
* @private
* @type {number}
*/
ol.control.ShiftDragRotate.prototype.startRotation_;
ol.control.AltDragRotate.prototype.startRotation_;
/**
* @inheritDoc
*/
ol.control.ShiftDragRotate.prototype.handleDrag = function(mapBrowserEvent) {
ol.control.AltDragRotate.prototype.handleDrag = function(mapBrowserEvent) {
var browserEvent = mapBrowserEvent.browserEvent;
var map = mapBrowserEvent.map;
var size = map.getSize();
@@ -40,11 +40,11 @@ ol.control.ShiftDragRotate.prototype.handleDrag = function(mapBrowserEvent) {
/**
* @inheritDoc
*/
ol.control.ShiftDragRotate.prototype.handleDragStart =
ol.control.AltDragRotate.prototype.handleDragStart =
function(mapBrowserEvent) {
var browserEvent = mapBrowserEvent.browserEvent;
var map = mapBrowserEvent.map;
if (map.canRotate() && browserEvent.shiftKey) {
if (map.canRotate() && browserEvent.altKey) {
var size = map.getSize();
var theta = Math.atan2(
size.height / 2 - browserEvent.offsetY,