r61703 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61702‎ | r61703 | r61704 >
Date:00:15, 30 January 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.5.3.
* Small js change
Modified paths:
  • /trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFunctions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/OpenStreetMap/SM_OSMFunctions.js
@@ -15,12 +15,12 @@
1616
1717 // Show a starting marker only if marker coordinates are provided
1818 if (mapParams.lat != null && mapParams.lon != null) {
19 - mapParams.markers = [(getOSMMarkerData(mapParams.lon, mapParams.lat, '', ''))];
 19+ mapParams.markers = [(getOSMMarkerData(mapParams.lon, mapParams.lat, '', '', ''))];
2020 }
2121
2222 // Click event handler for updating the location of the marker
2323 // TODO / FIXME: This will probably cause problems when used for multiple maps on one page.
24 - OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
 24+ OpenLayers.Control.ClickHandler = OpenLayers.Class(OpenLayers.Control, {
2525 defaultHandlerOptions: {
2626 'single': true,
2727 'double': false,
@@ -44,14 +44,21 @@
4545 },
4646
4747 trigger: function(e) {
48 - replaceMarker(mapName, map.getLonLatFromViewPortPx(e.xy));
49 - document.getElementById(locationFieldName).value = convertLatToDMS(map.getLonLatFromViewPortPx(e.xy).lat)+', '+convertLngToDMS(map.getLonLatFromViewPortPx(e.xy).lon);
 48+ var lonlat = this.getLonLatFromViewPortPx(e.xy);
 49+
 50+ replaceMarker(mapName, lonlat);
 51+
 52+ var proj = new OpenLayers.Projection("EPSG:4326");
 53+ lonlat.transform(map.getProjectionObject(), proj);
 54+
 55+ document.getElementById(locationFieldName).value = convertLatToDMS(lonlat.lat)+', '+convertLngToDMS(lonlat.lon);
5056 }
5157
5258 });
5359
54 - var clickHanler = new OpenLayers.Control.Click();
55 - mapParams.initializedContols = [clickHanler];
 60+ var clickHanler = new OpenLayers.Control.ClickHandler();
 61+ mapParams.controls.push(clickHanler);
 62+ mapParams.initializedContols = [];
5663
5764 var map = new slippymap_map(mapName, mapParams);
5865
@@ -67,11 +74,12 @@
6875 * @return
6976 */
7077 function replaceMarker(mapName, newLocation) {
71 - var map = OSMMaps[mapName];
 78+ var map = slippymaps[mapName];
 79+
7280 var markerLayer = map.getLayer('markerLayer');
7381
7482 removeOSMMarkers(markerLayer);
75 - markerLayer.addMarker(getOSMMarker(markerLayer, getOSMMarkerData(newLocation.lon, newLocation.lat, '', ''), map.getProjectionObject()));
 83+ markerLayer.addMarker(getOSMMarker(markerLayer, getOSMMarkerData(newLocation.lon, newLocation.lat, '', '', ''), map.getProjectionObject()));
7684
7785 map.panTo(newLocation);
7886 }

Status & tagging log