hide/show scrollbar on timeline resize
This commit is contained in:
parent
049c0be790
commit
5dffb191ee
3 changed files with 40 additions and 27 deletions
|
@ -1224,6 +1224,10 @@ Video
|
||||||
================================================================================
|
================================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
.OxEditor {
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
.OxEditor .OxVideoPlayer {
|
.OxEditor .OxVideoPlayer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
|
|
|
@ -171,7 +171,7 @@ Ox.equals = function(obj0, obj1) {
|
||||||
ret = true;
|
ret = true;
|
||||||
} else if (Ox.isArray(obj0) && obj0.length == obj1.length) {
|
} else if (Ox.isArray(obj0) && obj0.length == obj1.length) {
|
||||||
Ox.each(obj0, function(i, v) {
|
Ox.each(obj0, function(i, v) {
|
||||||
ret = v == obj1[i];
|
ret = Ox.equals(v, obj1[i]);
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
} else if (Ox.isObject(obj0)) {
|
} else if (Ox.isObject(obj0)) {
|
||||||
|
@ -1861,7 +1861,7 @@ Ox.isBoolean = function(val) {
|
||||||
>>> Ox.isBoolean(false)
|
>>> Ox.isBoolean(false)
|
||||||
true
|
true
|
||||||
*/
|
*/
|
||||||
return typeof val == "boolean";
|
return typeof val == 'boolean';
|
||||||
};
|
};
|
||||||
|
|
||||||
Ox.isDate = function(val) {
|
Ox.isDate = function(val) {
|
||||||
|
@ -1879,7 +1879,7 @@ Ox.isFunction = function(val) { // is in jQuery
|
||||||
>>> Ox.isFunction(/ /)
|
>>> Ox.isFunction(/ /)
|
||||||
false
|
false
|
||||||
*/
|
*/
|
||||||
return typeof val == "function" && !Ox.isRegExp(val);
|
return typeof val == 'function' && !Ox.isRegExp(val);
|
||||||
};
|
};
|
||||||
|
|
||||||
Ox.isNull = function(val) {
|
Ox.isNull = function(val) {
|
||||||
|
@ -1899,7 +1899,7 @@ Ox.isNumber = function(val) {
|
||||||
>>> Ox.isNumber(NaN)
|
>>> Ox.isNumber(NaN)
|
||||||
false
|
false
|
||||||
*/
|
*/
|
||||||
return typeof val == "number" && isFinite(val);
|
return typeof val == 'number' && isFinite(val);
|
||||||
};
|
};
|
||||||
|
|
||||||
Ox.isObject = function(val) {
|
Ox.isObject = function(val) {
|
||||||
|
@ -1913,7 +1913,7 @@ Ox.isObject = function(val) {
|
||||||
>>> Ox.isObject(null)
|
>>> Ox.isObject(null)
|
||||||
false
|
false
|
||||||
*/
|
*/
|
||||||
return typeof val == "object" && !$.isArray(val) &&
|
return typeof val == 'object' && !$.isArray(val) &&
|
||||||
!Ox.isDate(val) && !Ox.isNull(val);
|
!Ox.isDate(val) && !Ox.isNull(val);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1927,10 +1927,10 @@ Ox.isRegExp = function(val) {
|
||||||
|
|
||||||
Ox.isString = function(val) {
|
Ox.isString = function(val) {
|
||||||
/*
|
/*
|
||||||
>>> Ox.isString("")
|
>>> Ox.isString('')
|
||||||
true
|
true
|
||||||
*/
|
*/
|
||||||
return typeof val == "string";
|
return typeof val == 'string';
|
||||||
};
|
};
|
||||||
|
|
||||||
Ox.isUndefined = function(val) {
|
Ox.isUndefined = function(val) {
|
||||||
|
@ -1938,5 +1938,5 @@ Ox.isUndefined = function(val) {
|
||||||
>>> Ox.isUndefined()
|
>>> Ox.isUndefined()
|
||||||
true
|
true
|
||||||
*/
|
*/
|
||||||
return typeof val == "undefined";
|
return typeof val == 'undefined';
|
||||||
};
|
};
|
||||||
|
|
|
@ -103,6 +103,8 @@ requires
|
||||||
$elements = {},
|
$elements = {},
|
||||||
$window, $document, $body;
|
$window, $document, $body;
|
||||||
|
|
||||||
|
//_$elements = $elements;
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$window = $(window),
|
$window = $(window),
|
||||||
$document = $(document),
|
$document = $(document),
|
||||||
|
@ -902,17 +904,11 @@ requires
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$elements[that.id] = that;
|
$elements[that.id] = that;
|
||||||
|
self.$eventHandler = $('<div>');
|
||||||
wrapjQuery();
|
wrapjQuery();
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// private
|
// private
|
||||||
function eventCallback(fn) {
|
|
||||||
return function(event, data) {
|
|
||||||
event.stopPropagation();
|
|
||||||
fn(event, data);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function wrapjQuery() {
|
function wrapjQuery() {
|
||||||
$.each(oxui.jQueryFunctions, function(i, fn) {
|
$.each(oxui.jQueryFunctions, function(i, fn) {
|
||||||
that[fn] = function() {
|
that[fn] = function() {
|
||||||
|
@ -988,11 +984,11 @@ requires
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
$.each(arguments[0], function(event, fn) {
|
$.each(arguments[0], function(event, fn) {
|
||||||
Ox.print(that.id, 'bind', event);
|
Ox.print(that.id, 'bind', event);
|
||||||
that.bind('ox_' + event, eventCallback(fn));
|
self.$eventHandler.bind('ox_' + event, fn);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Ox.print(that.id, 'bind', arguments[0]);
|
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;
|
return that;
|
||||||
}
|
}
|
||||||
|
@ -1061,6 +1057,7 @@ requires
|
||||||
that.remove = function() { // fixme: clashes with jquery, should be removeElement
|
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
|
//self.options && Ox.Event.unbind(self.options.id); // there are optionless elements, like the dialog layer
|
||||||
//that.loseFocus();
|
//that.loseFocus();
|
||||||
|
delete self.$eventHandler;
|
||||||
that.$element.remove();
|
that.$element.remove();
|
||||||
delete $elements[that.ox];
|
delete $elements[that.ox];
|
||||||
return that;
|
return that;
|
||||||
|
@ -1074,11 +1071,11 @@ requires
|
||||||
if (Ox.isObject(arguments[0])) {
|
if (Ox.isObject(arguments[0])) {
|
||||||
$.each(arguments[0], function(event, data) {
|
$.each(arguments[0], function(event, data) {
|
||||||
Ox.print(that.id, self.options.id, 'trigger', event, data);
|
Ox.print(that.id, self.options.id, 'trigger', event, data);
|
||||||
that.trigger('ox_' + event, data);
|
self.$eventHandler.trigger('ox_' + event, data);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Ox.print(that.id, self.options ? self.options.id : '', 'trigger', arguments[0], arguments[1] || {});
|
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;
|
return that;
|
||||||
};
|
};
|
||||||
|
@ -1091,11 +1088,11 @@ requires
|
||||||
if (arguments.length == 1) {
|
if (arguments.length == 1) {
|
||||||
$.each(arguments[0], function(event, fn) {
|
$.each(arguments[0], function(event, fn) {
|
||||||
Ox.print(that.id, 'unbind', arguments[0]);
|
Ox.print(that.id, 'unbind', arguments[0]);
|
||||||
that.unbind('ox_' + event, eventCallback(fn));
|
self.$eventHandler.unbind('ox_' + event, fn);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Ox.print(that.id, 'unbind', arguments[0]);
|
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;
|
return that;
|
||||||
};
|
};
|
||||||
|
@ -9832,12 +9829,12 @@ requires
|
||||||
width: 0
|
width: 0
|
||||||
})
|
})
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
.addClass('OxEditor')
|
.addClass('OxEditor');
|
||||||
.css({
|
/*.css({
|
||||||
//height: self.options.height + 'px',
|
//height: self.options.height + 'px',
|
||||||
overflowY: 'scroll',
|
overflowY: 'scroll',
|
||||||
//width: self.options.width + 'px'
|
//width: self.options.width + 'px'
|
||||||
});
|
});*/
|
||||||
|
|
||||||
$.extend(self, {
|
$.extend(self, {
|
||||||
$player: [],
|
$player: [],
|
||||||
|
@ -10050,9 +10047,11 @@ requires
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSizes() {
|
function getSizes(scrollbarIsVisible) {
|
||||||
|
Ox.print('getSizes', scrollbarIsVisible)
|
||||||
var scrollbarWidth = oxui.scrollbarSize,
|
var scrollbarWidth = oxui.scrollbarSize,
|
||||||
contentWidth = self.options.width - scrollbarWidth,
|
contentWidth = self.options.width - (scrollbarIsVisible ? scrollbarWidth : 0),
|
||||||
|
lines,
|
||||||
size = {
|
size = {
|
||||||
player: [],
|
player: [],
|
||||||
timeline: []
|
timeline: []
|
||||||
|
@ -10101,7 +10100,17 @@ requires
|
||||||
top: size.timeline[0].top + size.timeline[0].height + self.margin,
|
top: size.timeline[0].top + size.timeline[0].height + self.margin,
|
||||||
width: size.timeline[0].width
|
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) {
|
function goToPoint(point) {
|
||||||
|
|
Loading…
Reference in a new issue