From 218eeaf47a81749d8138bd08785ab6d436bdc97b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 15 Jun 2011 16:36:01 +0200 Subject: [PATCH] edit annotations --- source/Ox.UI/js/List/Ox.List.js | 8 +++++++- source/Ox.UI/js/List/Ox.TextList.js | 3 +++ source/Ox.UI/js/Video/Ox.AnnotationPanel.js | 13 +++++++------ source/Ox.UI/js/Video/Ox.VideoEditor.js | 11 +++++++---- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 6a22b4a5..5d692867 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -1390,6 +1390,7 @@ Ox.List = function(options, self) { width: width }).bindEvent({ cancel: cancel, + remove: remove, save: submit }).appendTo($item.$element); /* @@ -1400,7 +1401,11 @@ Ox.List = function(options, self) { */ function cancel() { $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) { item.value = data.value; @@ -1408,6 +1413,7 @@ Ox.List = function(options, self) { // fixme: leaky, inputs remain in focus stack $item.options('data', item); that.triggerEvent('submit', item); + loadItems(); } } diff --git a/source/Ox.UI/js/List/Ox.TextList.js b/source/Ox.UI/js/List/Ox.TextList.js index c1254f1c..c58526cc 100644 --- a/source/Ox.UI/js/List/Ox.TextList.js +++ b/source/Ox.UI/js/List/Ox.TextList.js @@ -204,6 +204,9 @@ Ox.TextList = function(options, self) { edit: function(data) { that.editCell(data.id, data.key); }, + cancel: function(data) { + Ox.print('cancel edit', data); + }, init: function(data) { // fixme: why does this never reach? //Ox.print('INIT????') diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index 96bfa25f..af0b812d 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -68,8 +68,9 @@ Ox.AnnotationPanel = function(options, self) { unique: 'id' }) .bindEvent({ - cancel: function() { - + cancel: function(item) { + //reset in/out points + selectAnnotation({}, {ids: [item.id]}); }, open: function(event, data) { if (data.ids.length == 1) { @@ -77,7 +78,7 @@ Ox.AnnotationPanel = function(options, self) { self.$annotations.editItem(pos); } }, - 'remove': function(event, data) { + remove: function(event, data) { that.triggerEvent('remove', data); }, select: selectAnnotation, @@ -101,7 +102,7 @@ Ox.AnnotationPanel = function(options, self) { */ function selectAnnotation(event, data) { var item = Ox.getObjectById(self.options.items, data.ids[0]); - that.triggerEvent('select', { + item && that.triggerEvent('select', { 'in': item['in'], 'out': item.out, 'layer': self.options.id @@ -125,14 +126,14 @@ Ox.AnnotationPanel = function(options, self) { self.options.items.splice(pos, 0, item); self.$annotations.addItems(pos, [item]); self.$annotations.editItem(pos); - } + }; /*@ removeItems removeItems @*/ that.removeItems = function(ids) { self.$annotations.removeItems(ids); - } + }; /*@ deselectItems deselectItems diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index c553415e..b863c5b3 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -268,8 +268,11 @@ Ox.VideoEditor = function(options, self) { data.out = self.options.out; that.triggerEvent('addAnnotation', data); }, - 'delete': function(event, data) { - data.layer = layer.id; + remove: function(event, data) { + data = { + ids: [data], + layer: layer.id + }; that.triggerEvent('removeAnnotations', data); }, select: function(event, data) { @@ -872,8 +875,8 @@ Ox.VideoEditor = function(options, self) { setPoint('out', data.out); } function updateAnnotation(event, data) { - data['in'] = self.options.points[0]; - data.out = self.options.points[1]; + data['in'] = self.options['in']; + data.out = self.options.out; that.triggerEvent('updateAnnotation', data); }