forked from 0x2620/oxjs
update video editor
This commit is contained in:
parent
f5d587cf5b
commit
7da384d03a
5 changed files with 98 additions and 38 deletions
|
|
@ -42,6 +42,8 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
})
|
||||
.options(options || {});
|
||||
|
||||
self.points = getPoints();
|
||||
self.position = self.options.position;
|
||||
self.sort = getSort();
|
||||
self.widget = self.options.type == 'event' ? 'Calendar'
|
||||
: self.options.type == 'place' ? 'Map' : '';
|
||||
|
|
@ -143,6 +145,7 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
.bindEvent({
|
||||
// FIXME: should be select, not selectplace
|
||||
selectplace: function(data) {
|
||||
Ox.print('ANNOTATION ID IS', data.annotationId)
|
||||
self.$annotations.options({selected: data.annotationId});
|
||||
// selectAnnotation({id: data.annotationId});
|
||||
}
|
||||
|
|
@ -228,6 +231,15 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
that.triggerEvent('change', item);
|
||||
}
|
||||
|
||||
function crossesPoint() {
|
||||
var sort = [self.position, self.options.position].sort(),
|
||||
positionA = sort[0],
|
||||
positionB = sort[1];
|
||||
return self.points.some(function(point) {
|
||||
return point > positionA && point < positionB;
|
||||
});
|
||||
}
|
||||
|
||||
function dragstart() {
|
||||
if (self.options.showWidget) {
|
||||
self.drag = {
|
||||
|
|
@ -279,6 +291,14 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
});
|
||||
}
|
||||
|
||||
function getPoints() {
|
||||
return Ox.unique(Ox.flatten(
|
||||
self.options.items.map(function(item) {
|
||||
return [item['in'], item.out];
|
||||
})
|
||||
));
|
||||
}
|
||||
|
||||
function getEvents() {
|
||||
var events = [];
|
||||
getAnnotations().forEach(function(item) {
|
||||
|
|
@ -388,7 +408,8 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
if (['in', 'out'].indexOf(key) > -1 && self.editing) {
|
||||
var index = Ox.getIndexById(self.options.items, self.options.selected);
|
||||
self.options.items[index][key] = value;
|
||||
self.options.items[index].duration = self.options.out - self.options['in'];
|
||||
self.options.items[index].duration = self.options.out - self.options['in'];
|
||||
self.points = getPoints();
|
||||
}
|
||||
if (key == 'in') {
|
||||
//fixme: array editable should support item updates while editing
|
||||
|
|
@ -403,9 +424,11 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
}
|
||||
} else if (key == 'position') {
|
||||
if (self.options.range == 'position') {
|
||||
Ox.print('POSITION CHANGED, UPDATING')
|
||||
self.widget && updateWidget();
|
||||
updateAnnotations();
|
||||
if (crossesPoint()) {
|
||||
self.widget && updateWidget();
|
||||
updateAnnotations();
|
||||
}
|
||||
self.position = self.options.position;
|
||||
}
|
||||
} else if (key == 'range') {
|
||||
self.widget && updateWidget();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue