forked from 0x2620/oxjs
hide/show scrollbar on timeline resize
This commit is contained in:
parent
049c0be790
commit
5dffb191ee
3 changed files with 40 additions and 27 deletions
|
|
@ -103,6 +103,8 @@ requires
|
|||
$elements = {},
|
||||
$window, $document, $body;
|
||||
|
||||
//_$elements = $elements;
|
||||
|
||||
$(function() {
|
||||
$window = $(window),
|
||||
$document = $(document),
|
||||
|
|
@ -902,17 +904,11 @@ requires
|
|||
}
|
||||
});
|
||||
$elements[that.id] = that;
|
||||
self.$eventHandler = $('<div>');
|
||||
wrapjQuery();
|
||||
})();
|
||||
|
||||
// private
|
||||
function eventCallback(fn) {
|
||||
return function(event, data) {
|
||||
event.stopPropagation();
|
||||
fn(event, data);
|
||||
};
|
||||
}
|
||||
|
||||
function wrapjQuery() {
|
||||
$.each(oxui.jQueryFunctions, function(i, fn) {
|
||||
that[fn] = function() {
|
||||
|
|
@ -988,11 +984,11 @@ requires
|
|||
if (arguments.length == 1) {
|
||||
$.each(arguments[0], function(event, fn) {
|
||||
Ox.print(that.id, 'bind', event);
|
||||
that.bind('ox_' + event, eventCallback(fn));
|
||||
self.$eventHandler.bind('ox_' + event, fn);
|
||||
});
|
||||
} else {
|
||||
Ox.print(that.id, 'bind', arguments[0]);
|
||||
that.bind('ox_' + arguments[0], eventCallback(arguments[1]));
|
||||
self.$eventHandler.bind('ox_' + arguments[0], arguments[1]);
|
||||
}
|
||||
return that;
|
||||
}
|
||||
|
|
@ -1061,6 +1057,7 @@ requires
|
|||
that.remove = function() { // fixme: clashes with jquery, should be removeElement
|
||||
//self.options && Ox.Event.unbind(self.options.id); // there are optionless elements, like the dialog layer
|
||||
//that.loseFocus();
|
||||
delete self.$eventHandler;
|
||||
that.$element.remove();
|
||||
delete $elements[that.ox];
|
||||
return that;
|
||||
|
|
@ -1074,11 +1071,11 @@ requires
|
|||
if (Ox.isObject(arguments[0])) {
|
||||
$.each(arguments[0], function(event, data) {
|
||||
Ox.print(that.id, self.options.id, 'trigger', event, data);
|
||||
that.trigger('ox_' + event, data);
|
||||
self.$eventHandler.trigger('ox_' + event, data);
|
||||
});
|
||||
} else {
|
||||
Ox.print(that.id, self.options ? self.options.id : '', 'trigger', arguments[0], arguments[1] || {});
|
||||
that.trigger('ox_' + arguments[0], arguments[1] || {});
|
||||
self.$eventHandler.trigger('ox_' + arguments[0], arguments[1] || {});
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
|
@ -1091,11 +1088,11 @@ requires
|
|||
if (arguments.length == 1) {
|
||||
$.each(arguments[0], function(event, fn) {
|
||||
Ox.print(that.id, 'unbind', arguments[0]);
|
||||
that.unbind('ox_' + event, eventCallback(fn));
|
||||
self.$eventHandler.unbind('ox_' + event, fn);
|
||||
});
|
||||
} else {
|
||||
Ox.print(that.id, 'unbind', arguments[0]);
|
||||
that.unbind('ox_' + arguments[0], eventCallback(arguments[1]));
|
||||
self.$eventHandler.unbind('ox_' + arguments[0], arguments[1]);
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
|
@ -9832,12 +9829,12 @@ requires
|
|||
width: 0
|
||||
})
|
||||
.options(options || {})
|
||||
.addClass('OxEditor')
|
||||
.css({
|
||||
.addClass('OxEditor');
|
||||
/*.css({
|
||||
//height: self.options.height + 'px',
|
||||
overflowY: 'scroll',
|
||||
//width: self.options.width + 'px'
|
||||
});
|
||||
});*/
|
||||
|
||||
$.extend(self, {
|
||||
$player: [],
|
||||
|
|
@ -10050,9 +10047,11 @@ requires
|
|||
return position;
|
||||
}
|
||||
|
||||
function getSizes() {
|
||||
function getSizes(scrollbarIsVisible) {
|
||||
Ox.print('getSizes', scrollbarIsVisible)
|
||||
var scrollbarWidth = oxui.scrollbarSize,
|
||||
contentWidth = self.options.width - scrollbarWidth,
|
||||
contentWidth = self.options.width - (scrollbarIsVisible ? scrollbarWidth : 0),
|
||||
lines,
|
||||
size = {
|
||||
player: [],
|
||||
timeline: []
|
||||
|
|
@ -10101,7 +10100,17 @@ requires
|
|||
top: size.timeline[0].top + size.timeline[0].height + self.margin,
|
||||
width: size.timeline[0].width
|
||||
}
|
||||
return size;
|
||||
lines = Math.ceil(self.options.duration / size.timeline[1].width);
|
||||
Ox.print('lines', lines, getHeight(), self.options.height, (scrollbarIsVisible && getHeight() <= self.options.height) ? 'scroll' : 'auto')
|
||||
that.css({
|
||||
overflowY: (scrollbarIsVisible && getHeight() <= self.options.height) ? 'scroll' : 'auto'
|
||||
});
|
||||
return (!scrollbarIsVisible && getHeight() > self.options.height) ? getSizes(true) : size;
|
||||
function getHeight() {
|
||||
return size.player[0].height + self.controlsHeight +
|
||||
size.timeline[0].height + lines * 16 +
|
||||
(lines + 3) * self.margin;
|
||||
}
|
||||
}
|
||||
|
||||
function goToPoint(point) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue