From 2c2caf8f587154449d30163fe3e9b6426ced052c Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 19 Feb 2012 07:21:40 +0000 Subject: [PATCH] add 'editable' timeline state (fixes #521) --- source/Ox.UI/js/Video/Ox.SmallVideoTimelineImage.js | 5 +++-- source/Ox.UI/js/Video/Ox.VideoEditor.js | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/Ox.UI/js/Video/Ox.SmallVideoTimelineImage.js b/source/Ox.UI/js/Video/Ox.SmallVideoTimelineImage.js index edad13b1..f6929229 100644 --- a/source/Ox.UI/js/Video/Ox.SmallVideoTimelineImage.js +++ b/source/Ox.UI/js/Video/Ox.SmallVideoTimelineImage.js @@ -146,8 +146,9 @@ Ox.SmallVideoTimelineImage = function(options, self) { top = 0, bottom = height, rgb = self.options.state == 'editing' ? [[0, 128, 0], [128, 255, 128]] - : self.options.state == 'selected' ? [[0, 0, 128], [128, 128, 255]] - : [[0, 0, 0], [255, 255, 255]]; + : self.options.state == 'editable' ? [[0, 0, 128], [128, 128, 255]] + : self.options.state == 'selected' ? [[0, 0, 0], [255, 255, 255]] + : [[32, 32, 32], [224, 224, 224]]; Ox.loop(left, right, function(x) { Ox.loop(top, bottom, function(y) { var alpha = self.options.type == 'editor' diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 0afe848f..b739dbdb 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -93,7 +93,7 @@ Ox.VideoEditor = function(options, self) { if (self.editing) { // submitAnnotation(); blurAnnotation(); - } else if (self.options.selected) { + } else if (isEditable()) { editAnnotation(); } }, @@ -966,6 +966,11 @@ Ox.VideoEditor = function(options, self) { setPosition(self.options[point]); } + function isEditable() { + var annotation = Ox.getObjectById(self.annotations, self.options.selected); + return annotation && annotation.editable; + } + function movePositionBy(sec) { setPosition(Ox.limit(self.options.position + sec, 0, self.options.duration)); } @@ -1149,6 +1154,7 @@ Ox.VideoEditor = function(options, self) { function setTimelineState() { self.$timeline[1].options({ state: self.editing ? 'editing' + : isEditable() ? 'editable' : self.options.selected ? 'selected' : 'default' });