edit annotations

This commit is contained in:
j 2011-06-15 16:36:01 +02:00
parent e7b947c1ca
commit 218eeaf47a
4 changed files with 24 additions and 11 deletions

View file

@ -1390,6 +1390,7 @@ Ox.List = function(options, self) {
width: width width: width
}).bindEvent({ }).bindEvent({
cancel: cancel, cancel: cancel,
remove: remove,
save: submit save: submit
}).appendTo($item.$element); }).appendTo($item.$element);
/* /*
@ -1400,7 +1401,11 @@ Ox.List = function(options, self) {
*/ */
function cancel() { function cancel() {
$item.options('data', item); $item.options('data', item);
//fixme: trigger event to reset i/o points that.triggerEvent('cancel', item);
loadItems();
}
function remove() {
that.triggerEvent('remove', item.id);
} }
function submit(event, data) { function submit(event, data) {
item.value = data.value; item.value = data.value;
@ -1408,6 +1413,7 @@ Ox.List = function(options, self) {
// fixme: leaky, inputs remain in focus stack // fixme: leaky, inputs remain in focus stack
$item.options('data', item); $item.options('data', item);
that.triggerEvent('submit', item); that.triggerEvent('submit', item);
loadItems();
} }
} }

View file

@ -204,6 +204,9 @@ Ox.TextList = function(options, self) {
edit: function(data) { edit: function(data) {
that.editCell(data.id, data.key); that.editCell(data.id, data.key);
}, },
cancel: function(data) {
Ox.print('cancel edit', data);
},
init: function(data) { init: function(data) {
// fixme: why does this never reach? // fixme: why does this never reach?
//Ox.print('INIT????') //Ox.print('INIT????')

View file

@ -68,8 +68,9 @@ Ox.AnnotationPanel = function(options, self) {
unique: 'id' unique: 'id'
}) })
.bindEvent({ .bindEvent({
cancel: function() { cancel: function(item) {
//reset in/out points
selectAnnotation({}, {ids: [item.id]});
}, },
open: function(event, data) { open: function(event, data) {
if (data.ids.length == 1) { if (data.ids.length == 1) {
@ -77,7 +78,7 @@ Ox.AnnotationPanel = function(options, self) {
self.$annotations.editItem(pos); self.$annotations.editItem(pos);
} }
}, },
'remove': function(event, data) { remove: function(event, data) {
that.triggerEvent('remove', data); that.triggerEvent('remove', data);
}, },
select: selectAnnotation, select: selectAnnotation,
@ -101,7 +102,7 @@ Ox.AnnotationPanel = function(options, self) {
*/ */
function selectAnnotation(event, data) { function selectAnnotation(event, data) {
var item = Ox.getObjectById(self.options.items, data.ids[0]); var item = Ox.getObjectById(self.options.items, data.ids[0]);
that.triggerEvent('select', { item && that.triggerEvent('select', {
'in': item['in'], 'in': item['in'],
'out': item.out, 'out': item.out,
'layer': self.options.id 'layer': self.options.id
@ -125,14 +126,14 @@ Ox.AnnotationPanel = function(options, self) {
self.options.items.splice(pos, 0, item); self.options.items.splice(pos, 0, item);
self.$annotations.addItems(pos, [item]); self.$annotations.addItems(pos, [item]);
self.$annotations.editItem(pos); self.$annotations.editItem(pos);
} };
/*@ /*@
removeItems <f> removeItems removeItems <f> removeItems
@*/ @*/
that.removeItems = function(ids) { that.removeItems = function(ids) {
self.$annotations.removeItems(ids); self.$annotations.removeItems(ids);
} };
/*@ /*@
deselectItems <f> deselectItems deselectItems <f> deselectItems

View file

@ -268,8 +268,11 @@ Ox.VideoEditor = function(options, self) {
data.out = self.options.out; data.out = self.options.out;
that.triggerEvent('addAnnotation', data); that.triggerEvent('addAnnotation', data);
}, },
'delete': function(event, data) { remove: function(event, data) {
data.layer = layer.id; data = {
ids: [data],
layer: layer.id
};
that.triggerEvent('removeAnnotations', data); that.triggerEvent('removeAnnotations', data);
}, },
select: function(event, data) { select: function(event, data) {
@ -872,8 +875,8 @@ Ox.VideoEditor = function(options, self) {
setPoint('out', data.out); setPoint('out', data.out);
} }
function updateAnnotation(event, data) { function updateAnnotation(event, data) {
data['in'] = self.options.points[0]; data['in'] = self.options['in'];
data.out = self.options.points[1]; data.out = self.options.out;
that.triggerEvent('updateAnnotation', data); that.triggerEvent('updateAnnotation', data);
} }