- remove editItem from Ox.List

- use ArrayEditable for text too
This commit is contained in:
j 2012-01-04 22:57:32 +05:30
commit 093edd57d0
12 changed files with 180 additions and 403 deletions

View file

@ -40,8 +40,10 @@ Ox.VideoEditor = function(options, self) {
posterFrame: 0,
posterFrameControls: false,
resolution: 0,
selected: '',
showAnnotations: false,
showLargeTimeline: true,
state: 'default',
subtitles: [],
tooltips: false,
videoRatio: 16/9,
@ -284,6 +286,7 @@ Ox.VideoEditor = function(options, self) {
results: find(self.options.find),
showPointMarkers: true,
showSubtitles: true,
state: self.options.state,
subtitles: self.options.subtitles,
videoId: self.options.videoId,
width: self.sizes.timeline[1].width
@ -313,6 +316,7 @@ Ox.VideoEditor = function(options, self) {
out: self.options.out,
position: self.options.position,
range: self.options.annotationsRange,
// selected: self.options.selected,
sort: self.options.annotationsSort,
width: self.options.annotationsSize - Ox.UI.SCROLLBAR_SIZE
}, layer)
@ -324,6 +328,9 @@ Ox.VideoEditor = function(options, self) {
data.out = self.options.out;
that.triggerEvent('addannotation', data);
},
edit: function(data) {
setState(data.editing ? 'editing' : 'selected');
},
remove: function(data) {
that.triggerEvent('removeannotation', {
id: data.id,
@ -331,14 +338,14 @@ Ox.VideoEditor = function(options, self) {
});
},
select: function(data) {
self.options.layers.forEach(function(layer_, i_) {
if (i_ != i) {
// FIXME: the way AnnotationPanel is set up,
// it does not actually have that method
// self.$annotationPanel[i_].deselectItems();
}
});
selectAnnotation(data);
if(data.id) {
self.options.layers.forEach(function(layer_, i_) {
if (i_ != i) {
self.$annotationPanel[i_].deselectItems();
}
});
selectAnnotation(data);
}
},
submit: editAnnotation
})
@ -671,50 +678,52 @@ Ox.VideoEditor = function(options, self) {
})
.appendTo(self.$annotationsbar);
that.$element = Ox.SplitPanel({
elements: [
{
element: Ox.SplitPanel({
elements: [
{
element: self.$videobar,
size: 16
},
{
element: self.$editor
}
],
orientation: 'vertical'
})
},
{
collapsed: !self.options.showAnnotations,
collapsible: true,
element: Ox.SplitPanel({
elements: [
{
element: self.$annotationsbar,
size: 16
},
{
element: self.$annotations,
}
],
orientation: 'vertical'
})
.bindEvent({
resize: resizeAnnotations,
resizeend: resizeendAnnotations,
toggle: toggleAnnotations
}),
resizable: true,
resize: [192, 256, 320, 384],
size: self.options.annotationsSize,
tooltip: self.options.tooltips ? 'annotations' : false
}
],
orientation: 'horizontal'
});
that.setElement(
Ox.SplitPanel({
elements: [
{
element: Ox.SplitPanel({
elements: [
{
element: self.$videobar,
size: 16
},
{
element: self.$editor
}
],
orientation: 'vertical'
})
},
{
collapsed: !self.options.showAnnotations,
collapsible: true,
element: Ox.SplitPanel({
elements: [
{
element: self.$annotationsbar,
size: 16
},
{
element: self.$annotations,
}
],
orientation: 'vertical'
})
.bindEvent({
resize: resizeAnnotations,
resizeend: resizeendAnnotations,
toggle: toggleAnnotations
}),
resizable: true,
resize: [192, 256, 320, 384],
size: self.options.annotationsSize,
tooltip: self.options.tooltips ? 'annotations' : false
}
],
orientation: 'horizontal'
})
);
// we need a timeout so that a chained bindEvent
// actually catches the event
@ -920,9 +929,12 @@ Ox.VideoEditor = function(options, self) {
}
function selectAnnotation(data) {
//setPosition(data['in']);
setPoint('in', data['in']);
setPoint('out', data.out);
self.options.annotationsRange != 'position' && setPosition(data['in']);
if (data.id) {
setPoint('in', data['in']);
setPoint('out', data.out);
}
setState(data.id ? 'selected' : 'default');
}
function select(type) {
@ -933,6 +945,9 @@ Ox.VideoEditor = function(options, self) {
function setPoint(point, position) {
var otherPoint = point == 'in' ? 'out' : 'in';
self.options[point] = position;
if (self.options.state == 'selected') {
setState('default');
}
self.$player.forEach(function($player) {
$player.options(point, self.options[point]);
});
@ -1000,6 +1015,11 @@ Ox.VideoEditor = function(options, self) {
});
}
function setState(state) {
self.options.state = state;
self.$timeline[1].options({state: state});
}
function submitFindInput(value, hasPressedEnter) {
self.options.find = value;
self.results = find(self.options.find);