update video editor

This commit is contained in:
rlx 2012-01-11 17:24:58 +05:30
parent 43d04f242d
commit ef82ff8967
3 changed files with 17 additions and 12 deletions

View file

@ -37,10 +37,11 @@ Ox.ArrayEditable = function(options, self) {
});
self.$items = [];
self.selected = getSelectedPosition();
renderItems();
self.selected = getSelectedPosition();
function anyclick(e) {
var $target = $(e.target),
$parent = $target.parent(),
@ -107,11 +108,8 @@ Ox.ArrayEditable = function(options, self) {
function renderItems() {
that.empty();
(
Ox.isEmpty(self.options.sort)
? self.options.items
: Ox.sortBy(self.options.items, self.options.sort)
).forEach(function(item, i) {
sortItems();
self.options.items.forEach(function(item, i) {
i && self.options.type == 'input'
&& $('<span>')
.html(', ')
@ -186,6 +184,13 @@ Ox.ArrayEditable = function(options, self) {
self.selected > 0 && selectItem(self.selected - 1);
}
function sortItems() {
if (!Ox.isEmpty(self.options.sort)) {
self.options.items = Ox.sortBy(self.options.items, self.options.sort);
self.selected = getSelectedPosition();
}
}
function submit(position, value) {
var item = self.options.items[position];
if (value === '') {

View file

@ -101,7 +101,6 @@ Ox.AnnotationPanel = function(options, self) {
}
self.$annotations.appendTo(that.$content);
//Ox.print('SOS', self.options.selected);
self.options.selected && setTimeout(function() {
selectAnnotation({id: self.options.selected});
}, 0);
@ -142,6 +141,7 @@ Ox.AnnotationPanel = function(options, self) {
var item = Ox.getObjectById(self.options.items, data.id);
item.value = data.value;
self.editing = false;
self.$annotations.options({items: self.options.items});
that.triggerEvent('submit', item);
}
@ -174,10 +174,10 @@ Ox.AnnotationPanel = function(options, self) {
items: getAnnotations()
});
} else if (key == 'selected') {
self.$annotations.options('selected', value);
self.$annotations.options({selected: value});
} else if (key == 'sort') {
self.sort = getSort();
self.$annotations.options('sort', self.sort);
self.$annotations.options({sort: self.sort});
}
};

View file

@ -1290,11 +1290,11 @@ Ox.VideoEditor = function(options, self) {
function togglePaused() {
self.$player[0].togglePaused();
/* fixme
///* FIXME
self.$player[0].options('paused') && that.triggerEvent('position', {
position: self.$player[0].options('position')
});
*/
//*/
}
function toggleSize() {