[OpenLayers-Commits] r11385 -
sandbox/camptocamp/mobile/openlayers/examples
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Feb 24 04:36:06 EST 2011
Author: pgiraud
Date: 2011-02-24 01:36:06 -0800 (Thu, 24 Feb 2011)
New Revision: 11385
Modified:
sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html
sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js
Log:
Second round for a layerswitcher, now bound to the map
Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html 2011-02-24 09:26:40 UTC (rev 11384)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html 2011-02-24 09:36:06 UTC (rev 11385)
@@ -52,6 +52,12 @@
#title, #tags, #shortdesc {
display: none;
}
+ .ui-icon-check {
+ opacity: 0.3;
+ }
+ .checked .ui-icon-check {
+ opacity: 1;
+ }
</style>
</head>
<body>
Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js 2011-02-24 09:26:40 UTC (rev 11384)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.js 2011-02-24 09:36:06 UTC (rev 11385)
@@ -90,13 +90,25 @@
});
function addLayerToList(layer) {
- $('<a />', {
+ var button = $('<a />', {
text: layer.name,
href: "",
- "data-role": "button"
+ "data-role": "button",
+ "data-icon": "check",
+ "class": layer.visibility ? "checked" : ""
})
- .appendTo('#layerslist')
- .click(function() {
- $(layer).find('.ui-icon-check').toggleClass('ui-icon');
+ .appendTo('#layerslist')
+ .click(function() {
+ $.mobile.changePage('mappage');
+ if (layer.isBaseLayer && !layer.getVisibility()) {
+ layer.map.setBaseLayer(layer);
+ } else {
+ layer.setVisibility(!layer.visibility);
+ }
+ });
+ layer.events.on({
+ 'visibilitychanged': function() {
+ $(button).toggleClass('checked');
+ }
});
}
More information about the Commits
mailing list