Commit 2b7c6a6c authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Usa rango numérico en speciesDistribution

En lugar de una barra tipo slider para elegir precisión y profundidad de
las citas a devolver, que era prácticamente incontrolable, usa 2 inputs
numéricos de tipo spinner.

Para que esto fuese posible, se ha terminado de implementar el input de
tipo Range, aceptando usar opcionalmente input spinner (por defecto,
usa numberTextBox) y recibir propiedades de configuración necesarias.

Además, speciesDistribution lanza el parámetro precision a nivel raíz de
la consulta, en lugar de como parte de terms como se hacía antes.
parent 2e4c19bd
Loading
Loading
Loading
Loading
+8 −24
Original line number Diff line number Diff line
@@ -466,7 +466,7 @@ define([
				// TODO cuando los terms en el schema esten con propiedades borrar el if
				if (this.currentMode === 3) {
					if (this.precision) {
						obj.terms.precision = this.precision;
						obj.precision = this.precision;
					}
				} else {
					obj.terms.confidences = this.confidences;
@@ -697,31 +697,22 @@ define([

		_changePrecisionSlider: function(value) {

			// TODO cuando los terms en el schema esten con propiedades, cambiar lo de selection

			value = value && [value.min, value.max];

			this.precision = value;

			var obj = {
				"terms": {
					"selection": this.selectIds,
					"precision": this.precision
				}
				terms: {
					selection: this.selectIds
				},
				precision: value
			};

			this._publish(this.pruneClusterLayer.getChannel("REFRESH"), obj);

			if (value) {
				var min = value[0],
					max = value[1];

				this._emitEvt('TRACK', {
					type: TRACK.type.event,
					info: {
						category: TRACK.category.button,
						action: TRACK.action.click,
						label: "changeDistributionPrecision:" + min + "-" + max
						label: "changeDistributionPrecision:" + value.min + "-" + value.max
					}
				});
			}
@@ -736,15 +727,12 @@ define([
			this._publish(this.pruneClusterLayer.getChannel("REFRESH"), obj);

			if (value) {
				var min = value.min,
					max = value.max;

				this._emitEvt('TRACK', {
					type: TRACK.type.event,
					info: {
						category: TRACK.category.button,
						action: TRACK.action.click,
						label: "changeDistributionDepth:" + min + "-" + max
						label: "changeDistributionDepth:" + value.min + "-" + value.max
					}
				});
			}
@@ -846,11 +834,7 @@ define([

		_shouldAbortRequestForDataLayer: function() {

			if (this._getEmptySelection()) {
				return true;
			}

			return false;
			return this._getEmptySelection();
		}
	});
});
+15 −9
Original line number Diff line number Diff line
@@ -51,22 +51,28 @@

		<fieldset>
			<legend>${i18n.filters}</legend>
			<div data-redmic-type="rangeSlider" class="rangeSlider" data-redmic-props="
			<div data-redmic-type="range" data-redmic-props="
				propertyName: 'precisionSlider',
				label: 'precision',
				unit: 'm',
				valueMinMax: [0, 5000],
				useSpinner: true,
				isDisableInput: true,
				disable: true
				disable: true,
				constraints: {
					min: 0,
					max: 5000
				}
			"></div>

			<div data-redmic-type="rangeSlider" class="rangeSlider" data-redmic-props="
			<div data-redmic-type="range" data-redmic-props="
				propertyName: 'zSlider',
				label: 'zDepthAltitude',
				unit: 'm',
				valueMinMax: [-5000, 5000],
				useSpinner: true,
				isDisableInput: true,
				disable: true
				disable: true,
				constraints: {
					min: -5000,
					max: 5000
				}
			"></div>
		</fieldset>
	</form>
+22 −5
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dojo/_base/lang"
	, "redmic/modules/form/input/NumberSpinnerImpl"
	, "redmic/modules/form/input/NumberTextBoxImpl"
	, "redmic/modules/form/input/_BaseRange"
], function(
	declare
	, lang
	, NumberSpinnerImpl
	, NumberTextBoxImpl
	, _BaseRange
){
@@ -16,24 +18,39 @@ define([
		constructor: function(args) {

			this.config = {
				inputDef: NumberTextBoxImpl,
				_inputProps: {

				},
				_minInputProps: {
					inputProps: {
						intermediateChanges: true
					}
				},
				_maxInputProps: {
					inputProps: {
						intermediateChanges: true
					}
				},
				ownChannel: "range"
			};

			lang.mixin(this, this.config, args);

			if (this.inputProps.useSpinner) {
				this.inputDef = NumberSpinnerImpl;
			} else {
				this.inputDef = NumberTextBoxImpl;
			}

			var constraints = this.inputProps.constraints;
			if (constraints) {
				this._minInputProps.inputProps.constraints = constraints;
				this._maxInputProps.inputProps.constraints = constraints;
			}

			if (this.inputProps.minInputProps) {
				lang.mixin(this._minInputProps.inputProps, this.inputProps.minInputProps);
			}
			if (this.inputProps.maxInputProps) {
				lang.mixin(this._maxInputProps.inputProps, this.inputProps.maxInputProps);
			}
		}
	});
});
+13 −5
Original line number Diff line number Diff line
@@ -111,7 +111,8 @@ define([
				props.notIcon = true;
			}

			this['_' + key + 'Widget'] = new declare([def, _Dependence])(props).placeAt(this.containerInput);
			var Definition = declare([def, _Dependence]);
			this['_' + key + 'Widget'] = new Definition(props).placeAt(this.containerInput);

			this._publish(this['_' + key + 'Widget'].getChannel('SHOW'), {
				node: this.containerInput
@@ -123,14 +124,21 @@ define([

		_subValueChangedWidget: function(key, res) {

			if (res.isValid)
			if (!this._currentValues) {
				this._currentValues = {};
			}

			if (res.isValid) {
				this._emitEvt('IS_VALID', {
					propertyName: this.propertyName
				});
			else {
				this._currentValues[key] = res.value;
			} else {
				this._isValid = false;
				this._emitChanged({});
				delete this._currentValues[key];
			}

			this._emitChanged(this._currentValues);
		},

		_enable: function() {
+1 −1

File changed.

Contains only whitespace changes.

+1 −1

File changed.

Contains only whitespace changes.

Loading