fixing a resize bug in Ox.List

This commit is contained in:
rolux 2011-05-19 14:37:19 +02:00
parent 7f904cda1f
commit f311e05412
5 changed files with 23 additions and 5 deletions

View file

@ -10,6 +10,18 @@ Ox.load('UI', {
var subtitles = Ox.parseSRT(srt, 25), var subtitles = Ox.parseSRT(srt, 25),
layers = [ layers = [
{
editable: true,
id: 'privatenotes',
items: [],
title: 'Private Notes'
},
{
editable: true,
id: 'publicnotes',
items: [],
title: 'Public Notes'
},
{ {
id: 'subtitles', id: 'subtitles',
items: subtitles.map(function(subtitle, i) { items: subtitles.map(function(subtitle, i) {
@ -87,8 +99,8 @@ Ox.load('UI', {
Ox.UI.$window.bind({ Ox.UI.$window.bind({
resize: function() { resize: function() {
$videoEditor.options({ $videoEditor.options({
width: $appPanel.size(1), width: $appPanel.getSize(1),
height: $mainPanel.size(1) height: $mainPanel.getSize(1)
}); });
} }
}); });

View file

@ -27,6 +27,7 @@ Ox.forEach($('<div>'), function(val, key) {
if (Ox.isFunction(val)) { if (Ox.isFunction(val)) {
Ox.JQueryElement.prototype[key] = function() { Ox.JQueryElement.prototype[key] = function() {
var args = arguments, id, ret, that = this; var args = arguments, id, ret, that = this;
if (key == 'size') Ox.print('size', args)
Ox.forEach(args, function(arg, i) { Ox.forEach(args, function(arg, i) {
// if an ox object was passed // if an ox object was passed
// then pass its $element instead // then pass its $element instead

View file

@ -173,7 +173,7 @@ Ox.List = function(options, self) {
updateQuery(self.options.selected); updateQuery(self.options.selected);
} }
that.bindEvent(self.keyboardEvents); that.bindEvent(self.keyboardEvents);
Ox.UI.$window.resize(that.size); // fixme: this is not the widget's job //Ox.UI.$window.resize(that.size); // fixme: this is not the widget's job
function addAboveToSelection() { function addAboveToSelection() {
var pos = getAbove(); var pos = getAbove();

View file

@ -225,6 +225,11 @@ Ox.SplitPanel = function(options, self) {
return that; return that;
} }
}; };
that.getSize = function(id) {
var pos = Ox.isNumber(id) ? id : getPositionById(id),
element = self.options.elements[pos];
return element.element[self.dimensions[0]]() * !that.isCollapsed(pos);
};
that.toggle = function(id) { that.toggle = function(id) {
// one can pass pos instead of id // one can pass pos instead of id

View file

@ -31,7 +31,7 @@ Ox.AnnotationPanel = function(options, self) {
that.$element = new Ox.CollapsePanel({ that.$element = new Ox.CollapsePanel({
collapsed: false, collapsed: false,
extras: [ extras: self.options.editable ? [
new Ox.Button({ new Ox.Button({
id: 'add', id: 'add',
style: 'symbol', style: 'symbol',
@ -43,7 +43,7 @@ Ox.AnnotationPanel = function(options, self) {
that.triggerEvent('add', {value: ''}); that.triggerEvent('add', {value: ''});
} }
}) })
], ] : [],
size: 16, size: 16,
title: self.options.title title: self.options.title
}) })