changes to Map

This commit is contained in:
rolux 2011-04-19 12:41:16 +02:00
parent 9a61861bf5
commit 6aeb19bc81

View file

@ -220,7 +220,7 @@ requires
image.onload = function() { image.onload = function() {
(++counter == length) && callback(); (++counter == length) && callback();
} }
window.OxImageCache.push(image); window.OxImageCache.push(image); // fixme: global var???
}); });
}); });
} }
@ -979,7 +979,7 @@ requires
bindEvent(event, fn) or bindEvent({event0: fn0, event1: fn1, ...}) bindEvent(event, fn) or bindEvent({event0: fn0, event1: fn1, ...})
***/ ***/
if (arguments.length == 1) { if (arguments.length == 1) {
$.each(arguments[0], function(event, fn) { Ox.forEach(arguments[0], function(fn, event) {
// Ox.print(that.id, 'bind', event); // Ox.print(that.id, 'bind', event);
self.$eventHandler.bind('ox_' + event, fn); self.$eventHandler.bind('ox_' + event, fn);
}); });
@ -990,6 +990,17 @@ requires
return that; return that;
} }
that.bindEventOnce = function() {
if (arguments.length == 1) {
Ox.forEach(arguments[0], function(fn, event) {
self.$eventHandler.one('ox_' + event, fn);
});
} else {
self.$eventHandler.one('ox_' + arguments[0], arguments[1]);
}
return that;
};
that.defaults = function(defaults) { that.defaults = function(defaults) {
/*** /***
sets the default options sets the default options
@ -1085,7 +1096,7 @@ requires
triggerEvent({event0: data0, event1: data1, ...}) triggerEvent({event0: data0, event1: data1, ...})
***/ ***/
if (Ox.isObject(arguments[0])) { if (Ox.isObject(arguments[0])) {
$.each(arguments[0], function(event, data) { Ox.forEach(arguments[0], function(data, event) {
if (['mousedown', 'mouserepeat', 'anyclick', 'singleclick', 'doubleclick', 'dragstart', 'drag', 'dragend', 'playing'].indexOf(event) == -1) { if (['mousedown', 'mouserepeat', 'anyclick', 'singleclick', 'doubleclick', 'dragstart', 'drag', 'dragend', 'playing'].indexOf(event) == -1) {
Ox.print(that.id, self.options.id, 'trigger', event, data); Ox.print(that.id, self.options.id, 'trigger', event, data);
} }
@ -1108,7 +1119,7 @@ requires
unbindEvent({event0: fn0, event1: fn1, ...}) unbindEvent({event0: fn0, event1: fn1, ...})
***/ ***/
if (arguments.length == 1) { if (arguments.length == 1) {
$.each(arguments[0], function(event, fn) { Ox.forEach(arguments[0], function(fn, event) {
// Ox.print(that.id, 'unbind', arguments[0]); // Ox.print(that.id, 'unbind', arguments[0]);
self.$eventHandler.unbind('ox_' + event, fn); self.$eventHandler.unbind('ox_' + event, fn);
}); });
@ -9526,15 +9537,16 @@ requires
}) })
}; };
if (Ox.isUndefined(window.google)) { if (!window.googleCallback) {
googleCallback = function() { window.googleCallback = function() {
Ox.print('googleCallback') delete window.googleCallback;
delete googleCallback;
initMap(); initMap();
}; };
$.getScript('http://maps.google.com/maps/api/js?callback=googleCallback&sensor=false'); $.getScript('http://maps.google.com/maps/api/js?callback=googleCallback&sensor=false');
} else { } else {
initMap(); (function interval() {
window.google ? initMap() : setTimeout(interval, 50);
}());
} }
function addPlaceToMap(place) { function addPlaceToMap(place) {
@ -9607,7 +9619,6 @@ requires
} }
function centerChanged() { function centerChanged() {
Ox.print('CENTER CHANGED')
self.center = self.map.getCenter(); self.center = self.map.getCenter();
self.centerChanged = true; self.centerChanged = true;
} }