forked from 0x2620/oxjs
first demo of auto-resizing textarea
This commit is contained in:
parent
67c154547c
commit
7f904cda1f
5 changed files with 175 additions and 50 deletions
|
|
@ -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
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue