Просмотр исходного кода

better use of shouldIgnoreMouse

Adam Shaw 8 лет назад
Родитель
Сommit
b989db5193
1 измененных файлов с 5 добавлено и 8 удалено
  1. 5 8
      src/component/interactions/EventDragging.ts

+ 5 - 8
src/component/interactions/EventDragging.ts

@@ -4,7 +4,6 @@ import EventDefDateMutation from '../../models/event/EventDefDateMutation'
 import DragListener from '../../common/DragListener'
 import HitDragListener from '../../common/HitDragListener'
 import MouseFollower from '../../common/MouseFollower'
-import GlobalEmitter from '../../common/GlobalEmitter'
 import Interaction from './Interaction'
 
 
@@ -57,7 +56,7 @@ export default class EventDragging extends Interaction {
 
   handleMousedown(seg, ev) {
     if (
-      !GlobalEmitter.get().shouldIgnoreMouse() && // TODO: move to a deeper level
+      !this.component.shouldIgnoreMouse() &&
       this.component.canStartDrag(seg, ev)
     ) {
       this.buildDragListener(seg).startInteraction(ev, { distance: 5 })
@@ -72,12 +71,10 @@ export default class EventDragging extends Interaction {
         0 : this.getSelectionDelay()
     }
 
-    if (!GlobalEmitter.get().shouldIgnoreMouse()) { // TODO: move to a deeper level
-      if (component.canStartDrag(seg, ev)) {
-        this.buildDragListener(seg).startInteraction(ev, settings)
-      } else if (component.canStartSelection(seg, ev)) {
-        this.buildSelectListener(seg).startInteraction(ev, settings)
-      }
+    if (component.canStartDrag(seg, ev)) {
+      this.buildDragListener(seg).startInteraction(ev, settings)
+    } else if (component.canStartSelection(seg, ev)) {
+      this.buildSelectListener(seg).startInteraction(ev, settings)
     }
   }