1
0
Fork 0
forked from 0x2620/oxjs

first demo of auto-resizing textarea

This commit is contained in:
rolux 2011-05-19 12:18:39 +02:00
commit 7f904cda1f
5 changed files with 175 additions and 50 deletions

View file

@ -8,8 +8,8 @@ Ox.AnnotationPanel <f:Ox.Element> AnnotationPanel Object
options <o> Options object
id <s> id
items <a|[]> items
titles <s> title
type <s|text> panel type
title <s> title
type <s|'text'> panel type
width <n|0>
self <o> shared private variable
@*/
@ -35,7 +35,8 @@ Ox.AnnotationPanel = function(options, self) {
new Ox.Button({
id: 'add',
style: 'symbol',
title: 'Add',
title: 'add',
tooltip: 'Add',
type: 'image'
}).bindEvent({
click: function(event, data) {
@ -67,15 +68,17 @@ Ox.AnnotationPanel = function(options, self) {
unique: 'id'
})
.bindEvent({
cancel: function() {
},
open: function(event, data) {
if (data.ids.length == 1) {
var pos = Ox.getPositionById(self.$annotations.options('items'), data.ids[0]);
self.$annotations.editItem(pos);
}
},
'delete': function(event, data) {
that.triggerEvent('delete', data);
'remove': function(event, data) {
that.triggerEvent('remove', data);
},
select: selectAnnotation,
submit: updateAnnotation
@ -138,6 +141,7 @@ Ox.AnnotationPanel = function(options, self) {
if(self.$annotations.options('selected'))
self.$annotations.options('selected',[]);
}
return that;
};

View file

@ -72,13 +72,13 @@ Ox.VideoEditor = function(options, self) {
movePositionBy(self.sizes.timeline[0].width);
},
key_i: function() {
setPoint('in');
setPoint('in', self.options.position);
},
key_left: function() {
movePositionBy(-0.04);
},
key_o: function() {
setPoint('out');
setPoint('out', self.options.position);
},
key_openbracket: function() {
movePositionTo('subtitle', -1);
@ -176,7 +176,7 @@ Ox.VideoEditor = function(options, self) {
goToPoint(type);
},
setpoint: function() {
setPoint(type);
setPoint(type, self.options.position);
}
})
.appendTo(self.$editor);
@ -243,8 +243,8 @@ Ox.VideoEditor = function(options, self) {
.bindEvent({
add: function(event, data) {
data.layer = layer.id;
data['in'] = self.options.points[0];
data.out = self.options.points[1];
data['in'] = self.options['in'];
data.out = self.options.out;
that.triggerEvent('addAnnotation', data);
},
'delete': function(event, data) {
@ -440,24 +440,21 @@ Ox.VideoEditor = function(options, self) {
}
function goToPoint(point) {
self.options.position = self.options[point];
setPosition();
setPosition(self.options[point]);
that.triggerEvent('position', {
position: self.options.position
});
}
function movePositionBy(sec) {
self.options.position = Ox.limit(self.options.position + sec, 0, self.options.duration);
setPosition();
setPosition(Ox.limit(self.options.position + sec, 0, self.options.duration));
that.triggerEvent('position', {
position: self.options.position
});
}
function movePositionTo(type, direction) {
self.options.position = getNextPosition(type, direction);
setPosition();
setPosition(getNextPosition(type, direction));
that.triggerEvent('position', {
position: self.options.position
});
@ -497,10 +494,9 @@ Ox.VideoEditor = function(options, self) {
}
function selectAnnotation(event, data) {
self.options.position = data['in']
self.options.points = [data['in'], data.out];
setPosition();
setPoints();
setPosition(data['in']);
setPoint('in', data['in']);
setPoint('out', data.out);
}
function updateAnnotation(event, data) {
data['in'] = self.options.points[0];
@ -513,9 +509,9 @@ Ox.VideoEditor = function(options, self) {
setPoints();
}
function setPoint(point) {
function setPoint(point, position) {
var otherPoint = point == 'in' ? 'out' : 'in';
self.options[point] = self.options.position;
self.options[point] = position;
self.$player.forEach(function($player) {
$player.options(point, self.options[point]);
});
@ -526,11 +522,12 @@ Ox.VideoEditor = function(options, self) {
$timeline.options(point, self.options[point]);
});
if (self.options['in'] > self.options.out) {
setPoint(point == 'in' ? 'out' : 'in');
setPoint(point == 'in' ? 'out' : 'in', position);
}
}
function setPosition() {
function setPosition(position) {
self.options.position = position;
self.$player[0].options({
position: self.options.position
});