From 7eb73dd4fbc231e3fcc3323d03b2db2e28c9d770 Mon Sep 17 00:00:00 2001
From: rlx <0x0073@0x2620.org>
Date: Sat, 8 Oct 2011 09:58:31 +0000
Subject: [PATCH] fix a bug where selecting a not-yet-loaded place on a list
map would not pan but zoom to that place
---
demos/form2/js/form.js | 4 +---
source/Ox.UI/js/Map/Ox.Map.js | 10 +++++++---
source/Ox.UI/js/Map/Ox.MapMarker.js | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/demos/form2/js/form.js b/demos/form2/js/form.js
index b4fe972f..93bbcb7f 100644
--- a/demos/form2/js/form.js
+++ b/demos/form2/js/form.js
@@ -1,5 +1,4 @@
-Ox.load('UI', {debug: true}, function() {
-Ox.load('Geo', function() {
+Ox.load({UI: {}, Geo:{}}, function() {
var $body = $("body"),
$panel = $("
")
@@ -1202,5 +1201,4 @@ Ox.load('Geo', function() {
})
.appendTo($panel);
-});
});
\ No newline at end of file
diff --git a/source/Ox.UI/js/Map/Ox.Map.js b/source/Ox.UI/js/Map/Ox.Map.js
index cb7e8a06..306caa6e 100644
--- a/source/Ox.UI/js/Map/Ox.Map.js
+++ b/source/Ox.UI/js/Map/Ox.Map.js
@@ -769,7 +769,7 @@ Ox.Map = function(options, self) {
self.$findInput.options({value: self.options.find})
.triggerEvent('submit', {value: self.options.find});
} else if (self.options.selected) {
- selectPlace(self.options.selected);
+ selectPlace(self.options.selected, true);
} else {
mapBounds && self.map.fitBounds(mapBounds);
///*
@@ -1058,7 +1058,7 @@ Ox.Map = function(options, self) {
*/
}
- function selectPlace(id) {
+ function selectPlace(id, zoom) {
// id can be null (deselect)
var place,
selected = getSelectedMarker();
@@ -1087,7 +1087,11 @@ Ox.Map = function(options, self) {
}, result.data.items[0])).add();
self.places.push(place);
select();
- zoomToPlace();
+ if (zoom) {
+ zoomToPlace();
+ } else {
+ panToPlace();
+ }
}
});
}
diff --git a/source/Ox.UI/js/Map/Ox.MapMarker.js b/source/Ox.UI/js/Map/Ox.MapMarker.js
index 7cf75dc9..3bfcb3a9 100644
--- a/source/Ox.UI/js/Map/Ox.MapMarker.js
+++ b/source/Ox.UI/js/Map/Ox.MapMarker.js
@@ -185,7 +185,7 @@ Ox.MapMarker = function(options) {
// workaround to prevent marker from appearing twice
// after setting draggable from true to false (google maps bug)
var fix = that.marker.getDraggable() && !that.place.editing;
- Ox.print('setOptions, that.map: ', that.map)
+ //Ox.print('setOptions, that.map: ', that.map)
if (that.map.options('showTypes')) {
that.color = typeColor[that.place.type];
that.size = 8;