make doubleclick on clip work in clips view

This commit is contained in:
rolux 2011-10-19 12:29:16 +00:00
parent 0ef3aa0ad3
commit 89ba815617
3 changed files with 29 additions and 26 deletions

View file

@ -167,10 +167,12 @@ pandora.ui.clipList = function(videoRatio) {
// so we have to make sure that selecting // so we have to make sure that selecting
// an item that already has a video // an item that already has a video
// doesn't click through to play // doesn't click through to play
///*
setTimeout(function() { setTimeout(function() {
$('.OxSelectedVideo').removeClass('OxSelectedVideo'); $('.OxSelectedVideo').removeClass('OxSelectedVideo');
$video.addClass('OxSelectedVideo'); $video.addClass('OxSelectedVideo');
}, 300); }, 300);
//*/
} }
!ui.item && pandora.UI.set('listSelection', [item]); !ui.item && pandora.UI.set('listSelection', [item]);
} else { } else {

View file

@ -7,6 +7,7 @@ pandora.ui.itemClips = function(options) {
margin: '4px' margin: '4px'
}) })
.bindEvent({ .bindEvent({
doubleclick: doubleclick,
singleclick: singleclick singleclick: singleclick
}); });
@ -43,6 +44,23 @@ pandora.ui.itemClips = function(options) {
that.append($item); that.append($item);
}); });
function doubleclick(data) {
var $item, $target = $(data.target), item, points, set;
if ($target.is('.OxSpecialTarget')) {
$item = $target.parent().parent();
item = self.options.id;
points = [$item.data('in'), $item.data('out')];
set = {};
set['videoPoints.' + item] = {
'in': points[0],
out: points[1],
position: points[0]
};
//Ox.print('SETTING VIDEO POINTS', set)
pandora.UI.set(set);
}
}
function singleclick(data) { function singleclick(data) {
var $img, $item, $target = $(data.target), $video, points; var $img, $item, $target = $(data.target), $video, points;
if ($target.is('.OxSpecialTarget')) { if ($target.is('.OxSpecialTarget')) {
@ -56,10 +74,10 @@ pandora.ui.itemClips = function(options) {
result.data.durations, points result.data.durations, points
), ),
$player = Ox.VideoPlayer({ $player = Ox.VideoPlayer({
enableMouse: true,
height: self.height, height: self.height,
'in': partsAndPoints.points[0], 'in': partsAndPoints.points[0],
out: partsAndPoints.points[1], out: partsAndPoints.points[1],
//paused: true,
playInToOut: true, playInToOut: true,
poster: '/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg', poster: '/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg',
rewind: true, rewind: true,
@ -69,25 +87,7 @@ pandora.ui.itemClips = function(options) {
}), }),
width: self.width width: self.width
}) })
.addClass('OxTarget OxSpecialTarget') .addClass('OxTarget OxSpecialTarget');
.bindEvent({
doubleclick: function() {
var item = self.options.id,
set = {
item: item,
itemView: pandora.user.ui.videoView
};
set['videoPoints.' + item] = {
'in': points[0],
out: points[1],
position: points[0]
};
pandora.UI.set(set);
},
singleclick: function() {
$player.togglePaused();
}
});
$img.replaceWith($player.$element); $img.replaceWith($player.$element);
}); });
} }

View file

@ -383,11 +383,12 @@ pandora.ui.list = function() {
pandora.$ui.selected.html(pandora.ui.status('selected', data)); pandora.$ui.selected.html(pandora.ui.status('selected', data));
}, },
open: function(data) { open: function(data) {
pandora.UI.set(Ox.extend({ var set = {item: data.ids[0]};
item: data.ids[0] if (data.isSpecialTarget) {
}, view == 'timelines' && data.isSpecialTarget ? { set.itemView = pandora.user.ui.videoView;
itemView: pandora.user.ui.videoView }
} : {})); //Ox.print('SETTING ITEM', set)
pandora.UI.set(set);
}, },
openpreview: function(data) { openpreview: function(data) {
pandora.requests.preview && pandora.api.cancel(pandora.requests.preview); pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);