Skip to content

Commit

Permalink
Fix for W.map.getExtent change
Browse files Browse the repository at this point in the history
  • Loading branch information
mapomatic committed Aug 18, 2024
1 parent 68d79f9 commit b26b512
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions WME-Place-Harmonizer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name WME Place Harmonizer Beta
// @namespace WazeUSA
// @version 2024.08.08.000
// @version 2024.08.18.000
// @description Harmonizes, formats, and locks a selected place
// @author WMEPH Development Group
// @include /^https:\/\/(www|beta)\.waze\.com\/(?!user\/)(.{2,6}\/)?editor\/?.*$/
Expand Down Expand Up @@ -8213,6 +8213,15 @@ id="WMEPH-zipAltNameAdd"autocomplete="off" style="font-size:0.85em;width:65px;pa
});
}

function getOLMapExtent() {
let extent = W.map.getExtent();
if (Array.isArray(extent)) {
extent = new OpenLayers.Bounds(extent);
extent.transform('EPSG:4326', 'EPSG:3857');
}
return extent;
}

function drawGooglePlacePoint(uuid) {
if (!uuid) return;
const link = _googleResults[uuid];
Expand All @@ -8222,7 +8231,7 @@ id="WMEPH-zipAltNameAdd"autocomplete="off" style="font-size:0.85em;width:65px;pa
poiPt.transform(W.Config.map.projection.remote, W.map.getProjectionObject().projCode);
const placeGeom = W.selectionManager.getSelectedDataModelObjects()[0].getOLGeometry().getCentroid();
const placePt = new OpenLayers.Geometry.Point(placeGeom.x, placeGeom.y);
const ext = W.map.getExtent();
const ext = getOLMapExtent();
const lsBounds = new OpenLayers.Geometry.LineString([
new OpenLayers.Geometry.Point(ext.left, ext.bottom),
new OpenLayers.Geometry.Point(ext.left, ext.top),
Expand Down Expand Up @@ -8864,7 +8873,7 @@ id="WMEPH-zipAltNameAdd"autocomplete="off" style="font-size:0.85em;width:65px;pa
// Remove any previous search labels
_dupeLayer.destroyFeatures();

const mapExtent = W.map.getExtent();
const mapExtent = getOLMapExtent();
const padFrac = 0.15; // how much to pad the zoomed window

// generic terms to skip if it's all that remains after stripping numbers
Expand Down

0 comments on commit b26b512

Please sign in to comment.