Merge pull request #137 from twpayne/alt-shift-rotate
Use Alt+Shift to rotate by default, fixes #21
This commit is contained in:
@@ -45,7 +45,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Rotate:</td>
|
<td>Rotate:</td>
|
||||||
<td><code>Alt</code>+drag, <code>r</code> to reset</td>
|
<td><code>Alt+Shift</code>+drag, <code>r</code> to reset</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Brightness/contrast:</td>
|
<td>Brightness/contrast:</td>
|
||||||
|
|||||||
@@ -20,6 +20,18 @@ ol.interaction.condition.altKeyOnly = function(browserEvent) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
||||||
|
* @return {boolean} True if only the alt and shift keys are pressed.
|
||||||
|
*/
|
||||||
|
ol.interaction.condition.altShiftKeysOnly = function(browserEvent) {
|
||||||
|
return (
|
||||||
|
browserEvent.altKey &&
|
||||||
|
!browserEvent.platformModifierKey &&
|
||||||
|
browserEvent.shiftKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
||||||
* @return {boolean} True if only the no modifier keys are pressed.
|
* @return {boolean} True if only the no modifier keys are pressed.
|
||||||
|
|||||||
+2
-2
@@ -893,8 +893,8 @@ ol.Map.createInteractions_ = function(mapOptions) {
|
|||||||
var rotate = goog.isDef(mapOptions.rotate) ?
|
var rotate = goog.isDef(mapOptions.rotate) ?
|
||||||
mapOptions.rotate : true;
|
mapOptions.rotate : true;
|
||||||
if (rotate) {
|
if (rotate) {
|
||||||
interactions.push(
|
interactions.push(new ol.interaction.DragRotate(
|
||||||
new ol.interaction.DragRotate(ol.interaction.condition.altKeyOnly));
|
ol.interaction.condition.altShiftKeysOnly));
|
||||||
}
|
}
|
||||||
|
|
||||||
var doubleClickZoom = goog.isDef(mapOptions.doubleClickZoom) ?
|
var doubleClickZoom = goog.isDef(mapOptions.doubleClickZoom) ?
|
||||||
|
|||||||
Reference in New Issue
Block a user