Răsfoiți Sursa

bring back eventDrop/eventResize

Adam Shaw 7 ani în urmă
părinte
comite
001d6d5cca
2 a modificat fișierele cu 9 adăugiri și 5 ștergeri
  1. 3 2
      src/interactions/EventDragging.ts
  2. 6 3
      src/interactions/EventResizing.ts

+ 3 - 2
src/interactions/EventDragging.ts

@@ -239,9 +239,10 @@ export default class EventDragging { // TODO: rename to EventSelectingAndDraggin
             eventStore: mutatedRelatedEvents
           })
 
-          initialCalendar.publiclyTrigger('eventMutation', [
+          initialCalendar.publiclyTrigger('eventDrop', [
             {
-              mutation: this.validMutation, // TODO: public API?
+              el: ev.subjectEl,
+              delta: this.validMutation.startDelta!,
               prevEvent: eventApi,
               event: new EventApi( // the data AFTER the mutation
                 initialCalendar,

+ 6 - 3
src/interactions/EventResizing.ts

@@ -11,6 +11,7 @@ import { DateRange } from '../datelib/date-range'
 import EventApi from '../api/EventApi'
 import { EventRenderRange } from '../component/event-rendering'
 import { isEventStoreValid } from './constraint'
+import { createDuration } from '../datelib/duration'
 
 export default class EventDragging {
 
@@ -19,7 +20,7 @@ export default class EventDragging {
   hitDragging: HitDragging
 
   // internal state
-  draggingSeg: Seg | null = null
+  draggingSeg: Seg | null = null // TODO: rename to resizingSeg? subjectSeg?
   eventRange: EventRenderRange | null = null
   relatedEvents: EventStore | null = null
   validMutation: EventMutation | null = null
@@ -160,9 +161,11 @@ export default class EventDragging {
         eventStore: mutatedRelatedEvents
       })
 
-      calendar.publiclyTrigger('eventMutation', [
+      calendar.publiclyTrigger('eventResize', [
         {
-          mutation: this.validMutation, // TODO: public API?
+          el: this.draggingSeg.el,
+          startDelta: this.validMutation.startDelta || createDuration(0),
+          endDelta: this.validMutation.endDelta || createDuration(0),
           prevEvent: eventApi,
           event: new EventApi( // the data AFTER the mutation
             calendar,