fix bugs in Ox.MapEditor

This commit is contained in:
rlx 2012-06-30 15:01:43 +00:00
parent ee23db5876
commit 146078e7ce

View file

@ -360,7 +360,9 @@ Ox.MapEditor = function(options, self) {
that.triggerEvent('loadlist');
},
open: openItem,
select: selectItem
select: function(data) {
selectItem(data);
}
});
// if loaded with selection, set map and form
@ -419,7 +421,7 @@ Ox.MapEditor = function(options, self) {
self.$map.resizeMap(); // fixme: don't need event
},
*/
selectplace: selectPlace
select: selectPlace
});
self.$placeTitlebar = Ox.Bar({
@ -994,12 +996,12 @@ Ox.MapEditor = function(options, self) {
function selectItem(data, place) {
// Select item in list
Ox.Log('Map', 'selectItem', data, place);
var isUndefined, selectedPlace;
self.options.selected = data.ids.length ? data.ids[0] : '';
place = place || (
self.options.selected
? self.$list.value(self.options.selected) : {}
? self.$list.value(self.options.selected)
: {}
);
isUndefined = !!self.options.selected && !place.type;
selectedPlace = self.options.selected && !isUndefined
@ -1035,7 +1037,6 @@ Ox.MapEditor = function(options, self) {
function selectPlace(place) {
// Select place on map
Ox.Log('Map', 'selectPlace', place)
var isResult = !!place.id && place.id[0] == '_',
isUndefined = !!self.options.selected
&& !self.$list.value(self.options.selected, 'type');