Ver código fonte

eventDefMutationApplier gets calenar

Adam Shaw 7 anos atrás
pai
commit
66e3aa4e9a
2 arquivos alterados com 5 adições e 5 exclusões
  1. 1 1
      src/interactions/EventDragging.ts
  2. 4 4
      src/structs/event-mutation.ts

+ 1 - 1
src/interactions/EventDragging.ts

@@ -25,7 +25,7 @@ export default class EventDragging { // TODO: rename to EventSelectingAndDraggin
   subjectSeg: Seg | null = null // the seg being selected/dragged
   isDragging: boolean = false
   eventRange: EventRenderRange | null = null
-  relevantEvents: EventStore | null = null
+  relevantEvents: EventStore | null = null // the events being dragged
   receivingCalendar: Calendar | null = null
   validMutation: EventMutation | null = null
   mutatedRelevantEvents: EventStore | null = null

+ 4 - 4
src/structs/event-mutation.ts

@@ -23,7 +23,7 @@ export function applyMutationToEventStore(eventStore: EventStore, mutation: Even
 
   for (let defId in eventStore.defs) {
     let def = eventStore.defs[defId]
-    dest.defs[defId] = applyMutationToEventDef(def, mutation, calendar.pluginSystem.hooks.eventDefMutationAppliers)
+    dest.defs[defId] = applyMutationToEventDef(def, mutation, calendar.pluginSystem.hooks.eventDefMutationAppliers, calendar)
   }
 
   for (let instanceId in eventStore.instances) {
@@ -35,10 +35,10 @@ export function applyMutationToEventStore(eventStore: EventStore, mutation: Even
   return dest
 }
 
-export type eventDefMutationApplier = (eventDef: EventDef, mutation: EventMutation) => void
+export type eventDefMutationApplier = (eventDef: EventDef, mutation: EventMutation, calendar: Calendar) => void
 
 
-function applyMutationToEventDef(eventDef: EventDef, mutation: EventMutation, appliers: eventDefMutationApplier[]): EventDef {
+function applyMutationToEventDef(eventDef: EventDef, mutation: EventMutation, appliers: eventDefMutationApplier[], calendar: Calendar): EventDef {
   let copy = assignTo({}, eventDef)
   let standardProps = mutation.standardProps || {}
 
@@ -61,7 +61,7 @@ function applyMutationToEventDef(eventDef: EventDef, mutation: EventMutation, ap
   }
 
   for (let applier of appliers) {
-    applier(copy, mutation)
+    applier(copy, mutation, calendar)
   }
 
   return copy