in manage places, make south/west/north/east editable directly (fixes #411)
This commit is contained in:
parent
33ddaf8d9a
commit
8851a9c454
3 changed files with 15 additions and 50 deletions
|
@ -509,6 +509,7 @@ Ox.ListMap = function(options, self) {
|
||||||
).toLowerCase(),
|
).toLowerCase(),
|
||||||
max = ['Latitude', 'South', 'North'].indexOf(v) > -1 ? Ox.MAX_LATITUDE : 180;
|
max = ['Latitude', 'South', 'North'].indexOf(v) > -1 ? Ox.MAX_LATITUDE : 180;
|
||||||
return Ox.Input({
|
return Ox.Input({
|
||||||
|
changeOnKeypress: true,
|
||||||
decimals: 8,
|
decimals: 8,
|
||||||
disabled: ['lat', 'lng'].indexOf(id) > -1,
|
disabled: ['lat', 'lng'].indexOf(id) > -1,
|
||||||
id: id,
|
id: id,
|
||||||
|
@ -532,6 +533,7 @@ Ox.ListMap = function(options, self) {
|
||||||
.hide()
|
.hide()
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
change: function(data) {
|
change: function(data) {
|
||||||
|
Ox.print('CHANGE', data)
|
||||||
var isResult = self.selectedPlace[0] == '_';
|
var isResult = self.selectedPlace[0] == '_';
|
||||||
if (data.id == 'name') {
|
if (data.id == 'name') {
|
||||||
!isResult && self.$list.value(self.selectedPlace, 'name', data.data.value);
|
!isResult && self.$list.value(self.selectedPlace, 'name', data.data.value);
|
||||||
|
@ -573,14 +575,14 @@ Ox.ListMap = function(options, self) {
|
||||||
if (!self.isAsync) {
|
if (!self.isAsync) {
|
||||||
// ...
|
// ...
|
||||||
} else {
|
} else {
|
||||||
!isResult && editPlace(['type'])
|
!isResult && editPlace(['type']);
|
||||||
}
|
}
|
||||||
self.$map.value(self.selectedPlace, 'type', data.data.value);
|
self.$map.value(self.selectedPlace, 'type', data.data.value);
|
||||||
} else { // lat, lng, south, west, north, east
|
} else { // south, west, north, east
|
||||||
if (!self.isAsync) {
|
if (!self.isAsync) {
|
||||||
// ...
|
// ...
|
||||||
} else {
|
} else {
|
||||||
!isResult && editPlace([data.id])
|
!isResult && editPlace([data.id]);
|
||||||
}
|
}
|
||||||
self.$map.value(self.selectedPlace, data.id, parseFloat(data.data.value));
|
self.$map.value(self.selectedPlace, data.id, parseFloat(data.data.value));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1448,14 +1448,6 @@ Ox.Map = function(options, self) {
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
that.editPlace = function(data) {
|
|
||||||
var place = getPlaceById(self.options.selected);
|
|
||||||
place.$marker.options(data);
|
|
||||||
return that;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
that.findPlace = function(name, callback) {
|
that.findPlace = function(name, callback) {
|
||||||
getPlaceByName(name, function(place) {
|
getPlaceByName(name, function(place) {
|
||||||
if (place) {
|
if (place) {
|
||||||
|
@ -1466,10 +1458,12 @@ Ox.Map = function(options, self) {
|
||||||
}
|
}
|
||||||
callback(place);
|
callback(place);
|
||||||
});
|
});
|
||||||
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.newPlace = function(place) {
|
that.newPlace = function(place) {
|
||||||
addPlaceToMap(place);
|
addPlaceToMap(place);
|
||||||
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.panToPlace = function() {
|
that.panToPlace = function() {
|
||||||
|
@ -1484,41 +1478,8 @@ Ox.Map = function(options, self) {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.resizeMap = function() {
|
that.resizeMap = function() {
|
||||||
|
// keep center on resize has been commented out
|
||||||
/*
|
// var center = self.map.getCenter();
|
||||||
Ox.Log('Map', 'resizeMap', self.options.width, self.options.height);
|
|
||||||
var center = self.map.getCenter();
|
|
||||||
self.mapHeight = getMapHeight();
|
|
||||||
self.minZoom = getMinZoom();
|
|
||||||
that.css({
|
|
||||||
height: self.options.height + 'px',
|
|
||||||
width: self.options.width + 'px'
|
|
||||||
});
|
|
||||||
self.$map.css({
|
|
||||||
height: self.mapHeight + 'px',
|
|
||||||
width: self.options.width + 'px'
|
|
||||||
});
|
|
||||||
google.maps.event.trigger(self.map, 'resize');
|
|
||||||
self.map.setCenter(center);
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Ox.Log('Map', 'Ox.Map.resizeMap()');
|
|
||||||
var center = self.map.getCenter();
|
|
||||||
self.options.height = that.$element.height();
|
|
||||||
self.options.width = that.$element.width();
|
|
||||||
Ox.Log('Map', self.options.width, self.options.height)
|
|
||||||
self.$map.css({
|
|
||||||
height: self.mapHeight + 'px',
|
|
||||||
width: self.options.width + 'px'
|
|
||||||
});
|
|
||||||
google.maps.event.trigger(self.map, 'resize');
|
|
||||||
self.map.setCenter(center);
|
|
||||||
self.options.zoombar && self.$zoomInput.options({
|
|
||||||
size: self.options.width
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
self.options.height = that.$element.height();
|
self.options.height = that.$element.height();
|
||||||
self.options.width = that.$element.width();
|
self.options.width = that.$element.width();
|
||||||
// check if map has initialized
|
// check if map has initialized
|
||||||
|
@ -1536,15 +1497,17 @@ Ox.Map = function(options, self) {
|
||||||
size: self.options.width
|
size: self.options.width
|
||||||
});
|
});
|
||||||
updateFormElements();
|
updateFormElements();
|
||||||
Ox.print('triggering google maps resize event, height', self.options.height)
|
Ox.Log('Map', 'triggering google maps resize event, height', self.options.height)
|
||||||
google.maps.event.trigger(self.map, 'resize');
|
google.maps.event.trigger(self.map, 'resize');
|
||||||
|
// self.map.setCenter(center);
|
||||||
}
|
}
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
|
|
||||||
that.value = function(id, key, value) {
|
that.value = function(id, key, value) {
|
||||||
// fixme: should be like the corresponding List/TextList/etc value function
|
// fixme: should be like the corresponding List/TextList/etc value function
|
||||||
Ox.print('Map', 'Map.value', id, key, value)
|
Ox.print('Map', 'Map.value', id, key, value);
|
||||||
|
getPlaceById(id).options(key, value);
|
||||||
if (id == self.options.selected) {
|
if (id == self.options.selected) {
|
||||||
if (key == 'name') {
|
if (key == 'name') {
|
||||||
self.$placeControls.name.options({title: value});
|
self.$placeControls.name.options({title: value});
|
||||||
|
@ -1556,7 +1519,7 @@ Ox.Map = function(options, self) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getPlaceById(id).options(key, value);
|
return that;
|
||||||
}
|
}
|
||||||
|
|
||||||
that.zoomToPlace = function() {
|
that.zoomToPlace = function() {
|
||||||
|
|
|
@ -125,7 +125,7 @@ Ox.MapMarker = function(options) {
|
||||||
that.place.update();
|
that.place.update();
|
||||||
that.marker.setOptions({
|
that.marker.setOptions({
|
||||||
position: that.place.center
|
position: that.place.center
|
||||||
})
|
});
|
||||||
that.place.rectangle.update();
|
that.place.rectangle.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue