From bfd94445f14452585c497a538584374a69cbd719 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Fri, 11 Aug 2017 11:00:33 -0600 Subject: [PATCH] Remove broken wrapX handling from ol.Graticule --- examples/graticule.js | 5 ++++- src/ol/graticule.js | 17 ----------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/examples/graticule.js b/examples/graticule.js index 1cb67c310a..760212c2c7 100644 --- a/examples/graticule.js +++ b/examples/graticule.js @@ -10,12 +10,15 @@ goog.require('ol.style.Stroke'); var map = new ol.Map({ layers: [ new ol.layer.Tile({ - source: new ol.source.OSM() + source: new ol.source.OSM({ + wrapX: false + }) }) ], target: 'map', view: new ol.View({ center: ol.proj.fromLonLat([4.8, 47.75]), + extent: ol.proj.get('EPSG:3857').getExtent(), zoom: 5 }) }); diff --git a/src/ol/graticule.js b/src/ol/graticule.js index a371528f2c..38bc387a3b 100644 --- a/src/ol/graticule.js +++ b/src/ol/graticule.js @@ -560,23 +560,6 @@ ol.Graticule.prototype.handlePostCompose_ = function(e) { this.updateProjectionInfo_(projection); } - //Fix the extent if wrapped. - //(note: this is the same extent as vectorContext.extent_) - var offsetX = 0; - if (projection.canWrapX()) { - var projectionExtent = projection.getExtent(); - var worldWidth = ol.extent.getWidth(projectionExtent); - var x = frameState.focus[0]; - if (x < projectionExtent[0] || x > projectionExtent[2]) { - var worldsAway = Math.ceil((projectionExtent[0] - x) / worldWidth); - offsetX = worldWidth * worldsAway; - extent = [ - extent[0] + offsetX, extent[1], - extent[2] + offsetX, extent[3] - ]; - } - } - this.createGraticule_(extent, center, resolution, squaredTolerance); // Draw the lines