From f311e05412f4df3697c531e211387ecff103f42c Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 19 May 2011 14:37:19 +0200 Subject: [PATCH] fixing a resize bug in Ox.List --- demos/videoeditor/js/videoeditor.js | 16 ++++++++++++++-- source/Ox.UI/js/Core/Ox.JQueryElement.js | 1 + source/Ox.UI/js/List/Ox.List.js | 2 +- source/Ox.UI/js/Panel/Ox.SplitPanel.js | 5 +++++ source/Ox.UI/js/Video/Ox.AnnotationPanel.js | 4 ++-- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/demos/videoeditor/js/videoeditor.js b/demos/videoeditor/js/videoeditor.js index a365add2..6dd6fd14 100644 --- a/demos/videoeditor/js/videoeditor.js +++ b/demos/videoeditor/js/videoeditor.js @@ -10,6 +10,18 @@ Ox.load('UI', { var subtitles = Ox.parseSRT(srt, 25), layers = [ + { + editable: true, + id: 'privatenotes', + items: [], + title: 'Private Notes' + }, + { + editable: true, + id: 'publicnotes', + items: [], + title: 'Public Notes' + }, { id: 'subtitles', items: subtitles.map(function(subtitle, i) { @@ -87,8 +99,8 @@ Ox.load('UI', { Ox.UI.$window.bind({ resize: function() { $videoEditor.options({ - width: $appPanel.size(1), - height: $mainPanel.size(1) + width: $appPanel.getSize(1), + height: $mainPanel.getSize(1) }); } }); diff --git a/source/Ox.UI/js/Core/Ox.JQueryElement.js b/source/Ox.UI/js/Core/Ox.JQueryElement.js index 3bd141c5..05a40499 100644 --- a/source/Ox.UI/js/Core/Ox.JQueryElement.js +++ b/source/Ox.UI/js/Core/Ox.JQueryElement.js @@ -27,6 +27,7 @@ Ox.forEach($('
'), function(val, key) { if (Ox.isFunction(val)) { Ox.JQueryElement.prototype[key] = function() { var args = arguments, id, ret, that = this; + if (key == 'size') Ox.print('size', args) Ox.forEach(args, function(arg, i) { // if an ox object was passed // then pass its $element instead diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index a53f45e5..d99f9363 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -173,7 +173,7 @@ Ox.List = function(options, self) { updateQuery(self.options.selected); } 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() { var pos = getAbove(); diff --git a/source/Ox.UI/js/Panel/Ox.SplitPanel.js b/source/Ox.UI/js/Panel/Ox.SplitPanel.js index 6e1f48e8..bb01b476 100644 --- a/source/Ox.UI/js/Panel/Ox.SplitPanel.js +++ b/source/Ox.UI/js/Panel/Ox.SplitPanel.js @@ -225,6 +225,11 @@ Ox.SplitPanel = function(options, self) { 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) { // one can pass pos instead of id diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index 4072a919..96bfa25f 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -31,7 +31,7 @@ Ox.AnnotationPanel = function(options, self) { that.$element = new Ox.CollapsePanel({ collapsed: false, - extras: [ + extras: self.options.editable ? [ new Ox.Button({ id: 'add', style: 'symbol', @@ -43,7 +43,7 @@ Ox.AnnotationPanel = function(options, self) { that.triggerEvent('add', {value: ''}); } }) - ], + ] : [], size: 16, title: self.options.title })