[OpenLayers-Commits] r11383 -
sandbox/camptocamp/mobile/openlayers/examples
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Feb 24 04:23:59 EST 2011
Author: fredj
Date: 2011-02-24 01:23:59 -0800 (Thu, 24 Feb 2011)
New Revision: 11383
Modified:
sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js
Log:
addLayerToList function, listen to addlayer event from map
Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js 2011-02-24 09:08:00 UTC (rev 11382)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js 2011-02-24 09:23:59 UTC (rev 11383)
@@ -81,14 +81,22 @@
});
$.each(map.layers, function() {
- $('<a />', {
- text: this.name,
- href: "",
- "data-role": "button"
- })
- .appendTo('#layerslist')
- .click(function() {
- $(this).find('.ui-icon-check').toggleClass('ui-icon');
- });
+ addLayerToList(this);
});
+
+ map.events.register("addlayer", this, function(e) {
+ addLayerToList(e.layer);
+ });
});
+
+function addLayerToList(layer) {
+ $('<a />', {
+ text: layer.name,
+ href: "",
+ "data-role": "button"
+ })
+ .appendTo('#layerslist')
+ .click(function() {
+ $(layer).find('.ui-icon-check').toggleClass('ui-icon');
+ });
+}
More information about the Commits
mailing list