1
0
Fork 0
forked from 0x2620/oxjs

fix video editor bugs

This commit is contained in:
rlx 2012-02-04 11:44:19 +00:00
commit 76466e7eeb
6 changed files with 63 additions and 47 deletions

View file

@ -261,22 +261,27 @@ Ox.AnnotationPanel = function(options, self) {
}
function scrollToSelected(type) {
var $item = that.find('.OxEditableElement.OxSelected'),
itemHeight = $item.height() + (type == 'text' ? 8 : 0),
itemTop = $item.offset().top,
itemBottom = itemTop + itemHeight,
height = self.$folders.height(),
scrollTop = self.$folders.scrollTop(),
top = self.$folders.offset().top;
if (itemTop < top || itemBottom > top + height) {
if (itemTop < top) {
scrollTop += itemTop - top;
} else {
scrollTop += itemBottom - top - height;
try {
Ox.print('scrollToSelected $item', that.find('.OxEditableElement.OxSelected'))
var $item = that.find('.OxEditableElement.OxSelected'),
itemHeight = $item.height() + (type == 'text' ? 8 : 0),
itemTop = $item.offset().top,
itemBottom = itemTop + itemHeight,
height = self.$folders.height(),
scrollTop = self.$folders.scrollTop(),
top = self.$folders.offset().top;
if (itemTop < top || itemBottom > top + height) {
if (itemTop < top) {
scrollTop += itemTop - top;
} else {
scrollTop += itemBottom - top - height;
}
self.$folders.animate({
scrollTop: scrollTop + 'px'
}, 0);
}
self.$folders.animate({
scrollTop: scrollTop + 'px'
}, 0);
} catch(e) {
Ox.print('THIS SHOULD NOT HAPPEN');
}
}