forked from 0x2620/oxjs
add 'invertHighlight' option to video player
This commit is contained in:
parent
abb6d2a8be
commit
37fd8b2ce9
3 changed files with 20 additions and 10 deletions
|
|
@ -13,6 +13,7 @@ Ox.SmallVideoTimelineImage = function(options, self) {
|
|||
.defaults({
|
||||
duration: 0,
|
||||
imageURL: '',
|
||||
invertHighlight: false,
|
||||
'in': 0,
|
||||
mode: 'player',
|
||||
out: 0,
|
||||
|
|
@ -194,6 +195,9 @@ Ox.SmallVideoTimelineImage = function(options, self) {
|
|||
right = Math.round(
|
||||
self.options.out / self.options.duration * width
|
||||
) + 1,
|
||||
spans = self.options.invertHighlight
|
||||
? [{left: 0, right: left}, {left: right, right: width + 1}]
|
||||
: [{left: left, right: right}],
|
||||
top = 0,
|
||||
bottom = height,
|
||||
rgb = self.themeData[
|
||||
|
|
@ -202,16 +206,18 @@ Ox.SmallVideoTimelineImage = function(options, self) {
|
|||
: self.options.state == 'selected' ? 'videoTimelineSelectedGradient'
|
||||
: 'videoTimelineDefaultGradient'
|
||||
];
|
||||
Ox.loop(left, right, function(x) {
|
||||
Ox.loop(top, bottom, function(y) {
|
||||
var alpha = self.options.mode == 'editor'
|
||||
&& (y == top || y == bottom - 1) ? 255 : 128,
|
||||
color = rgb[[2, 3, 6].indexOf(x % 4 + y % 4) > -1 ? 0 : 1],
|
||||
index = x * 4 + y * 4 * width;
|
||||
data[index] = color[0];
|
||||
data[index + 1] = color[1];
|
||||
data[index + 2] = color[2];
|
||||
data[index + 3] = alpha;
|
||||
spans.forEach(function(span) {
|
||||
Ox.loop(span.left, span.right, function(x) {
|
||||
Ox.loop(top, bottom, function(y) {
|
||||
var alpha = self.options.mode == 'editor'
|
||||
&& (y == top || y == bottom - 1) ? 255 : 128,
|
||||
color = rgb[[2, 3, 6].indexOf(x % 4 + y % 4) > -1 ? 0 : 1],
|
||||
index = x * 4 + y * 4 * width;
|
||||
data[index] = color[0];
|
||||
data[index + 1] = color[1];
|
||||
data[index + 2] = color[2];
|
||||
data[index + 3] = alpha;
|
||||
});
|
||||
});
|
||||
});
|
||||
} else if (image == 'subtitles') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue