Adam Shaw 7 лет назад
Родитель
Сommit
0a65ecd608

+ 1 - 1
src/Calendar.ts

@@ -807,7 +807,7 @@ export default class Calendar {
     if (!this.isResizing && this.component) {
 
       this.isResizing = true
-      this.component.updateRootSize(true) // isResize=true
+      this.component.updateSize(true) // isResize=true
       this.isResizing = false
 
       return true // signal success

+ 4 - 8
src/CalendarComponent.ts

@@ -108,7 +108,7 @@ export default class CalendarComponent extends Component<CalendarComponentProps>
     this._renderToolbars(props.viewSpec, props.dateProfile, props.dateProfileGenerator, title)
     this.renderView(props, title)
 
-    this.updateRootSize()
+    this.updateSize()
     this.thawHeight()
   }
 
@@ -201,7 +201,7 @@ export default class CalendarComponent extends Component<CalendarComponentProps>
   // Sizing
   // -----------------------------------------------------------------------------------------------------------------
 
-  updateRootSize(isResize = false) {
+  updateSize(isResize = false) {
     let { view } = this
 
     if (isResize) {
@@ -212,15 +212,11 @@ export default class CalendarComponent extends Component<CalendarComponentProps>
       this.computeHeightVars()
     }
 
-    this.updateSize(this.viewHeight, this.isHeightAuto, isResize)
+    view.updateSize(isResize, this.viewHeight, this.isHeightAuto)
+    view.updateNowIndicator() // we need to guarantee this will run after updateSize
     view.popScroll()
   }
 
-  updateSize(totalHeight, isAuto, isResize) {
-    this.view.updateSize(this.viewHeight, this.isHeightAuto, isResize)
-    this.view.updateNowIndicator() // we need to guarantee this will run after updateSize
-  }
-
   computeHeightVars() {
     let { calendar } = this // yuck. need to handle dynamic options
     let heightInput = calendar.opt('height')

+ 3 - 3
src/View.ts

@@ -142,12 +142,12 @@ export default abstract class View extends DateComponent<ViewProps> {
   // -----------------------------------------------------------------------------------------------------------------
 
 
-  updateSize(viewHeight: number, isAuto: boolean, isResize: boolean) {
+  updateSize(isResize: boolean, viewHeight: number, isAuto: boolean) {
 
     if (isResize || this.isDateSizeDirty || this.isEventSizeDirty) {
       // sort of the catch-all sizing
       // anything that might cause dimension changes
-      this.updateBaseSize(viewHeight, isAuto, isResize)
+      this.updateBaseSize(isResize, viewHeight, isAuto)
     }
 
     this.isDateSizeDirty = false
@@ -155,7 +155,7 @@ export default abstract class View extends DateComponent<ViewProps> {
   }
 
 
-  updateBaseSize(viewHeight: number, isAuto: boolean, isResize: boolean) {
+  updateBaseSize(isResize: boolean, viewHeight: number, isAuto: boolean) {
   }
 
 

+ 5 - 5
src/agenda/AbstractAgendaView.ts

@@ -169,19 +169,19 @@ export default abstract class AgendaView extends View {
   ------------------------------------------------------------------------------------------------------------------*/
 
 
-  updateSize(viewHeight: number, isAuto: boolean, isResize: boolean) {
-    super.updateSize(viewHeight, isAuto, isResize) // will call updateBaseSize. important that executes first
+  updateSize(isResize: boolean, viewHeight: number, isAuto: boolean) {
+    super.updateSize(isResize, viewHeight, isAuto) // will call updateBaseSize. important that executes first
 
-    this.timeGrid.updateSize(viewHeight, isAuto, isResize)
+    this.timeGrid.updateSize(isResize)
 
     if (this.dayGrid) {
-      this.dayGrid.updateSize(viewHeight, isAuto, isResize)
+      this.dayGrid.updateSize(isResize)
     }
   }
 
 
   // Adjusts the vertical dimensions of the view to the specified values
-  updateBaseSize(viewHeight, isAuto, isResize) {
+  updateBaseSize(isResize, viewHeight, isAuto) {
     let eventLimit
     let scrollerHeight
     let scrollbarWidths

+ 1 - 1
src/agenda/TimeGrid.ts

@@ -253,7 +253,7 @@ export default class TimeGrid extends DateComponent<TimeGridProps> {
   }
 
 
-  updateSize(viewHeight: number, isAuto: boolean, isResize: boolean) {
+  updateSize(isResize: boolean) {
     let { fillRenderer, eventRenderer, mirrorRenderer } = this
 
     if (isResize || this.isSlatSizesDirty) {

+ 4 - 4
src/basic/AbstractBasicView.ts

@@ -133,15 +133,15 @@ export default abstract class BasicView extends View {
   ------------------------------------------------------------------------------------------------------------------*/
 
 
-  updateSize(viewHeight: number, isAuto: boolean, isResize: boolean) {
-    super.updateSize(viewHeight, isAuto, isResize) // will call updateBaseSize. important that executes first
+  updateSize(isResize: boolean, viewHeight: number, isAuto: boolean) {
+    super.updateSize(isResize, viewHeight, isAuto) // will call updateBaseSize. important that executes first
 
-    this.dayGrid.updateSize(viewHeight, isAuto, isResize)
+    this.dayGrid.updateSize(isResize)
   }
 
 
   // Refreshes the horizontal dimensions of the view
-  updateBaseSize(viewHeight: number, isAuto: boolean, isResize: boolean) {
+  updateBaseSize(isResize: boolean, viewHeight: number, isAuto: boolean) {
     let { dayGrid } = this
     let eventLimit = this.opt('eventLimit')
     let headRowEl = (this as any).header ? (this as any).header.el : null // HACK

+ 1 - 1
src/basic/DayGrid.ts

@@ -392,7 +392,7 @@ export default class DayGrid extends DateComponentProps<DayGridProps> {
   ------------------------------------------------------------------------------------------------------------------*/
 
 
-  updateSize(viewHeight: number, isAuto: boolean, isResize: boolean) {
+  updateSize(isResize: boolean) {
     let { fillRenderer, eventRenderer, mirrorRenderer } = this
 
     if (isResize || this.isCellSizesDirty) {

+ 5 - 5
src/list/ListView.ts

@@ -55,8 +55,8 @@ export default class ListView extends View {
   }
 
 
-  updateSize(totalHeight, isAuto, isResize) {
-    super.updateSize(totalHeight, isAuto, isResize)
+  updateSize(isResize, viewHeight, isAuto) {
+    super.updateSize(isResize, viewHeight, isAuto)
 
     this.eventRenderer.computeSizes(isResize)
     this.eventRenderer.assignSizes(isResize)
@@ -64,13 +64,13 @@ export default class ListView extends View {
     this.scroller.clear() // sets height to 'auto' and clears overflow
 
     if (!isAuto) {
-      this.scroller.setHeight(this.computeScrollerHeight(totalHeight))
+      this.scroller.setHeight(this.computeScrollerHeight(viewHeight))
     }
   }
 
 
-  computeScrollerHeight(totalHeight) {
-    return totalHeight -
+  computeScrollerHeight(viewHeight) {
+    return viewHeight -
       subtractInnerElHeight(this.el, this.scroller.el) // everything that's NOT the scroller
   }
 

+ 2 - 1
tests/automated/legacy/custom-view-class.js

@@ -9,7 +9,8 @@ describe('custom view class', function() {
         expect(dateProfile.activeRange.end instanceof Date).toBe(true)
       }
 
-      updateSize(height, isAuto) {
+      updateSize(isResize, height, isAuto) {
+        expect(typeof isResize).toBe('boolean')
         expect(typeof height).toBe('number')
         expect(typeof isAuto).toBe('boolean')
       }