From 6d63c07ec573288cbab07f127d899dc27ed2841d Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Tue, 17 Jan 2012 17:40:50 +0530 Subject: [PATCH] update video editor (maps, calendars) --- source/Ox.UI/js/Video/Ox.AnnotationFolder.js | 28 ++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js index e3b67af9..b9a34b7a 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js @@ -127,10 +127,14 @@ Ox.AnnotationFolder = function(options, self) { }) .bindEvent({ select: function(data) { - if (!data.id || data.annotationIds.indexOf(self.options.selected) == -1) { - self.$annotations.options({ - selected: !data.id ? '' : data.annotationIds[0] - }); + if (!data.id && Ox.getObjectById(self.options.items, self.options.selected).event) { + // only deselect annotation if the event deselect was not + // caused by switching to an annotation without event + self.$annotations.options({selected: ''}); + } else if (data.annotationIds.indexOf(self.options.selected) == -1) { + // only select a new annotation if the currently selected + // annotation does not match the selected event + self.$annotations.options({selected: data.annotationIds[0]}); } } }) @@ -150,10 +154,14 @@ Ox.AnnotationFolder = function(options, self) { .bindEvent({ // FIXME: should be select, not selectplace selectplace: function(data) { - if (!data.id || data.annotationIds.indexOf(self.options.selected) == -1) { - self.$annotations.options({ - selected: !data.id ? '' : data.annotationIds[0] - }); + if (!data.id && Ox.getObjectById(self.options.items, self.options.selected).place) { + // only deselect annotation if the place deselect was not + // caused by switching to an annotation without place + self.$annotations.options({selected: ''}); + } else if (data.annotationIds.indexOf(self.options.selected) == -1) { + // only select a new annotation if the currently selected + // annotation does not match the selected place + self.$annotations.options({selected: data.annotationIds[0]}); } } }) @@ -343,7 +351,6 @@ Ox.AnnotationFolder = function(options, self) { function removeAnnotation(data) { var item; - Ox.print('REMOVE:::::::::', data) self.editing = false; if (self.widget) { item = Ox.getObjectById(self.options.items, data.id); @@ -524,10 +531,9 @@ Ox.AnnotationFolder = function(options, self) { var index = Ox.getIndexById(self.options.items, item.id); self.options.items[index] = item; updateAnnotations(); - Ox.print('updating.......', item[self.options.type]) if (self.widget && item[self.options.type]) { // if updating has made the item match - // an event / a place, then select it + // an event or place, then select it self.$widget.options({selected: item[self.options.type].id}); } return that;