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

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

View File

@ -7,6 +7,7 @@ pandora.ui.itemClips = function(options) {
margin: '4px'
})
.bindEvent({
doubleclick: doubleclick,
singleclick: singleclick
});
@ -43,6 +44,23 @@ pandora.ui.itemClips = function(options) {
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) {
var $img, $item, $target = $(data.target), $video, points;
if ($target.is('.OxSpecialTarget')) {
@ -56,10 +74,10 @@ pandora.ui.itemClips = function(options) {
result.data.durations, points
),
$player = Ox.VideoPlayer({
enableMouse: true,
height: self.height,
'in': partsAndPoints.points[0],
out: partsAndPoints.points[1],
//paused: true,
playInToOut: true,
poster: '/' + self.options.id + '/' + self.height + 'p' + points[0] + '.jpg',
rewind: true,
@ -69,25 +87,7 @@ pandora.ui.itemClips = function(options) {
}),
width: self.width
})
.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();
}
});
.addClass('OxTarget OxSpecialTarget');
$img.replaceWith($player.$element);
});
}

View File

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