Import events conditions explicitly

This commit is contained in:
Marc Jansen
2018-02-05 18:22:42 +01:00
parent 1c8e60487c
commit 6e764a20b3
16 changed files with 54 additions and 69 deletions
+6 -8
View File
@@ -4,7 +4,7 @@
import {inherits} from '../index.js';
import RotationConstraint from '../RotationConstraint.js';
import ViewHint from '../ViewHint.js';
import _ol_events_condition_ from '../events/condition.js';
import {altShiftKeysOnly, mouseOnly, mouseActionButton} from '../events/condition.js';
import {FALSE} from '../functions.js';
import Interaction from '../interaction/Interaction.js';
import PointerInteraction from '../interaction/Pointer.js';
@@ -36,8 +36,7 @@ const DragRotate = function(opt_options) {
* @private
* @type {ol.EventsConditionType}
*/
this.condition_ = options.condition ?
options.condition : _ol_events_condition_.altShiftKeysOnly;
this.condition_ = options.condition ? options.condition : altShiftKeysOnly;
/**
* @private
@@ -61,7 +60,7 @@ inherits(DragRotate, PointerInteraction);
* @private
*/
DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
if (!mouseOnly(mapBrowserEvent)) {
return;
}
@@ -91,7 +90,7 @@ DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
* @private
*/
DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
if (!mouseOnly(mapBrowserEvent)) {
return true;
}
@@ -112,12 +111,11 @@ DragRotate.handleUpEvent_ = function(mapBrowserEvent) {
* @private
*/
DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
if (!_ol_events_condition_.mouseOnly(mapBrowserEvent)) {
if (!mouseOnly(mapBrowserEvent)) {
return false;
}
if (_ol_events_condition_.mouseActionButton(mapBrowserEvent) &&
this.condition_(mapBrowserEvent)) {
if (mouseActionButton(mapBrowserEvent) && this.condition_(mapBrowserEvent)) {
const map = mapBrowserEvent.map;
map.getView().setHint(ViewHint.INTERACTING, 1);
this.lastAngle_ = undefined;