Sfoglia il codice sorgente

eventDragMutationMassager gets calendar

Adam Shaw 7 anni fa
parent
commit
26e2a2766d
1 ha cambiato i file con 9 aggiunte e 4 eliminazioni
  1. 9 4
      src/interactions/EventDragging.ts

+ 9 - 4
src/interactions/EventDragging.ts

@@ -139,7 +139,12 @@ export default class EventDragging { // TODO: rename to EventSelectingAndDraggin
         initialCalendar === receivingCalendar ||
         receivingComponent.opt('editable') && receivingComponent.opt('droppable')
       ) {
-        mutation = computeEventMutation(initialHit, hit, receivingCalendar.pluginSystem.hooks.eventDragMutationMassagers)
+        mutation = computeEventMutation(
+          initialHit,
+          hit,
+          receivingCalendar.pluginSystem.hooks.eventDragMutationMassagers,
+          receivingCalendar
+        )
 
         if (mutation) {
           mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, mutation, receivingCalendar)
@@ -356,9 +361,9 @@ export default class EventDragging { // TODO: rename to EventSelectingAndDraggin
 }
 
 
-export type eventDragMutationMassager = (mutation: EventMutation, hit0: Hit, hit1: Hit) => void
+export type eventDragMutationMassager = (mutation: EventMutation, hit0: Hit, hit1: Hit, calendar: Calendar) => void
 
-function computeEventMutation(hit0: Hit, hit1: Hit, massagers: eventDragMutationMassager[]): EventMutation {
+function computeEventMutation(hit0: Hit, hit1: Hit, massagers: eventDragMutationMassager[], calendar: Calendar): EventMutation {
   let dateSpan0 = hit0.dateSpan
   let dateSpan1 = hit1.dateSpan
   let date0 = dateSpan0.range.start
@@ -393,7 +398,7 @@ function computeEventMutation(hit0: Hit, hit1: Hit, massagers: eventDragMutation
   }
 
   for (let massager of massagers) {
-    massager(mutation, hit0, hit1)
+    massager(mutation, hit0, hit1, calendar)
   }
 
   return mutation