Browse Source

fix unselecting on different components

Adam Shaw 7 years ago
parent
commit
3f03049012
2 changed files with 5 additions and 7 deletions
  1. 4 6
      src/Calendar.ts
  2. 1 1
      src/interactions/DateSelecting.ts

+ 4 - 6
src/Calendar.ts

@@ -929,12 +929,10 @@ export default class Calendar {
 
   // public method
   unselect(ev?: UIEvent) {
-    if (this.state.selection) {
-      this.dispatch({
-        type: 'UNSELECT'
-      })
-      this.triggerUnselect(this.view, ev)
-    }
+    this.dispatch({
+      type: 'UNSELECT'
+    })
+    this.triggerUnselect(this.view, ev)
   }
 
 

+ 1 - 1
src/interactions/DateSelecting.ts

@@ -95,7 +95,7 @@ export default class DateSelecting {
 
       this.dragSelection = null
 
-    } else if (!isTouchScroll) {
+    } else if (!isTouchScroll && component.selection) {
       // if there was a pointerup that did not result in a selection and was
       // not merely a touchmove-scroll, then possibly unselect the current selection.
       // won't do anything if already unselected (OR, leverage selectedCalendar?)