Browse Source

eventDefMutationApplier gets calenar

Adam Shaw 7 years ago
parent
commit
66e3aa4e9a
2 changed files with 5 additions and 5 deletions
  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
   subjectSeg: Seg | null = null // the seg being selected/dragged
   isDragging: boolean = false
   isDragging: boolean = false
   eventRange: EventRenderRange | null = null
   eventRange: EventRenderRange | null = null
-  relevantEvents: EventStore | null = null
+  relevantEvents: EventStore | null = null // the events being dragged
   receivingCalendar: Calendar | null = null
   receivingCalendar: Calendar | null = null
   validMutation: EventMutation | null = null
   validMutation: EventMutation | null = null
   mutatedRelevantEvents: EventStore | 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) {
   for (let defId in eventStore.defs) {
     let def = eventStore.defs[defId]
     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) {
   for (let instanceId in eventStore.instances) {
@@ -35,10 +35,10 @@ export function applyMutationToEventStore(eventStore: EventStore, mutation: Even
   return dest
   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 copy = assignTo({}, eventDef)
   let standardProps = mutation.standardProps || {}
   let standardProps = mutation.standardProps || {}
 
 
@@ -61,7 +61,7 @@ function applyMutationToEventDef(eventDef: EventDef, mutation: EventMutation, ap
   }
   }
 
 
   for (let applier of appliers) {
   for (let applier of appliers) {
-    applier(copy, mutation)
+    applier(copy, mutation, calendar)
   }
   }
 
 
   return copy
   return copy