self.setOption ~> that.update
This commit is contained in:
parent
9ee0742b53
commit
005d50c389
56 changed files with 919 additions and 933 deletions
|
|
@ -39,6 +39,18 @@ Ox.ListMap = function(options, self) {
|
|||
width: 256
|
||||
})
|
||||
.options(options || {})
|
||||
.update({
|
||||
height: function() {
|
||||
self.$list.size();
|
||||
self.$map.resizeMap();
|
||||
},
|
||||
selected: function() {
|
||||
self.$list.options({selected: self.options.selected});
|
||||
},
|
||||
width: function() {
|
||||
self.$map.resizeMap();
|
||||
}
|
||||
})
|
||||
.css({
|
||||
width: self.options.width + 'px',
|
||||
height: self.options.height + 'px'
|
||||
|
|
@ -1119,20 +1131,6 @@ Ox.ListMap = function(options, self) {
|
|||
});
|
||||
}
|
||||
|
||||
/*@
|
||||
setOption <f> setOption
|
||||
@*/
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'height') {
|
||||
self.$list.size();
|
||||
self.$map.resizeMap();
|
||||
} else if (key == 'selected') {
|
||||
self.$list.options({selected: value});
|
||||
} else if (key == 'width') {
|
||||
self.$map.resizeMap();
|
||||
}
|
||||
}
|
||||
|
||||
/*@
|
||||
focusList <f> focusList
|
||||
@*/
|
||||
|
|
|
|||
|
|
@ -114,6 +114,48 @@ Ox.Map = function(options, self) {
|
|||
// fixme: width, height
|
||||
})
|
||||
.options(options || {})
|
||||
.update({
|
||||
find: function() {
|
||||
self.$findInput
|
||||
.value(self.options.find)
|
||||
.triggerEvent('submit', {value: self.options.find});
|
||||
},
|
||||
height: function() {
|
||||
that.$element.css({height: self.options.height + 'px'});
|
||||
that.resizeMap();
|
||||
},
|
||||
places: function() {
|
||||
addPlaces();
|
||||
getMapBounds(function(mapBounds) {
|
||||
if (mapBounds) {
|
||||
self.map.fitBounds(mapBounds);
|
||||
} else {
|
||||
self.map.setZoom(self.minZoom);
|
||||
self.map.setCenter(new google.maps.LatLng(0, 0));
|
||||
}
|
||||
// fixme: the following is just a guess
|
||||
self.boundsChanged = true;
|
||||
mapChanged();
|
||||
});
|
||||
if (self.options.selected) {
|
||||
if (getSelectedPlace()) {
|
||||
selectPlace(self.options.selected);
|
||||
} else {
|
||||
self.options.selected = '';
|
||||
}
|
||||
}
|
||||
},
|
||||
selected: function() {
|
||||
selectPlace(self.options.selected || null);
|
||||
},
|
||||
type: function() {
|
||||
// ...
|
||||
},
|
||||
width: function() {
|
||||
that.$element.css({width: self.options.width + 'px'});
|
||||
that.resizeMap();
|
||||
}
|
||||
})
|
||||
.addClass('OxMap')
|
||||
.bindEvent({
|
||||
gainfocus: function() {
|
||||
|
|
@ -1402,41 +1444,6 @@ Ox.Map = function(options, self) {
|
|||
place && self.map.fitBounds(place.bounds);
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'find') {
|
||||
self.$findInput
|
||||
.value(self.options.find)
|
||||
.triggerEvent('submit', {value: self.options.find});
|
||||
} else if (key == 'height' || key == 'width') {
|
||||
that.$element.css(key, value + 'px');
|
||||
that.resizeMap();
|
||||
} else if (key == 'places') {
|
||||
addPlaces();
|
||||
getMapBounds(function(mapBounds) {
|
||||
if (mapBounds) {
|
||||
self.map.fitBounds(mapBounds);
|
||||
} else {
|
||||
self.map.setZoom(self.minZoom);
|
||||
self.map.setCenter(new google.maps.LatLng(0, 0));
|
||||
}
|
||||
// fixme: the following is just a guess
|
||||
self.boundsChanged = true;
|
||||
mapChanged();
|
||||
});
|
||||
if (self.options.selected) {
|
||||
if (getSelectedPlace()) {
|
||||
selectPlace(self.options.selected);
|
||||
} else {
|
||||
self.options.selected = '';
|
||||
}
|
||||
}
|
||||
} else if (key == 'selected') {
|
||||
selectPlace(value || null);
|
||||
} else if (key == 'type') {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/*@
|
||||
addPlace <f> addPlace
|
||||
(data) -> <u> add place to places
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ Ox.MapImage = function(options, self) {
|
|||
type: 'satellite',
|
||||
width: 640
|
||||
})
|
||||
.options(options || {})
|
||||
.options(options || {});
|
||||
|
||||
self.src = document.location.protocol
|
||||
+ '//maps.google.com/maps/api/staticmap?sensor=false' +
|
||||
|
|
@ -68,10 +68,6 @@ Ox.MapImage = function(options, self) {
|
|||
}).join('')
|
||||
}
|
||||
|
||||
self.setOption = function(key, value) {
|
||||
|
||||
};
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue