From 8b2bab9d515c4a041ed92a6127cd26a7a1670d4d Mon Sep 17 00:00:00 2001 From: ahocevar Date: Sat, 2 Jun 2012 22:18:49 +0200 Subject: [PATCH] Improvements for Android: no buggy tile transitions, no flicker when tapping. --- examples/mobile-wmts-vienna.css | 3 +++ examples/mobile-wmts-vienna.js | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/examples/mobile-wmts-vienna.css b/examples/mobile-wmts-vienna.css index b728003a31..ac3d1cb5e6 100644 --- a/examples/mobile-wmts-vienna.css +++ b/examples/mobile-wmts-vienna.css @@ -5,6 +5,9 @@ html, body, #map { } #map { cursor: move; + background-color: #CCCCCC; + /* no highlighting of the map area when tapping the map on touch devices */ + -webkit-tap-highlight-color: transparent; } #title, #tags, #shortdesc { display: none; diff --git a/examples/mobile-wmts-vienna.js b/examples/mobile-wmts-vienna.js index 91d3a7105d..04cd9b4148 100644 --- a/examples/mobile-wmts-vienna.js +++ b/examples/mobile-wmts-vienna.js @@ -130,6 +130,17 @@ var map; // Vector layer for the location cross and circle var vector = new OpenLayers.Layer.Vector("Vector Layer"); + // Defaults for the WMTS layers + var defaults = { + requestEncoding: "REST", + matrixSet: "google3857", + attribution: 'Datenquelle: Stadt Wien - data.wien.gv.at' + }; + // No fade transitions on Android 4, because they are buggy + if (/Android 4\.0.*Safari\/.*/.test(navigator.userAgent)) { + defaults.className = "nofade"; + } + // The WMTS layers we're going to add var fmzk, aerial, labels; @@ -149,11 +160,6 @@ var map; url: "http://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml", success: function(request) { var format = new OpenLayers.Format.WMTSCapabilities(); - var defaults = { - requestEncoding: "REST", - matrixSet: "google3857", - attribution: 'Datenquelle: Stadt Wien - data.wien.gv.at' - }; var doc = request.responseText, caps = format.read(doc); fmzk = format.createLayer(caps, OpenLayers.Util.applyDefaults( @@ -177,12 +183,7 @@ var map; // and create layers" block above. /* var extent = new OpenLayers.Bounds(1799448.394855, 6124949.74777, 1848250.442089, 6162571.828177); - var defaults = { - requestEncoding: "REST", - matrixSet: "google3857", - tileFullExtent: extent, - attribution: 'Datenquelle: Stadt Wien - data.wien.gv.at' - }; + defaults.tileFullExtent = extent; fmzk = new OpenLayers.Layer.WMTS(OpenLayers.Util.applyDefaults({ url: "http://maps.wien.gv.at/wmts/fmzk/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.jpeg", layer: "fmzk",