1 line
156 KiB
Plaintext
1 line
156 KiB
Plaintext
|
{"version":3,"file":"main.js","sources":["src/dnd/PointerDragging.ts","src/dnd/ElementMirror.ts","src/ScrollGeomCache.ts","src/ElementScrollGeomCache.ts","src/WindowScrollGeomCache.ts","src/dnd/AutoScroller.ts","src/dnd/FeaturefulElementDragging.ts","src/OffsetTracker.ts","src/interactions/HitDragging.ts","src/utils.ts","src/interactions/DateClicking.ts","src/interactions/DateSelecting.ts","src/interactions/EventDragging.ts","src/interactions/EventResizing.ts","src/interactions/UnselectAuto.ts","src/options.ts","src/interactions-external/ExternalElementDragging.ts","src/interactions-external/ExternalDraggable.ts","src/interactions-external/InferredElementDragging.ts","src/interactions-external/ThirdPartyDraggable.ts","src/main.ts"],"sourcesContent":["import { config, elementClosest, Emitter, PointerDragEvent } from '@fullcalendar/common'\n\nconfig.touchMouseIgnoreWait = 500\n\nlet ignoreMouseDepth = 0\nlet listenerCnt = 0\nlet isWindowTouchMoveCancelled = false\n\n/*\nUses a \"pointer\" abstraction, which monitors UI events for both mouse and touch.\nTracks when the pointer \"drags\" on a certain element, meaning down+move+up.\n\nAlso, tracks if there was touch-scrolling.\nAlso, can prevent touch-scrolling from happening.\nAlso, can fire pointermove events when scrolling happens underneath, even when no real pointer movement.\n\nemits:\n- pointerdown\n- pointermove\n- pointerup\n*/\nexport class PointerDragging {\n containerEl: EventTarget\n subjectEl: HTMLElement | null = null\n emitter: Emitter<any>\n\n // options that can be directly assigned by caller\n selector: string = '' // will cause subjectEl in all emitted events to be this element\n handleSelector: string = ''\n shouldIgnoreMove: boolean = false\n shouldWatchScroll: boolean = true // for simulating pointermove on scroll\n\n // internal states\n isDragging: boolean = false\n isTouchDragging: boolean = false\n wasTouchScroll: boolean = false\n origPageX: number\n origPageY: number\n prevPageX: number\n prevPageY: number\n prevScrollX: number // at time of last pointer pageX/pageY capture\n prevScrollY: number // \"\n\n constructor(containerEl: EventTarget) {\n this.containerEl = containerEl\n this.emitter = new Emitter()\n containerEl.addEventListener('mousedown', this.handleMouseDown as EventListener)\n containerEl.addEventListener('touchstart', this.handleTouchStart as EventListener, { passive: true })\n listenerCreated()\n }\n\n destroy() {\n this.containerEl.removeEventListener('mousedown', this.handleMouseDown as EventListener)\n this.containerEl.removeEventListener('touchstart', this.handleTouchStart as EventListener, { passive: true } as AddEventListenerOptions)\n listenerDestroyed()\n }\n\n tryStart(ev: UIEvent): boolean {\n let subjectEl = this.querySubjectEl(ev)\n let downEl = ev.target as HTMLElement\n\n if (\n subjectEl &&\n (!this.handleSelector || elementClosest(downEl, this.handleSelector))\n ) {\n this.subjectEl = subjectEl\n this.isDragging = true // do this first so cancelTouchScroll will work\n this.wasTouchScroll = false\n\n return true\n }\n\n return false\n }\n\n cleanup() {\n isWindowTouchMoveCancelled = false\n this.isDragging = false\n this.subjectEl = null\n // keep wasTouchScroll around for later access\n this.destroyScrollWatch()\n }\n\n querySubjectEl(ev: UIEvent): HTMLElement {\n if (this.selector) {\n return elementClosest(ev.target as HTMLElement, this.selector)\n }\n return this.containerEl as HTMLElement\n }\n\n // Mouse\n // ----------------------------------------------------------------------------------------------------\n\n handleMouseDown = (ev: MouseEvent) => {\n if (\n !this.shouldIgnoreMouse() &&\n isPrimaryMouseButton(ev) &&\n this.tryStart(ev)\n ) {\n let pev = this.createEventFromMouse(ev, true)\n this.emitter.trigger('pointerdown', pev)\n this.initScrollWatch(pev)\n\n if (!this.shouldIgnoreMove) {\n document.addEventListener('mousemove',
|