1
0
Fork 0
forked from 0x2620/oxjs

update video editor

This commit is contained in:
rlx 2012-01-13 00:34:32 +05:30
commit f61e39a788
9 changed files with 141 additions and 80 deletions

View file

@ -71,7 +71,22 @@ Ox.AnnotationFolder = function(options, self) {
if (self.options.type == 'event') {
self.$annotations = Ox.Element();
} else if (self.options.type == 'place') {
self.$annotations = Ox.Element();
self.$annotations = Ox.Element()
.css({
width: self.options.width + 'px',
height: '256px'
});
Ox.print('PLACES::', self.places)
self.$map = Ox.Map({
places: getPlaces()
// showLabels: true
})
.bindEvent({
selectplace: function(data) {
selectAnnotation({id: data.annotationId});
}
})
.appendTo(self.$annotations);
} else if (['string', 'text'].indexOf(self.options.type) > -1) {
self.$annotations = Ox.ArrayEditable({
editable: self.options.editable,
@ -130,6 +145,18 @@ Ox.AnnotationFolder = function(options, self) {
});
}
function getPlaces() {
var places = [];
getAnnotations().forEach(function(item) {
if (item.place && Ox.getIndexById(places, item.place.id) == -1) {
places.push(Ox.extend({
annotationId: item.id
}, item.place));
}
});
return places;
}
function getSort() {
return ({
duration: ['-duration', '+in', '+value'],
@ -171,27 +198,36 @@ Ox.AnnotationFolder = function(options, self) {
}
if (key == 'in') {
//fixme: array editable should support item updates while editing
self.editing || self.options.range == 'selection' && self.$annotations.options({
items: getAnnotations()
});
if (self.editing || self.options.range == 'selection') {
self.options.type == 'place' ? self.$map.options({places: getPlaces()})
: self.$annotations.options({items: getAnnotations()});
}
} else if (key == 'out') {
self.editing || self.options.range == 'selection' && self.$annotations.options({
items: getAnnotations()
});
if (self.editing || self.options.range == 'selection') {
self.options.type == 'place' ? self.$map.options({places: getPlaces()})
: self.$annotations.options({items: getAnnotations()});
}
} else if (key == 'position') {
self.editing || self.options.range == 'position' && self.$annotations.options({
items: getAnnotations()
});
if (self.editing || self.options.range == 'position') {
self.options.type == 'place' ? self.$map.options({places: getPlaces()})
: self.$annotations.options({items: getAnnotations()});
}
} else if (key == 'range') {
self.$annotations.options({items: getAnnotations()});
} else if (key == 'selected') {
if (value === '') {
self.editing = false;
}
self.$annotations.options({selected: value});
} else if (key == 'sort') {
self.sort = getSort();
self.$annotations.options({sort: self.sort});
} else if (key == 'users') {
Ox.print('USERS ->', value)
self.$annotations.options({items: getAnnotations()});
} else if (key == 'width') {
self.$annotations.options({
width: self.options.type == 'text' ? self.options.width + 8 : self.options.width
});
}
};