forked from 0x2620/oxjs
in annotation panel, make links to define/edit places/events work (fixes #561)
This commit is contained in:
parent
202d11177b
commit
db6f68681a
3 changed files with 57 additions and 39 deletions
|
|
@ -1141,47 +1141,53 @@ Ox.Map = function(options, self) {
|
|||
function selectPlace(id, zoom) {
|
||||
Ox.print('SELECT PLACE', id)
|
||||
// id can be null (deselect)
|
||||
var place,
|
||||
selected = getSelectedMarker();
|
||||
Ox.Log('Map', 'Ox.Map selectPlace()', id, selected);
|
||||
if (id != selected) {
|
||||
place = getPlaceById(selected);
|
||||
place && place.deselect();
|
||||
if (id !== null) {
|
||||
place = getPlaceById(id);
|
||||
if (place) {
|
||||
select();
|
||||
} else {
|
||||
// async && place doesn't exist yet
|
||||
self.options.places({
|
||||
keys: self.placeKeys,
|
||||
query: {
|
||||
conditions: [
|
||||
{key: 'id', value: id, operator: '=='}
|
||||
],
|
||||
operator: '&'
|
||||
}
|
||||
}, function(result) {
|
||||
if (result.data.items.length) {
|
||||
place = new Ox.MapPlace(Ox.extend({
|
||||
map: that
|
||||
}, result.data.items[0])).add();
|
||||
self.places.push(place);
|
||||
select();
|
||||
if (zoom) {
|
||||
zoomToPlace();
|
||||
} else {
|
||||
panToPlace();
|
||||
var place, selected = getSelectedMarker();
|
||||
if (!self.loaded) {
|
||||
setTimeout(function() {
|
||||
selectPlace(id, zoom)
|
||||
}, 1000);
|
||||
} else {
|
||||
Ox.Log('Map', 'Ox.Map selectPlace()', id, selected);
|
||||
if (id != selected) {
|
||||
place = getPlaceById(selected);
|
||||
place && place.deselect();
|
||||
if (id !== null) {
|
||||
place = getPlaceById(id);
|
||||
if (place) {
|
||||
select();
|
||||
} else {
|
||||
// async && place doesn't exist yet
|
||||
self.options.places({
|
||||
keys: self.placeKeys,
|
||||
query: {
|
||||
conditions: [
|
||||
{key: 'id', value: id, operator: '=='}
|
||||
],
|
||||
operator: '&'
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function(result) {
|
||||
if (result.data.items.length) {
|
||||
place = new Ox.MapPlace(Ox.extend({
|
||||
map: that
|
||||
}, result.data.items[0])).add();
|
||||
self.places.push(place);
|
||||
select();
|
||||
if (zoom) {
|
||||
zoomToPlace();
|
||||
} else {
|
||||
panToPlace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
place = null;
|
||||
select();
|
||||
}
|
||||
} else {
|
||||
place = null;
|
||||
select();
|
||||
}
|
||||
}
|
||||
function select() {
|
||||
Ox.print('select...', place)
|
||||
place && place.select();
|
||||
self.options.selected = id;
|
||||
setPlaceControls(place);
|
||||
|
|
@ -1418,7 +1424,7 @@ Ox.Map = function(options, self) {
|
|||
}
|
||||
}
|
||||
} else if (key == 'selected') {
|
||||
self.loaded && selectPlace(value || null);
|
||||
selectPlace(value || null);
|
||||
} else if (key == 'type') {
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue