forked from 0x2620/oxjs
improving listmap
This commit is contained in:
parent
c86c7d598d
commit
5915acd72c
12 changed files with 152 additions and 39 deletions
|
|
@ -275,22 +275,32 @@ Ox.ListMap = function(options, self) {
|
|||
values: [],
|
||||
width: 240
|
||||
}),
|
||||
], ['Latitude', 'Longitude', 'South', 'West', 'North', 'East'].map(function(v) {
|
||||
var key = (
|
||||
], ['South', 'West', 'North', 'East', 'Latitude', 'Longitude'].map(function(v) {
|
||||
var id = (
|
||||
v == 'Latitude' ? 'lat' : v == 'Longitude' ? 'lng' : v
|
||||
).toLowerCase(),
|
||||
max = ['Latitude', 'South', 'North'].indexOf(v) > -1 ? Ox.MAX_LATITUDE : 180;
|
||||
return Ox.Input({
|
||||
decimals: 8,
|
||||
disabled: ['Latitude', 'Longitude'].indexOf(v) > -1,
|
||||
id: id,
|
||||
label: v,
|
||||
labelWidth: 80,
|
||||
min: -max,
|
||||
max: max,
|
||||
type: 'float',
|
||||
value: self.options.places[0][key].toFixed(8),
|
||||
width: 240
|
||||
});
|
||||
}));
|
||||
}), [
|
||||
Ox.Input({
|
||||
disabled: true,
|
||||
id: 'size',
|
||||
label: 'Size',
|
||||
labelWidth: 80,
|
||||
textAlign: 'right',
|
||||
width: 240
|
||||
})
|
||||
]);
|
||||
|
||||
self.$placeForm = Ox.Form({
|
||||
items: self.$placeFormItems,
|
||||
|
|
@ -348,7 +358,7 @@ Ox.ListMap = function(options, self) {
|
|||
findPlaceholder: 'Find on Map',
|
||||
height: self.options.height,
|
||||
places: places,
|
||||
//statusbar: true,
|
||||
statusbar: true,
|
||||
toolbar: true,
|
||||
width: self.options.width - 514,//self.mapResize[1],
|
||||
zoombar: true
|
||||
|
|
@ -357,6 +367,11 @@ Ox.ListMap = function(options, self) {
|
|||
addplace: function(event, data) {
|
||||
that.triggerEvent('addplace', data);
|
||||
},
|
||||
changeplace: function(event, data) {
|
||||
self.$placeForm.values(Ox.map(data, function(val, key) {
|
||||
return key == 'size' ? Ox.formatArea(val) : val;
|
||||
}));
|
||||
},
|
||||
geocode: function(event, data) {
|
||||
that.triggerEvent('geocode', data);
|
||||
},
|
||||
|
|
@ -409,7 +424,17 @@ Ox.ListMap = function(options, self) {
|
|||
}
|
||||
],
|
||||
orientation: 'vertical'
|
||||
})
|
||||
.bindEvent({
|
||||
// fixme: pass width through form
|
||||
resize: function(foo, size) {
|
||||
self.$placeFormItems.forEach(function($item) {
|
||||
$item.options({width: size - 16});
|
||||
});
|
||||
}
|
||||
}),
|
||||
resizable: true,
|
||||
resize: [128, 256, 384],
|
||||
size: 256
|
||||
}
|
||||
],
|
||||
|
|
@ -445,6 +470,9 @@ Ox.ListMap = function(options, self) {
|
|||
data.id && data.id[0] != '_' && self.$list.options({
|
||||
selected: data.id ? [data.id] : []
|
||||
});
|
||||
self.$placeForm.values(Ox.map(data, function(val, key) {
|
||||
return key == 'size' ? Ox.formatArea(val) : val;
|
||||
}));
|
||||
}
|
||||
|
||||
function toFixed(val) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue