Commit 05743fa4 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Revisa diseño Details, corrige mapa saltarín

Limpia y anula algunas partes del controlador del diseño Details, para
ir simplificando y depurando la implementación.

Cambia opción poco útil en diseño por una específica del contenedor de
mapas, que corrige su funcionamiento cuando se encuentra dentro de un
diseño Details (ventana saltarina), como ocurría en la vista detalle de
localización de especies.
parent c96984b1
Loading
Loading
Loading
Loading
+39 −27
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ define([
	, _Window
	, _ControllerItfc
) {

	return declare([_ControllerItfc, _Controller, _Store], {
		//	summary:
		//		Controller para vistas de detalle, que dividen la información a mostrar en cajitas independientes.
@@ -35,10 +36,10 @@ define([
			this.config = {
				controllerEvents: {
					LAYOUT_COMPLETE: "layoutComplete",
					BUTTON_EVENT: "btnEvent"
					BUTTON_EVENT: "btnEvent" // TODO esto es específico, reubicar
				},
				controllerActions: {
					GET_REPORT: "getReport"
					GET_REPORT: "getReport" // TODO esto es específico, reubicar
				},

				idProperty: "id",
@@ -49,7 +50,6 @@ define([
				_updateInteractiveTimeout: 100,

				_widgets: {},
				_widgetsShowWindows: {},
				_nodes: {},
				_nodesHandlers: {}
			};
@@ -99,7 +99,7 @@ define([
			this._onEvt('ME_OR_ANCESTOR_SHOWN', lang.hitch(this, this._onControllerMeOrAncestorShown));
			this._onEvt('RESIZE', lang.hitch(this, this._onControllerResize));
			this._onEvt('LAYOUT_COMPLETE', lang.hitch(this, this._onLayoutComplete));
			this._onEvt('BUTTON_EVENT', lang.hitch(this, this._onButtonEvent));
			this._onEvt('BUTTON_EVENT', lang.hitch(this, this._onButtonEvent)); // TODO esto es específico, reubicar
		},

		_afterControllerShow: function() {
@@ -161,7 +161,7 @@ define([
			this[methodName] && this[methodName](evt);
		},

		_onControllerShown: function() {
		/*_onControllerShown: function() {

			if (this._getShown()) {
				this._reloadInteractive();
@@ -170,7 +170,7 @@ define([

			this._clearModules();
			this._refreshModules();
		},
		},*/

		_reloadInteractive: function() {

@@ -188,11 +188,16 @@ define([

		_onControllerMeOrAncestorShown: function(res) {

			if (this._getShown()) {
				this._reloadInteractive();
				this._updateInteractive();
			}

			this._clearModules();
			this._refreshModules();
		},

		_getModuleRootNode: function() {
		/*_getModuleRootNode: function() {

			return this.containerNode;
		},
@@ -200,9 +205,10 @@ define([
		_getModuleMainNode: function() {

			return this.centerNode;
		},
		},*/

		_evaluateCondition: function(condition) {
			// TODO: eso es para casos concretos (botones), debería separarse

			if (typeof condition === "function") {
				return condition(this.data);
@@ -246,17 +252,11 @@ define([

			var rows = config.height || 1,
				cols = config.width || 1,
				showInitially = config.showInitially || false,
				nodeParams = '[' + this._rowsParameterName + '=' + rows + '][' + this._colsParameterName + '=' + cols +
					']',
				node = put('div' + nodeParams);
				rowsParam = '[' + this._rowsParameterName + '=' + rows + ']',
				colsParam = '[' + this._colsParameterName + '=' + cols + ']',
				nodeDefinition = 'div.' + this.hiddenClass + rowsParam + colsParam;

			if (!showInitially) {
				put(node, '.' + this.hiddenClass);
			}
			this._nodes[key] = node;

			put(this.centerNode, node);
			this._nodes[key] = put(this.centerNode, nodeDefinition);
		},

		_showWidget: function(key) {
@@ -265,6 +265,7 @@ define([
				node = this._nodes[key];

			if (!instance || !node) {
				console.error('Tried to show non-existent widget "%s" or node was missing', key);
				return;
			}

@@ -294,6 +295,7 @@ define([
				node = this._nodes[key];

			if (!instance || !node) {
				console.error('Tried to hide non-existent widget "%s" or node was missing', key);
				return;
			}

@@ -315,6 +317,11 @@ define([

			var instance = this._getWidgetInstance(key);

			if (!instance) {
				console.error('Tried to connect non-existent widget "%s"', key);
				return;
			}

			this._publish(instance.getChannel("CONNECT"));
		},

@@ -322,6 +329,11 @@ define([

			var instance = this._getWidgetInstance(key);

			if (!instance) {
				console.error('Tried to disconnect non-existent widget "%s"', key);
				return;
			}

			this._publish(instance.getChannel("DISCONNECT"));
		},

@@ -341,7 +353,7 @@ define([

			this.packery.addItems(node);

			var widthStep = this.centerNode.offsetWidth * (1 / 6),// - 2.555,
			var widthStep = this.centerNode.offsetWidth * (1 / 6),
				draggie = new draggabilly(node, {
					handle: ".windowTitle",
					grid: [ widthStep, 100 ]
@@ -377,14 +389,14 @@ define([
				totalWidth = this.centerNode.scrollWidth,
				sizeHasChanged = this._oldTotalHeight !== totalHeight || this._oldTotalWidth !== totalWidth;

			this._oldTotalWidth = totalWidth;
			this._oldTotalHeight = totalHeight;

			if (sizeHasChanged) {
				this._emitEvt("RESIZE");
			}

			this._oldTotalWidth = totalWidth;
			this._oldTotalHeight = totalHeight;

			this._emitEvt("LOADED");
			//this._emitEvt("LOADED");
		},

		_reportClicked: function() {
+11 −8
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ define([
	, citationTemplate
	, pointTrackingTemplate
) {

	return declare([Layout, Controller, _Main, _AddTitle, _TitleSelection, _LocalSelectionView], {
		//	summary:
		//		Vista detalle de Species.
@@ -53,7 +54,6 @@ define([

			this.config = {
				_titleRightButtonsList: [],
				noScroll: true,
				idProperty: "uuid",
				propsWidget: {
					omitTitleBar: true,
@@ -76,11 +76,10 @@ define([
				map: {
					width: 6,
					height: 6,
					showInitially: true,
					type: declare([LeafletImpl, Map, _PlaceNamesButton]),
					props: {
						title: this.i18n.map,
						omitTitleCloseButton: true
						omitContainerSizeCheck: true
					}
				}
			}, this.widgetConfigs || {}]);
@@ -94,10 +93,16 @@ define([

		_afterShow: function(request) {

			var widgetInstance = this._getWidgetInstance('map');

			if (!widgetInstance) {
				return;
			}

			if (!this.pruneClusterLayer) {
				this.pruneClusterLayer = new this._pruneClusterLayerDefinition({
					parentChannel: this.getChannel(),
					mapChannel: this._widgets.map.getChannel(),
					mapChannel: widgetInstance.getChannel(),
					selectorChannel: this.getChannel(),
					categoryStyle: "bubbles",
					getPopupContent: this._getPopupContent,
@@ -116,10 +121,8 @@ define([
					}
				});

				this._publish(this._widgets.map.getChannel("ADD_LAYER"), this.pruneClusterLayer);
				this._publish(widgetInstance.getChannel("ADD_LAYER"), this.pruneClusterLayer);
			}

			this.startup();
		},

		_clearModules: function() { },
+8 −2
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ define([
				scaleBar: true,
				measureTools: true,
				queryableClass: "leaflet-queryable",
				omitContainerSizeCheck: false,

				_mapNodeValidSizeInterval: 100,

@@ -176,15 +177,20 @@ define([

		_afterShow: function() {

			if (this.omitContainerSizeCheck) {
				this._onMapNodeValidSize();
				return;
			}

			var dfd = new Deferred();

			dfd.then(lang.hitch(this, this._onMapNodeValidSize));

			this._mapNodeValidSizeIntervalHandler = setInterval(lang.hitch(this, function(dfd) {
			this._mapNodeValidSizeIntervalHandler = setInterval(lang.hitch(this, function(nestedDfd) {

				if (this.mapParentNode.clientHeight) {
					clearInterval(this._mapNodeValidSizeIntervalHandler);
					dfd.resolve();
					nestedDfd.resolve();
				}
			}, dfd), this._mapNodeValidSizeInterval);

+1 −1

File changed.

Contains only whitespace changes.