hide/show scrollbar on timeline resize

This commit is contained in:
rolux 2010-12-31 11:01:35 +00:00
parent ccd6441316
commit 9bc723d13a
3 changed files with 40 additions and 27 deletions

View File

@ -1224,6 +1224,10 @@ Video
================================================================================
*/
.OxEditor {
overflow-x: hidden;
overflow-y: auto;
}
.OxEditor .OxVideoPlayer {
position: absolute;
margin: 4px;

View File

@ -171,7 +171,7 @@ Ox.equals = function(obj0, obj1) {
ret = true;
} else if (Ox.isArray(obj0) && obj0.length == obj1.length) {
Ox.each(obj0, function(i, v) {
ret = v == obj1[i];
ret = Ox.equals(v, obj1[i]);
return ret;
});
} else if (Ox.isObject(obj0)) {
@ -1861,7 +1861,7 @@ Ox.isBoolean = function(val) {
>>> Ox.isBoolean(false)
true
*/
return typeof val == "boolean";
return typeof val == 'boolean';
};
Ox.isDate = function(val) {
@ -1879,7 +1879,7 @@ Ox.isFunction = function(val) { // is in jQuery
>>> Ox.isFunction(/ /)
false
*/
return typeof val == "function" && !Ox.isRegExp(val);
return typeof val == 'function' && !Ox.isRegExp(val);
};
Ox.isNull = function(val) {
@ -1899,7 +1899,7 @@ Ox.isNumber = function(val) {
>>> Ox.isNumber(NaN)
false
*/
return typeof val == "number" && isFinite(val);
return typeof val == 'number' && isFinite(val);
};
Ox.isObject = function(val) {
@ -1913,7 +1913,7 @@ Ox.isObject = function(val) {
>>> Ox.isObject(null)
false
*/
return typeof val == "object" && !$.isArray(val) &&
return typeof val == 'object' && !$.isArray(val) &&
!Ox.isDate(val) && !Ox.isNull(val);
};
@ -1927,10 +1927,10 @@ Ox.isRegExp = function(val) {
Ox.isString = function(val) {
/*
>>> Ox.isString("")
>>> Ox.isString('')
true
*/
return typeof val == "string";
return typeof val == 'string';
};
Ox.isUndefined = function(val) {
@ -1938,5 +1938,5 @@ Ox.isUndefined = function(val) {
>>> Ox.isUndefined()
true
*/
return typeof val == "undefined";
return typeof val == 'undefined';
};

View File

@ -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) {