[Mapbender-commits] r6268 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jun 14 09:38:02 EDT 2010


Author: christoph
Date: 2010-06-14 13:38:02 +0000 (Mon, 14 Jun 2010)
New Revision: 6268

Added:
   trunk/mapbender/http/plugins/mb_selectScale.js
Log:


Added: trunk/mapbender/http/plugins/mb_selectScale.js
===================================================================
--- trunk/mapbender/http/plugins/mb_selectScale.js	                        (rev 0)
+++ trunk/mapbender/http/plugins/mb_selectScale.js	2010-06-14 13:38:02 UTC (rev 6268)
@@ -0,0 +1,32 @@
+var $selectScale = $(this);
+
+var SelectScaleApi = function () {
+	var that = this;
+	
+	this.set = function (scale) {
+		options.$target.mapbender(function () {
+			this.repaintScale(null, null, scale);
+		});
+	};
+
+	var init = function () {
+		$selectScale.change(function () {
+			that.set(this.value);
+		});
+		
+		Mapbender.events.init.register(function () {
+			options.$target.mapbender(function () {
+				var map = this;
+				map.events.afterMapRequest.register(function () {
+					var scale = map.getScale();
+					$selectScale.children("option").eq(0)
+						.text("1 : " + scale)
+						.attr("selected", "selected");
+				});
+			});
+		});
+	};
+	init();
+};
+
+$selectScale.mapbender(new SelectScaleApi());



More information about the Mapbender_commits mailing list