From 411cfed6cc17298e4d9cef77a96bacb570b6f139 Mon Sep 17 00:00:00 2001 From: Sanjay Bhangar Date: Sat, 9 Aug 2025 17:23:30 +0200 Subject: [PATCH] fix getting wrong coordinates for places in list --- source/UI/js/Map/Map.js | 8 +------- source/UI/js/Map/MapMarker.js | 2 -- source/UI/js/Map/MapPlace.js | 8 ++++++-- source/UI/js/Map/MapRectangle.js | 7 ------- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/source/UI/js/Map/Map.js b/source/UI/js/Map/Map.js index 1a3d785d..1fd3491c 100644 --- a/source/UI/js/Map/Map.js +++ b/source/UI/js/Map/Map.js @@ -123,13 +123,9 @@ Ox.Map = function(options, self) { that.resizeMap(); }, places: function() { - console.log('MAP OPTIONS.PLACES UPDATE - Processing places array, count:', self.options.places ? self.options.places.length : 0); - console.trace('MAP OPTIONS.PLACES UPDATE - Stack trace'); - // Prevent rebuilding places while editing to avoid breaking references var editingPlace = getSelectedPlace(); if (editingPlace && editingPlace.editing) { - console.log('MAP OPTIONS.PLACES UPDATE - Skipping rebuild because place is being edited:', editingPlace.id); return; } @@ -258,8 +254,6 @@ Ox.Map = function(options, self) { }); //FIXME: duplicated in update - console.log('MAP INIT - Processing places array (duplicated code), count:', self.options.places ? self.options.places.length : 0); - console.trace('MAP INIT - Stack trace'); if (Ox.isArray(self.options.places)) { self.options.places.forEach(function(place) { if (Ox.isUndefined(place.id)) { @@ -1741,7 +1735,7 @@ Ox.Map = function(options, self) { Ox.Log('Map', 'Map.value', id, key, value); var place = getPlaceById(id); if (!place) { - console.error('Map.value - place not found for id:', id, 'Available places:', Object.keys(self.options.places || {})); + console.error('Map.value - place not found for id:', id); return; } place.options(key, value); diff --git a/source/UI/js/Map/MapMarker.js b/source/UI/js/Map/MapMarker.js index caec8001..b9eabc1f 100644 --- a/source/UI/js/Map/MapMarker.js +++ b/source/UI/js/Map/MapMarker.js @@ -306,9 +306,7 @@ Ox.MapMarker = function(options) { () -> edit marker, returns MapMarker @*/ that.edit = function() { - console.log('MAPMARKER.EDIT - before setOptions, marker on map?', that.marker._map !== null); setOptions(); - console.log('MAPMARKER.EDIT - after setOptions, marker on map?', that.marker._map !== null); that.marker.on('dragstart', dragstart); that.marker.on('drag', drag); that.marker.on('dragend', dragend); diff --git a/source/UI/js/Map/MapPlace.js b/source/UI/js/Map/MapPlace.js index 94140084..e347d886 100644 --- a/source/UI/js/Map/MapPlace.js +++ b/source/UI/js/Map/MapPlace.js @@ -39,7 +39,12 @@ Ox.MapPlace = function(options) { var that = this; Ox.forEach(options, function(val, key) { - that[key] = val; + // Ensure coordinate values are independent copies, not shared references + if (key === 'south' || key === 'north' || key === 'east' || key === 'west') { + that[key] = parseFloat(val) || 0; + } else { + that[key] = val; + } }); // Ensure editable is set for existing places that might not have this property @@ -47,7 +52,6 @@ Ox.MapPlace = function(options) { that.editable = true; } - console.log('MAPPLACE CONSTRUCTOR - Creating place with ID:', that.id, 'name:', that.name); update(); diff --git a/source/UI/js/Map/MapRectangle.js b/source/UI/js/Map/MapRectangle.js index 8a7e7adf..387f0d89 100644 --- a/source/UI/js/Map/MapRectangle.js +++ b/source/UI/js/Map/MapRectangle.js @@ -225,18 +225,11 @@ Ox.MapRectangle = function(options) { setOptions(); function click(e) { - console.log('RECTANGLE CLICK DEBUG:'); - console.log('- map.editable:', that.map.options('editable')); - console.log('- place.editable:', that.place.editable); - console.log('- place.editing:', that.place.editing); - console.log('- place object:', that.place); - if ( that.map.options('editable') && that.place.editable && !that.place.editing ) { - console.log('- Calling place.edit()'); that.place.edit(); } else if (that.map.getKey() == 'meta') { that.place.submit();