Commit ed485983 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Actualiza y adapta dependencia leaflet-measure

A partir de leaflet-measure v3, el uso de idiomas ha cambiado. A
diferencia de como cuando se colaboró con el desarrollo del plugin
implementando el sistema de localización, donde se seleccionaba el
idioma mediante parámetro, ahora la compilación genera un fichero
independiente por cada idioma. Esto hace necesario cargar dinámicamente
el plugin, en función del idioma que haya elegido el usuario, por lo que
se adapta la compilación y la manera de importarlo.
parent 5f3f2321
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3,8 +3,8 @@ module.exports = function(grunt) {
	var directoriesToDelete = [
		'alertify', 'awesome-markers', 'cbtree', 'd3Tip', 'dijit', 'dojo', 'dojox', 'deepmerge', 'dropzone',
		'handlebars', 'L-areaselect', 'L-coordinates', 'L-draw', 'L-miniMap', 'L-navBar', 'leaflet',
		'leaflet-measure', 'leaflet-nontiledlayer', 'mediatorjs', 'moment', 'uuid', 'proj4js', 'pruneCluster',
		'put-selector', 'redmic', 'RWidgets', 'sockjs', 'stomp-websocket', 'templates', 'tv4', 'wicket'
		'leaflet-nontiledlayer', 'mediatorjs', 'moment', 'uuid', 'proj4js', 'pruneCluster', 'put-selector',
		'redmic', 'RWidgets', 'sockjs', 'stomp-websocket', 'templates', 'tv4', 'wicket'
	];

	var recursiveDirectoriesToDelete = [
+1 −1
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@ dojoConfig = {
	},{
		name: 'd3',
		location: '../d3'
	},{
		name: 'leaflet-measure',
		location: '../leaflet-measure'
	}],

	map: {
+32 −14
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ define([
	'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/_base/kernel'
	, 'dojo/Deferred'
	, 'dojo/dom-class'
	, 'dojo/on'
	, 'leaflet/leaflet'
@@ -10,11 +11,11 @@ define([
	, 'awesome-markers/leaflet.awesome-markers.min'
	, 'L-coordinates/Leaflet.Coordinates-0.1.5.min'
	, 'L-navBar/Leaflet.NavBar'
	, 'leaflet-measure/leaflet-measure.min'
], function(
	declare
	, lang
	, kernel
	, Deferred
	, domClass
	, on
	, L
@@ -55,9 +56,14 @@ define([
			this._addLayersSelector();
			this._addCoordinatesViewer();
			this._addNavBar();
			this._addMeasureTools();

			var measureToolsDfd = new Deferred();
			measureToolsDfd.then(lang.hitch(this, function() {

				this._addMiniMap();
				this._addScaleBar();
			}));
			this._addMeasureTools(measureToolsDfd);
		},

		_addLayersSelector: function() {
@@ -132,31 +138,43 @@ define([
			this.miniMapInstance = miniMap;
		},

		_addMeasureTools: function() {
		_addMeasureTools: function(dfd) {

			if (!this.measureTools) {
				dfd.resolve();
				return;
			}

			var measureConfig = {
					primaryLengthUnit: 'meters',
					secondaryLengthUnit: 'kilometers',
					primaryAreaUnit: 'sqmeters',
					secondaryAreaUnit: 'hectares',
					localization: kernel.locale
				},
				measure = new L.Control.Measure(measureConfig);
			var measureToolsPath = 'leaflet-measure/leaflet-measure.' + kernel.locale;

			measure.addTo(this.map);
			require([measureToolsPath], lang.hitch(this, this._onMeasureToolsLoaded, dfd));

			this.map.on('measurestart', lang.hitch(this, function() {

				this._clickDisabled = true;
			}));

			this.map.on('measurefinish', lang.hitch(this, function() {

				this._clickDisabled = false;
			}));
		},

		_onMeasureToolsLoaded: function(dfd) {

			var measure = new L.Control.Measure({
				position: 'topright',
				primaryLengthUnit: 'meters',
				secondaryLengthUnit: 'kilometers',
				primaryAreaUnit: 'sqmeters',
				secondaryAreaUnit: 'hectares'
			});

			measure.addTo(this.map);

			dfd.resolve();
		},

		_addScaleBar: function() {

			if (!this.scaleBar) {
Compare b13a6806 to 89b2623b
Original line number Diff line number Diff line
Subproject commit b13a6806f797524fbd3f195b29afe4766e46df23
Subproject commit 89b2623b64b73b6031e6ceca3794ebdabc1bdd99
Loading