add 'editable' timeline state (fixes #521)

This commit is contained in:
rlx 2012-02-19 07:21:40 +00:00
parent b12099a9d7
commit 2c2caf8f58
2 changed files with 10 additions and 3 deletions

View file

@ -146,8 +146,9 @@ Ox.SmallVideoTimelineImage = function(options, self) {
top = 0, top = 0,
bottom = height, bottom = height,
rgb = self.options.state == 'editing' ? [[0, 128, 0], [128, 255, 128]] rgb = self.options.state == 'editing' ? [[0, 128, 0], [128, 255, 128]]
: self.options.state == 'selected' ? [[0, 0, 128], [128, 128, 255]] : self.options.state == 'editable' ? [[0, 0, 128], [128, 128, 255]]
: [[0, 0, 0], [255, 255, 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(left, right, function(x) {
Ox.loop(top, bottom, function(y) { Ox.loop(top, bottom, function(y) {
var alpha = self.options.type == 'editor' var alpha = self.options.type == 'editor'

View file

@ -93,7 +93,7 @@ Ox.VideoEditor = function(options, self) {
if (self.editing) { if (self.editing) {
// submitAnnotation(); // submitAnnotation();
blurAnnotation(); blurAnnotation();
} else if (self.options.selected) { } else if (isEditable()) {
editAnnotation(); editAnnotation();
} }
}, },
@ -966,6 +966,11 @@ Ox.VideoEditor = function(options, self) {
setPosition(self.options[point]); setPosition(self.options[point]);
} }
function isEditable() {
var annotation = Ox.getObjectById(self.annotations, self.options.selected);
return annotation && annotation.editable;
}
function movePositionBy(sec) { function movePositionBy(sec) {
setPosition(Ox.limit(self.options.position + sec, 0, self.options.duration)); setPosition(Ox.limit(self.options.position + sec, 0, self.options.duration));
} }
@ -1149,6 +1154,7 @@ Ox.VideoEditor = function(options, self) {
function setTimelineState() { function setTimelineState() {
self.$timeline[1].options({ self.$timeline[1].options({
state: self.editing ? 'editing' state: self.editing ? 'editing'
: isEditable() ? 'editable'
: self.options.selected ? 'selected' : self.options.selected ? 'selected'
: 'default' : 'default'
}); });