in video editor, keep menu and player size in sync (fixes #405)

This commit is contained in:
rlx 2012-02-15 17:29:58 +00:00
parent 972808eb17
commit 95da27d0db
4 changed files with 30 additions and 11 deletions

View file

@ -611,9 +611,7 @@ Ox.Menu = function(options, self) {
}); });
} }
} else { } else {
item.options({ item.options({checked: true});
checked: true
});
} }
} else { } else {
that.submenus[ids.shift()].checkItem(ids.join('_')); that.submenus[ids.shift()].checkItem(ids.join('_'));
@ -724,6 +722,13 @@ Ox.Menu = function(options, self) {
@*/ @*/
that.selectFirstItem = function() { that.selectFirstItem = function() {
selectNextItem(); selectNextItem();
return that;
};
that.setItemTitle = function(id, title) {
var item = getItem(id);
item && item.options({title: title});
return that;
}; };
/*@ /*@

View file

@ -143,6 +143,11 @@ Ox.MenuButton = function(options, self) {
self.superRemove(); self.superRemove();
}; };
that.setItemTitle = function(id, title) {
self.$menu.setItemTitle(id, title);
return that;
};
return that; return that;
}; };

View file

@ -140,9 +140,6 @@ Ox.VideoEditor = function(options, self) {
key_right: function() { key_right: function() {
movePositionBy(0.04); movePositionBy(0.04);
}, },
key_s: function() {
// toggleSize
},
key_shift_down: function() { key_shift_down: function() {
movePositionBy(self.options.duration); movePositionBy(self.options.duration);
}, },
@ -266,7 +263,9 @@ Ox.VideoEditor = function(options, self) {
resolution: function(data) { resolution: function(data) {
that.triggerEvent('resolution', data); that.triggerEvent('resolution', data);
}, },
size: toggleSize, size: function() {
toggleSize();
},
subtitles: function(data) { subtitles: function(data) {
that.triggerEvent('subtitles', data); that.triggerEvent('subtitles', data);
}, },
@ -417,7 +416,10 @@ Ox.VideoEditor = function(options, self) {
self.$videoMenuButton = Ox.MenuButton({ self.$videoMenuButton = Ox.MenuButton({
items: Ox.merge([ items: Ox.merge([
{id: 'toggleSize', title: 'Large Player', checked: self.options.playerSize == 'large', keyboard: 'shift +'}, {group: 'size', min: 1, max: 1, items: [
{id: 'small', title: 'Small Player', checked: self.options.videoSize == 'small'},
{id: 'large', title: 'Large Player', checked: self.options.videoSize == 'large'}
]},
{}, {},
{group: 'resolution', min: 1, max: 1, items: self.resolutions}, {group: 'resolution', min: 1, max: 1, items: self.resolutions},
{}, {},
@ -476,11 +478,11 @@ Ox.VideoEditor = function(options, self) {
}, },
change: function(data) { change: function(data) {
var id = data.id; var id = data.id;
if (id == 'toggleSize') { if (id == 'resolution') {
toggleSize();
} else if (data.id == 'resolution') {
self.options.resolution = parseInt(data.checked[0].id); self.options.resolution = parseInt(data.checked[0].id);
self.$player[0].options({resolution: self.options.resolution}); self.$player[0].options({resolution: self.options.resolution});
} else if (id == 'size') {
toggleSize();
} }
} }
}) })
@ -1208,6 +1210,10 @@ Ox.VideoEditor = function(options, self) {
function toggleSize() { function toggleSize() {
self.options.videoSize = self.options.videoSize == 'small' ? 'large' : 'small'; self.options.videoSize = self.options.videoSize == 'small' ? 'large' : 'small';
setSizes(); setSizes();
self.$videoMenuButton.checkItem(self.options.videoSize);
self.$player[0].options({
sizeIsLarge: self.options.videoSize == 'large'
});
that.triggerEvent('togglesize', { that.triggerEvent('togglesize', {
size: self.options.videoSize size: self.options.videoSize
}); });

View file

@ -126,6 +126,7 @@ Ox.VideoPlayer = function(options, self) {
showMarkers: false, showMarkers: false,
showMilliseconds: 0, showMilliseconds: 0,
showProgress: false, showProgress: false,
sizeIsLarge: false,
subtitles: [], subtitles: [],
timeline: '', timeline: '',
title: '', title: '',
@ -2344,6 +2345,8 @@ Ox.VideoPlayer = function(options, self) {
setResolution(); setResolution();
} else if (key == 'scaleToFill') { } else if (key == 'scaleToFill') {
toggleScale(); toggleScale();
} else if (key == 'sizeIsLarge') {
self.$sizeButton.toggle();
} }
}; };