forked from 0x2620/oxjs
update video editor (maps)
This commit is contained in:
parent
408ebf54cb
commit
f5d587cf5b
5 changed files with 81 additions and 44 deletions
|
|
@ -458,6 +458,23 @@ Ox.Map = function(options, self) {
|
|||
);
|
||||
}
|
||||
|
||||
function addPlaces() {
|
||||
Ox.forEach(self.$placeControls, function($placeControl) {
|
||||
$placeControl.hide();
|
||||
});
|
||||
self.places && self.places.forEach(function(place) {
|
||||
place.remove();
|
||||
});
|
||||
self.places = [];
|
||||
if (!self.isAsync) {
|
||||
self.options.places.forEach(function(place) {
|
||||
self.places.push(new Ox.MapPlace(Ox.extend({
|
||||
map: that
|
||||
}, place)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function addPlaceToMap(place) {
|
||||
// via find, click, shift-click, or new place button
|
||||
Ox.Log('Map', 'addPlaceToMap', place)
|
||||
|
|
@ -790,6 +807,7 @@ Ox.Map = function(options, self) {
|
|||
disableDefaultUI: true,
|
||||
disableDoubleClickZoom: true,
|
||||
mapTypeId: google.maps.MapTypeId[getMapType()],
|
||||
noClear: true,
|
||||
zoom: self.zoom
|
||||
});
|
||||
google.maps.event.addListener(self.map, 'bounds_changed', boundsChanged);
|
||||
|
|
@ -798,6 +816,7 @@ Ox.Map = function(options, self) {
|
|||
google.maps.event.addListener(self.map, 'idle', mapChanged);
|
||||
google.maps.event.addListener(self.map, 'zoom_changed', zoomChanged);
|
||||
google.maps.event.addListenerOnce(self.map, 'tilesloaded', tilesLoaded);
|
||||
google.maps.event.trigger(self.map, 'resize');
|
||||
|
||||
// needed to get mouse x/y coordinates on marker mouseover,
|
||||
// see http://code.google.com/p/gmaps-api-issues/issues/detail?id=2342
|
||||
|
|
@ -811,16 +830,27 @@ Ox.Map = function(options, self) {
|
|||
}
|
||||
that.overlayView.draw();
|
||||
|
||||
addPlaces();
|
||||
|
||||
Ox.forEach(self.$controls, function($control) {
|
||||
$control.appendTo(self.$map);
|
||||
});
|
||||
Ox.forEach(self.$placeControls, function($placeControl) {
|
||||
$placeControl.appendTo(self.$map);
|
||||
});
|
||||
|
||||
if (self.options.find) {
|
||||
self.$findInput.value(self.options.find)
|
||||
.triggerEvent('submit', {value: self.options.find});
|
||||
} else if (self.options.selected) {
|
||||
selectPlace(self.options.selected, true);
|
||||
} else {
|
||||
if (self.options.selected) {
|
||||
selectPlace(self.options.selected, true);
|
||||
}
|
||||
if (mapBounds) {
|
||||
if (isEmpty(mapBounds)) {
|
||||
self.map.setZoom(self.minZoom);
|
||||
} else {
|
||||
Ox.print("FITTING BOUNDS")
|
||||
self.map.fitBounds(mapBounds);
|
||||
}
|
||||
}
|
||||
|
|
@ -830,32 +860,16 @@ Ox.Map = function(options, self) {
|
|||
}
|
||||
updateFormElements();
|
||||
|
||||
// fixme: this is just guessing
|
||||
// setTimeout(updateFormElements, 2500);
|
||||
|
||||
self.places = [];
|
||||
if (!self.isAsync) {
|
||||
self.options.places.forEach(function(place) {
|
||||
self.places.push(new Ox.MapPlace(Ox.extend({
|
||||
map: that
|
||||
}, place)));
|
||||
});
|
||||
}
|
||||
google.maps.event.trigger(self.map, 'resize');
|
||||
//that.gainFocus();
|
||||
self.loaded = true;
|
||||
that.triggerEvent('load');
|
||||
|
||||
function tilesLoaded() {
|
||||
setTimeout(formatTerms, 250);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function tilesLoaded() {
|
||||
// fixme: can add earlier, use don't replace map contents option
|
||||
Ox.forEach(self.$controls, function($control) {
|
||||
$control.appendTo(self.$map);
|
||||
});
|
||||
Ox.forEach(self.$placeControls, function($placeControl) {
|
||||
$placeControl.appendTo(self.$map);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isEmpty(bounds) {
|
||||
|
|
@ -1101,6 +1115,7 @@ Ox.Map = function(options, self) {
|
|||
}
|
||||
}
|
||||
|
||||
// fixme: removePlacefromMap?
|
||||
function removePlace() {
|
||||
var place = getSelectedPlace();
|
||||
place.id = '_' + place.id;
|
||||
|
|
@ -1369,12 +1384,21 @@ Ox.Map = function(options, self) {
|
|||
that.$element.css(key, value + 'px');
|
||||
that.resizeMap();
|
||||
} else if (key == 'places') {
|
||||
// fixme: assumes !self.isAsync
|
||||
Ox.print('MAP SET OPTIONS PLACES', value);
|
||||
addPlaces();
|
||||
getMapBounds(function(mapBounds) {
|
||||
self.map.fitBounds(mapBounds);
|
||||
});
|
||||
if (self.options.selected) {
|
||||
if (getSelectedPlace()) {
|
||||
selectPlace(self.options.selected);
|
||||
} else {
|
||||
self.options.selected = '';
|
||||
}
|
||||
}
|
||||
} else if (key == 'selected') {
|
||||
selectPlace(value || null);
|
||||
self.loaded && selectPlace(value || null);
|
||||
} else if (key == 'type') {
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue