Commit 606e212c authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Corrige bugs e implementa base de dinamismo

Para conseguir las vistas de detalle dinámicas, cada ventana debe ser
consciente de su estado de visibilidad dentro de la vista, además de
contar con un identificador en su título para poder desplazar al usuario
hasta ella con un anchor.
Se añade un flag 'visibleIntoParent' sobre su estado de visibilidad, y
se usa como id una propiedad recibida desde la construcción o el
identificador del canal propio en su defecto.

Se controlan varios casos de error introducidos con las nuevas
características en commits anteriores: botón de resize fuera del
contenedor, edición de botones en ventanas sin botones y botón de resize
sobre el título tras minimizar.
parent 13d74af6
Loading
Loading
Loading
Loading
+61 −6
Original line number Diff line number Diff line
@@ -49,7 +49,12 @@ define([
		minWidthCols: 1,
		maxWidthCols: 6,

		resizableBottomPadding: 15,

		scrollMargin: 10,

		resizable: true,
		scrollSensitive: true,
		// TODO renombrar estos flags aquí y donde se usen
		noTitleWindow: false,
		noButtonsWindow: false,
@@ -60,6 +65,7 @@ define([
		_userResizeTimeout: 100,
		_emitResizeTimeout: 100,


		_setShowOwnCallbacksForEvents: function () {

			this.inherited(arguments);
@@ -123,8 +129,8 @@ define([

			this._limitMaxHeightToAvailableHeight();

			var resizeHandleNode = put('i.' + this.resizeHandleClass);
			put(this._windowNode, resizeHandleNode);
			this._resizeHandleNode = put('i.' + this.resizeHandleClass);
			put(this._windowNode, this._resizeHandleNode);
		},

		_limitMaxHeightToAvailableHeight: function() {
@@ -133,7 +139,7 @@ define([

			if (this._lastMaxHeight !== currMaxHeight) {
				this._lastMaxHeight = currMaxHeight;
				domStyle.set(this._windowNode, 'max-height', currMaxHeight + 'px');
				domStyle.set(this._windowNode, 'max-height', (currMaxHeight + this.resizableBottomPadding) + 'px');
			}
		},

@@ -173,6 +179,11 @@ define([
			this._windowContentNode.addEventListener('transitionend', this._transitionEndCallback);
			this._windowNode.parentNode.addEventListener('transitionend', this._transitionEndCallback);

			if (this.scrollSensitive) {
				this._windowNode.parentNode.parentNode.addEventListener('scroll', lang.hitch(this,
					this._onGrandParentScroll));
			}

			if (this.resizable) {
				this._windowNode.addEventListener('mousedown', lang.hitch(this, this._onWindowUserResizeStart));
			}
@@ -200,6 +211,26 @@ define([
			}
		},

		_onGrandParentScroll: function(evt) {

			var gParent = evt.target,
				gParentVisibleTop = gParent.scrollTop - this.scrollMargin,
				gParentVisibleBottom = gParent.scrollTop + gParent.offsetHeight + this.scrollMargin,

				parent = this._windowNode.parentNode,
				windowTop = domStyle.get(parent, 'top'),
				windowBottom = windowTop + parent.offsetHeight,

				windowTopAboveVisibleBottom = gParentVisibleBottom >= windowTop,
				windowBottomUnderVisibleTop = gParentVisibleTop <= windowBottom;

			if (windowBottomUnderVisibleTop && windowTopAboveVisibleBottom) {
				this._setVisibleIntoParent(true);
			} else {
				this._setVisibleIntoParent(false);
			}
		},

		_onWindowUserResizeStart: function(evt) {

			on.once(window, 'mouseup', lang.hitch(this, this._onWindowUserResizeEnd));
@@ -232,7 +263,9 @@ define([
			domClass.add(this._windowNode.parentNode, this.windowResizedParentClass);

			this._setResizedByUser(true);
			if (!this.noButtonsWindow) {
				this._prepareMaximizeForUndoUserResize();
			}
		},

		_onWindowUserResizeEnd: function(evt) {
@@ -287,8 +320,12 @@ define([

		_decorateTitleNode: function() {

			var titleTextValue = this.title || this.getOwnChannel(),
				titleTextNode = put(this._windowTitleNode, "div." + this.windowTitleValueClass, titleTextValue);
			var windowTitle = this.windowTitle || this.getOwnChannel(),
				titleTextValue = this.i18n[windowTitle] || this.title || this.getOwnChannel();

			put(this._windowTitleNode, '[id="' + windowTitle + '"]');

			put(this._windowTitleNode, "div." + this.windowTitleValueClass, titleTextValue);

			if (!this.noButtonsWindow) {
				this._createWindowButtons();
@@ -320,6 +357,10 @@ define([

			this._minimizeButton.onclick = lang.hitch(this, this._minimizeModuleReturn);

			if (this.resizable) {
				domClass.add(this._resizeHandleNode, this.hiddenClass);
			}

			domStyle.set(this.node, "height", 0);
			domStyle.set(this._windowNode.parentNode, "height", this.titleHeight + "px");
		},
@@ -330,6 +371,10 @@ define([

			this._minimizeButton.onclick = lang.hitch(this, this._minimizeModule);

			if (this.resizable) {
				domClass.remove(this._resizeHandleNode, this.hiddenClass);
			}

			domStyle.set(this.node, "height", "calc(100% - " + this.titleHeight + "px)");
			domStyle.set(this._windowNode.parentNode, "height", "");
		},
@@ -484,6 +529,16 @@ define([
			this.statusFlags.resizedByUser = value;
		},

		_getVisibleIntoParent: function() {

			return this.statusFlags.visibleIntoParent;
		},

		_setVisibleIntoParent: function(value) {

			this.statusFlags.visibleIntoParent = value;
		},

		_hide: function(req) {

			this._removeNodeListeners();
Compare 55cf3d9b to be6b9774
Original line number Diff line number Diff line
Subproject commit 55cf3d9ba3a0204309a1a87c0b0136401910c212
Subproject commit be6b977479108c1c692b5c79d0f3f87efa7f24fb