Procházet zdrojové kódy

receiving calendar must be droppable and editable

Adam Shaw před 7 roky
rodič
revize
0321117c5e
1 změnil soubory, kde provedl 17 přidání a 8 odebrání
  1. 17 8
      src/interactions/EventDragging.ts

+ 17 - 8
src/interactions/EventDragging.ts

@@ -133,17 +133,26 @@ export default class EventDragging { // TODO: rename to EventSelectingAndDraggin
     let isInvalid = false
 
     if (hit) {
-      receivingCalendar = hit.component.getCalendar()
-      mutation = computeEventMutation(initialHit, hit)
+      let receivingComponent = hit.component
+      receivingCalendar = receivingComponent.getCalendar()
 
-      if (mutation) {
-        mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, mutation, receivingCalendar)
+      if (
+        initialCalendar === receivingCalendar ||
+        receivingComponent.opt('editable') && receivingComponent.opt('droppable')
+      ) {
+        mutation = computeEventMutation(initialHit, hit)
+
+        if (mutation) {
+          mutatedRelevantEvents = applyMutationToEventStore(relevantEvents, mutation, receivingCalendar)
 
-        if (!this.component.isEventsValid(mutatedRelevantEvents)) {
-          isInvalid = true
-          mutation = null
-          mutatedRelevantEvents = null
+          if (!this.component.isEventsValid(mutatedRelevantEvents)) {
+            isInvalid = true
+            mutation = null
+            mutatedRelevantEvents = null
+          }
         }
+      } else {
+        receivingCalendar = null
       }
     }