Adam Shaw 7 年之前
父節點
當前提交
ccd52a2461

+ 4 - 4
src/common/GlobalContext.ts

@@ -41,7 +41,7 @@ export class GlobalContext { // TODO: rename file to something better
 
 
   bind() {
   bind() {
     let pointerUpListener = this.pointerUpListener = new PointerDragListener(document as any)
     let pointerUpListener = this.pointerUpListener = new PointerDragListener(document as any)
-    pointerUpListener.ignoreMove = true
+    pointerUpListener.shouldIgnoreMove = true
     pointerUpListener.emitter.on('pointerup', this.onPointerUp)
     pointerUpListener.emitter.on('pointerup', this.onPointerUp)
   }
   }
 
 
@@ -76,11 +76,11 @@ export class GlobalContext { // TODO: rename file to something better
 
 
   onPointerUp = (ev) => {
   onPointerUp = (ev) => {
     let { listenerHash } = this
     let { listenerHash } = this
-    let { isTouchScroll, downEl } = this.pointerUpListener
+    let { wasTouchScroll, downEl } = this.pointerUpListener
 
 
     for (let id in listenerHash) {
     for (let id in listenerHash) {
-      listenerHash[id].dateSelecting.onDocumentPointerUp(ev, isTouchScroll, downEl)
-      listenerHash[id].eventDragging.onDocumentPointerUp(ev, isTouchScroll, downEl)
+      listenerHash[id].dateSelecting.onDocumentPointerUp(ev, wasTouchScroll, downEl)
+      listenerHash[id].eventDragging.onDocumentPointerUp(ev, wasTouchScroll, downEl)
     }
     }
   }
   }
 
 

+ 1 - 1
src/dnd/HitDragListener.ts

@@ -26,7 +26,7 @@ export default class HitDragListener {
   emitter: EmitterMixin
   emitter: EmitterMixin
   initialHit: Hit
   initialHit: Hit
   movingHit: Hit
   movingHit: Hit
-  finalHit: Hit // won't ever be populated if ignoreMove
+  finalHit: Hit // won't ever be populated if shouldIgnoreMove
   coordAdjust: any
   coordAdjust: any
   dieIfNoInitial: boolean = true
   dieIfNoInitial: boolean = true
   isIgnoringMove: boolean = false
   isIgnoringMove: boolean = false

+ 3 - 3
src/dnd/IntentfulDragListener.ts

@@ -82,7 +82,7 @@ export class IntentfulDragListenerImpl implements IntentfulDragListener {
       this.emitter.trigger('pointerdown', ev)
       this.emitter.trigger('pointerdown', ev)
 
 
       // if moving is being ignored, don't fire any initial drag events
       // if moving is being ignored, don't fire any initial drag events
-      if (!this.pointerListener.ignoreMove) {
+      if (!this.pointerListener.shouldIgnoreMove) {
         // actions that could fire dragstart...
         // actions that could fire dragstart...
 
 
         this.startDelay(ev)
         this.startDelay(ev)
@@ -159,7 +159,7 @@ export class IntentfulDragListenerImpl implements IntentfulDragListener {
 
 
   tryStartDrag(ev: PointerDragEvent) {
   tryStartDrag(ev: PointerDragEvent) {
     if (this.isDelayEnded && this.isDistanceSurpassed) {
     if (this.isDelayEnded && this.isDistanceSurpassed) {
-      if (!this.pointerListener.isTouchScroll || this.touchScrollAllowed) {
+      if (!this.pointerListener.wasTouchScroll || this.touchScrollAllowed) {
         this.isDragging = true
         this.isDragging = true
         this.emitter.trigger('dragstart', ev)
         this.emitter.trigger('dragstart', ev)
 
 
@@ -202,7 +202,7 @@ export class IntentfulDragListenerImpl implements IntentfulDragListener {
   }
   }
 
 
   setIgnoreMove(bool: boolean) {
   setIgnoreMove(bool: boolean) {
-    this.pointerListener.ignoreMove = bool
+    this.pointerListener.shouldIgnoreMove = bool
   }
   }
 
 
 }
 }

+ 8 - 8
src/dnd/PointerDragListener.ts

@@ -28,12 +28,12 @@ export default class PointerDragListener {
   // options
   // options
   selector: string
   selector: string
   handleSelector: string
   handleSelector: string
-  ignoreMove: boolean = false // bad name?
+  shouldIgnoreMove: boolean = false
 
 
   // internal states
   // internal states
   isDragging: boolean = false
   isDragging: boolean = false
   isTouchDragging: boolean = false
   isTouchDragging: boolean = false
-  isTouchScroll: boolean = false
+  wasTouchScroll: boolean = false
 
 
   constructor(containerEl: HTMLElement) {
   constructor(containerEl: HTMLElement) {
     this.containerEl = containerEl
     this.containerEl = containerEl
@@ -60,7 +60,7 @@ export default class PointerDragListener {
       this.subjectEl = subjectEl
       this.subjectEl = subjectEl
       this.downEl = downEl
       this.downEl = downEl
       this.isDragging = true // do this first so cancelTouchScroll will work
       this.isDragging = true // do this first so cancelTouchScroll will work
-      this.isTouchScroll = false
+      this.wasTouchScroll = false
       return true
       return true
     }
     }
 
 
@@ -72,7 +72,7 @@ export default class PointerDragListener {
     this.isDragging = false
     this.isDragging = false
     this.subjectEl = null
     this.subjectEl = null
     this.downEl = null
     this.downEl = null
-    // keep isTouchScroll around for later access
+    // keep wasTouchScroll around for later access
   }
   }
 
 
   queryValidSubjectEl(ev: UIEvent): HTMLElement {
   queryValidSubjectEl(ev: UIEvent): HTMLElement {
@@ -95,7 +95,7 @@ export default class PointerDragListener {
     ) {
     ) {
       this.emitter.trigger('pointerdown', createEventFromMouse(ev, this.subjectEl))
       this.emitter.trigger('pointerdown', createEventFromMouse(ev, this.subjectEl))
 
 
-      if (!this.ignoreMove) {
+      if (!this.shouldIgnoreMove) {
         document.addEventListener('mousemove', this.handleMouseMove)
         document.addEventListener('mousemove', this.handleMouseMove)
       }
       }
 
 
@@ -134,7 +134,7 @@ export default class PointerDragListener {
       // https://stackoverflow.com/a/45760014
       // https://stackoverflow.com/a/45760014
       let target = ev.target
       let target = ev.target
 
 
-      if (!this.ignoreMove) {
+      if (!this.shouldIgnoreMove) {
         target.addEventListener('touchmove', this.handleTouchMove)
         target.addEventListener('touchmove', this.handleTouchMove)
       }
       }
 
 
@@ -175,10 +175,10 @@ export default class PointerDragListener {
   }
   }
 
 
   handleTouchScroll = () => {
   handleTouchScroll = () => {
-    this.isTouchScroll = true
+    this.wasTouchScroll = true
   }
   }
 
 
-  // can be called by user of this class, while dragging
+  // can be called by user of this class, to cancel touch-based scrolling for the current drag
   cancelTouchScroll() {
   cancelTouchScroll() {
     if (this.isDragging) {
     if (this.isDragging) {
       isWindowTouchMoveCancelled = true
       isWindowTouchMoveCancelled = true

+ 3 - 3
src/interactions/DateClicking.ts

@@ -22,7 +22,7 @@ export default class DateClicking {
     let { pointerListener } = this.dragListener
     let { pointerListener } = this.dragListener
 
 
     // do this in pointerdown (not dragend) because DOM might be mutated by the time dragend is fired
     // do this in pointerdown (not dragend) because DOM might be mutated by the time dragend is fired
-    pointerListener.ignoreMove = !component.isValidDateInteraction(pointerListener.downEl)
+    pointerListener.shouldIgnoreMove = !component.isValidDateInteraction(pointerListener.downEl)
   }
   }
 
 
   onDragEnd = (ev: PointerDragEvent) => {
   onDragEnd = (ev: PointerDragEvent) => {
@@ -30,8 +30,8 @@ export default class DateClicking {
     let { pointerListener } = this.dragListener
     let { pointerListener } = this.dragListener
 
 
     if (
     if (
-      !pointerListener.ignoreMove && // not ignored in onPointerDown
-      !pointerListener.isTouchScroll
+      !pointerListener.shouldIgnoreMove && // not ignored in onPointerDown
+      !pointerListener.wasTouchScroll
     ) {
     ) {
       let { initialHit, finalHit } = this.hitListener
       let { initialHit, finalHit } = this.hitListener
 
 

+ 3 - 3
src/interactions/DateSelecting.ts

@@ -40,7 +40,7 @@ export default class DateSelecting {
       component.isValidDateInteraction(ev.origEvent.target as HTMLElement)
       component.isValidDateInteraction(ev.origEvent.target as HTMLElement)
 
 
     // don't bother to watch expensive moves if component won't do selection
     // don't bother to watch expensive moves if component won't do selection
-    dragListener.pointerListener.ignoreMove = !isValid
+    dragListener.pointerListener.shouldIgnoreMove = !isValid
 
 
     dragListener.delay = (isValid && ev.isTouch) ?
     dragListener.delay = (isValid && ev.isTouch) ?
       getComponentDelay(component) :
       getComponentDelay(component) :
@@ -84,7 +84,7 @@ export default class DateSelecting {
     })
     })
   }
   }
 
 
-  onDocumentPointerUp = (ev: PointerDragEvent, isTouchScroll: boolean, downEl: HTMLElement) => {
+  onDocumentPointerUp = (ev: PointerDragEvent, wasTouchScroll: boolean, downEl: HTMLElement) => {
     let { component } = this
     let { component } = this
 
 
     if (this.dragSelection) {
     if (this.dragSelection) {
@@ -98,7 +98,7 @@ export default class DateSelecting {
 
 
       this.dragSelection = null
       this.dragSelection = null
 
 
-    } else if (!isTouchScroll && component.selection) {
+    } else if (!wasTouchScroll && component.selection) {
       // if there was a pointerup that did not result in a selection and was
       // if there was a pointerup that did not result in a selection and was
       // not merely a touchmove-scroll, then possibly unselect the current selection.
       // not merely a touchmove-scroll, then possibly unselect the current selection.
       // won't do anything if already unselected (OR, leverage selectedCalendar?)
       // won't do anything if already unselected (OR, leverage selectedCalendar?)

+ 3 - 3
src/interactions/EventDragging.ts

@@ -47,7 +47,7 @@ export default class EventDragging {
 
 
     let origTarget = ev.origEvent.target as HTMLElement
     let origTarget = ev.origEvent.target as HTMLElement
 
 
-    dragListener.pointerListener.ignoreMove =
+    dragListener.pointerListener.shouldIgnoreMove =
       !this.component.isValidSegInteraction(origTarget) ||
       !this.component.isValidSegInteraction(origTarget) ||
       elementClosest(origTarget, '.fc-resizer')
       elementClosest(origTarget, '.fc-resizer')
   }
   }
@@ -152,10 +152,10 @@ export default class EventDragging {
   TODO: rethinking ordering of onDocumentPointerUp firing,
   TODO: rethinking ordering of onDocumentPointerUp firing,
   we want something that will always fire LAST, in case drag never activated
   we want something that will always fire LAST, in case drag never activated
   */
   */
-  onDocumentPointerUp = (ev, isTouchScroll) => {
+  onDocumentPointerUp = (ev, wasTouchScroll) => {
     if (
     if (
       !this.mutation &&
       !this.mutation &&
-      !isTouchScroll &&
+      !wasTouchScroll &&
       this.globalContext.eventSelectedComponent === this.component
       this.globalContext.eventSelectedComponent === this.component
     ) {
     ) {
       this.component.getCalendar().dispatch({
       this.component.getCalendar().dispatch({

+ 1 - 1
src/interactions/EventResizing.ts

@@ -38,7 +38,7 @@ export default class EventDragging {
     let eventInstanceId = seg.eventRange.eventInstance.instanceId
     let eventInstanceId = seg.eventRange.eventInstance.instanceId
 
 
     // if touch, need to be working with a selected event
     // if touch, need to be working with a selected event
-    this.dragListener.pointerListener.ignoreMove =
+    this.dragListener.pointerListener.shouldIgnoreMove =
       !this.component.isValidSegInteraction(ev.origEvent.target) ||
       !this.component.isValidSegInteraction(ev.origEvent.target) ||
       (ev.isTouch && this.component.selectedEventInstanceId !== eventInstanceId)
       (ev.isTouch && this.component.selectedEventInstanceId !== eventInstanceId)
   }
   }