Parcourir la source

when viewRender callback triggered, make sure view isnt obscured

Adam Shaw il y a 10 ans
Parent
commit
4c16657853
2 fichiers modifiés avec 7 ajouts et 2 suppressions
  1. 4 2
      src/Calendar.js
  2. 3 0
      src/common/View.js

+ 4 - 2
src/Calendar.js

@@ -608,8 +608,7 @@ function Calendar_constructor(element, overrides) {
 			) {
 				if (elementVisible()) {
 
-					freezeContentHeight();
-					currentView.display(date);
+					currentView.display(date); // will call freezeContentHeight
 					unfreezeContentHeight(); // immediately unfreeze regardless of whether display is async
 
 					// need to do this after View::render, so dates are calculated
@@ -863,6 +862,9 @@ function Calendar_constructor(element, overrides) {
 	-----------------------------------------------------------------------------*/
 	// TODO: move this into the view
 
+	t.freezeContentHeight = freezeContentHeight;
+	t.unfreezeContentHeight = unfreezeContentHeight;
+
 
 	function freezeContentHeight() {
 		content.css({

+ 3 - 0
src/common/View.js

@@ -280,12 +280,15 @@ var View = FC.View = Class.extend({
 			scrollState = this.queryScroll();
 		}
 
+		this.calendar.freezeContentHeight();
+
 		return this.clear().then(function() { // clear the content first (async)
 			return (
 				_this.displaying =
 					$.when(_this.displayView(date)) // displayView might return a promise
 						.then(function() {
 							_this.forceScroll(_this.computeInitialScroll(scrollState));
+							_this.calendar.unfreezeContentHeight();
 							_this.triggerRender();
 						})
 			);