Adam Shaw 7 лет назад
Родитель
Сommit
ecf207bd6d
3 измененных файлов с 15 добавлено и 20 удалено
  1. 5 12
      src/Calendar.ts
  2. 9 1
      src/CalendarComponent.ts
  3. 1 7
      src/View.ts

+ 5 - 12
src/Calendar.ts

@@ -352,11 +352,6 @@ export default class Calendar {
       }, this.el)
     }
 
-    if (savedScroll) {
-      savedScroll.isLocked = true // will prevent view from computing own values
-      component.view.addScroll(savedScroll)
-    }
-
     component.receiveProps({
       viewSpec,
       dateProfile: state.dateProfile,
@@ -369,6 +364,10 @@ export default class Calendar {
       eventResize: state.eventResize
     })
 
+    if (savedScroll) {
+      component.view.applyScroll(savedScroll)
+    }
+
     this.releaseAfterSizingTriggers()
     this.isRendering = false
   }
@@ -714,15 +713,9 @@ export default class Calendar {
   resizeComponent(): boolean {
 
     if (!this.isResizing && this.component) {
-      this.isResizing = true
-
-      let savedScroll = this.component.view.queryScroll()
 
+      this.isResizing = true
       this.component.updateRootSize(true) // isResize=true
-
-      savedScroll.isLocked = true // will prevent view from computing own values
-      this.component.view.applyScroll(savedScroll)
-
       this.isResizing = false
 
       return true // signal success

+ 9 - 1
src/CalendarComponent.ts

@@ -107,7 +107,6 @@ export default class CalendarComponent extends Component<CalendarComponentProps>
 
     this.updateRootSize()
     this.thawContentHeight()
-    this.view.popScroll()
   }
 
   renderToolbars(viewSpec: ViewSpec, dateProfile: DateProfile, dateProfileGenerator: DateProfileGenerator, title: string) {
@@ -175,6 +174,8 @@ export default class CalendarComponent extends Component<CalendarComponentProps>
         dateProfileGenerator,
         this.contentEl
       )
+    } else {
+      view.addScroll(view.queryScroll())
     }
 
     view.title = title // for the API
@@ -196,11 +197,18 @@ export default class CalendarComponent extends Component<CalendarComponentProps>
   // -----------------------------------------------------------------------------------------------------------------
 
   updateRootSize(isResize = false) {
+    let { view } = this
+
+    if (isResize) {
+      view.addScroll(view.queryScroll())
+    }
+
     if (isResize || this.isHeightAuto == null) {
       this.computeHeightVars()
     }
 
     this.updateSize(this.viewHeight, this.isHeightAuto, isResize)
+    view.popScroll()
   }
 
   updateSize(totalHeight, isAuto, isResize) {

+ 1 - 7
src/View.ts

@@ -263,9 +263,7 @@ export default abstract class View extends DateComponent {
   addScroll(scroll) {
     let queuedScroll = this.queuedScroll || (this.queuedScroll = {})
 
-    if (!queuedScroll.isLocked) {
-      assignTo(queuedScroll, scroll)
-    }
+    assignTo(queuedScroll, scroll)
   }
 
 
@@ -293,10 +291,6 @@ export default abstract class View extends DateComponent {
 
   applyScroll(scroll) {
 
-    if (scroll.isLocked) {
-      delete scroll.isLocked
-    }
-
     if (scroll.isDateInit) {
       delete scroll.isDateInit