Commit 3e0eb9ef authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Corrige casos de mal posicionamiento en detalles

Escucha aparición y desaparición de la barra de scroll en el contenido
de las vistas de detalle, corrigiendo la distribución de contenidos
cuando ha habido scroll y luego ha desaparecido por no ser necesario (el
tamaño vertical del contenido cabe en la pantalla).
parent c1efe5cf
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -86,6 +86,8 @@ define([
				initLayout: false,
				transitionDuration: 0
			});

			this._listenCenterNodeScrollShowUp();
		},

		_doControllerEvtFacade: function() {
@@ -101,6 +103,38 @@ define([
			this._onEvt('LAYOUT_COMPLETE', lang.hitch(this, this._onLayoutComplete));
		},

		_listenCenterNodeScrollShowUp: function() {

			this._detailsResizeObserver = new ResizeObserver(lang.hitch(this, this._onDetailsCenterNodeResize));
			this._detailsResizeObserver.observe(this.centerNode);
		},

		_onDetailsCenterNodeResize: function(resizeEntries) {

			for (var resizeEntry of resizeEntries) {
				if (!resizeEntry.borderBoxSize && !resizeEntry.contentBoxSize) {
					continue;
				}

				var borderWidth = resizeEntry.borderBoxSize[0].inlineSize,
					contentWidth = resizeEntry.contentBoxSize[0].inlineSize;

				if (borderWidth !== contentWidth) {
					this._scrollPreviouslyDetected = true;
					break;
				} else if (this._scrollPreviouslyDetected) {
					this._scrollPreviouslyDetected = false;
					this._onCenterNodeScrollShowUp();
					break;
				}
			}
		},

		_onCenterNodeScrollShowUp: function() {

			this._updateInteractive();
		},

		_afterControllerShow: function() {

			if (!this._widgetsAlreadyGenerated) {