From 93fe766c7ba161f70174f07f85f5ef1d355f2b20 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Mon, 30 Jan 2012 22:11:05 +0000 Subject: [PATCH] fix resize bugs in calendar, list calendar etc --- source/Ox.UI/js/Calendar/Ox.Calendar.js | 5 +++-- source/Ox.UI/js/Calendar/Ox.ListCalendar.js | 3 ++- source/Ox.UI/js/List/Ox.List.js | 4 +++- source/Ox.UI/js/Video/Ox.AnnotationFolder.js | 10 ++++++++++ source/Ox.UI/js/Video/Ox.VideoEditor.js | 19 ++++++++++++++++--- source/Ox.UI/js/Window/Ox.Dialog.js | 18 ++++++------------ 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/source/Ox.UI/js/Calendar/Ox.Calendar.js b/source/Ox.UI/js/Calendar/Ox.Calendar.js index f99cf535..c4844fa6 100644 --- a/source/Ox.UI/js/Calendar/Ox.Calendar.js +++ b/source/Ox.UI/js/Calendar/Ox.Calendar.js @@ -1033,8 +1033,8 @@ Ox.Calendar = function(options, self) { function renderCalendar() { self.contentHeight = Math.max( - self.lineEvents.length * 16 + 16, // fixme: why +16 ?, - self.options.height - (self.options.showToolbar * 24) - 16 - 16 + self.lineEvents.length * 16 + 16, // fixme: why +16 ? + self.options.height - (self.options.showToolbar * 24) // self.options.height - 56 // 24 + 16 + 16 ); self.$content.css({height: self.contentHeight + 'px'}); @@ -1320,6 +1320,7 @@ Ox.Calendar = function(options, self) { }; that.resizeCalendar = function() { + Ox.print('RESIZE CALENDAR') self.options.width = that.width(); self.options.height = that.height(); self.options.showZoombar && self.$zoomInput.options({size: self.options.width}); diff --git a/source/Ox.UI/js/Calendar/Ox.ListCalendar.js b/source/Ox.UI/js/Calendar/Ox.ListCalendar.js index f81d80ef..b1a24e18 100644 --- a/source/Ox.UI/js/Calendar/Ox.ListCalendar.js +++ b/source/Ox.UI/js/Calendar/Ox.ListCalendar.js @@ -241,7 +241,7 @@ Ox.ListCalendar = function(options, self) { .bindEvent({ resize: function(data) { // triggered by SplitPanel - $element.resizeCalendar(); + self.$calendar.resizeCalendar(); }, select: selectEvent }); @@ -619,6 +619,7 @@ Ox.ListCalendar = function(options, self) { if (key == 'height') { // fixme: should be .resizeList self.$list.size(); + self.$calendar.resizeCalendar(); } else if (key == 'width') { self.$calendar.resizeCalendar(); } diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 603058d5..1067d765 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -439,6 +439,7 @@ Ox.List = function(options, self) { var height = getHeight(), lastItemHeight = height % self.options.itemHeight || self.options.itemHeight, visibleItems = Math.ceil(height / self.options.itemHeight); + Ox.print('FFP!!!', height) if (self.listLength < visibleItems) { Ox.range(self.listLength, visibleItems).forEach(function(i) { var $item = Ox.ListItem({ @@ -757,7 +758,8 @@ Ox.List = function(options, self) { self.$items[pos].appendTo(self.$pages[0]); timeA += +new Date() - time0; }); - fillFirstPage(); + // timeout needed so that height is present + setTimeout(fillFirstPage, 0); self.selected.length && scrollToPosition(self.selected[0]); Ox.Log('List', 'CONSTRUCT:', timeC, 'APPEND:', timeA); // that.triggerEvent('init', {items: self.options.items.length}); diff --git a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js index dd287011..5a4f0cf5 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationFolder.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationFolder.js @@ -294,6 +294,9 @@ Ox.AnnotationFolder = function(options, self) { function dragend(e) { if (self.options.showWidget) { + self.options.type == 'event' + ? self.$calendar.resizeCalendar() + : self.$map.resizeMap(); that.triggerEvent('resizewidget', {size: self.options.widgetSize}); } } @@ -439,6 +442,13 @@ Ox.AnnotationFolder = function(options, self) { function toggleLayer() { self.options.collapsed = !self.options.collapsed; + if ( + !self.options.collapsed + && self.options.type == 'place' + && self.options.showWidget + ) { + self.$map.resizeMap(); + } if (self.options.collapsed) { self.editing && that.blurItem(); self.$annotations.loseFocus(); diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 68b8a246..a906922d 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -28,6 +28,7 @@ Ox.VideoEditor = function(options, self) { clickLink: null, cuts: [], duration: 0, + download: false, enableSubtitles: false, find: '', fps: 25, @@ -426,9 +427,9 @@ Ox.VideoEditor = function(options, self) { {id: 'largeTimeline', title: 'Hide Large Timeline', disabled: true}, {id: 'subtitlesTimeline', title: 'Hide Subtitles on Large Timeline', disabled: true}, {}, - {id: 'downloadVideo', title: 'Download Video...', disabled: true}, - {id: 'downloadSelection', title: 'Download Selection...', disabled: true}, - {id: 'embedSelection', title: 'Embed Selection...', disabled: true}, + {id: 'downloadVideo', title: 'Download Video...', disabled: !self.options.download }, + {id: 'downloadSelection', title: 'Download Selection...', disabled: !self.options.download}, + {id: 'embedSelection', title: 'Embed Selection...', disabled: !self.options.download}, {}, {id: 'keyboard', title: 'Keyboard Shortcuts...', keyboard: 'h'} ], @@ -453,6 +454,18 @@ Ox.VideoEditor = function(options, self) { title: 'Keyboard Shortcuts', width: 256 }).open(); + } else if (id == 'download') { + that.triggerEvent('download'); + } else if (id == 'downloadSelection') { + that.triggerEvent('downloadSelection', { + 'in': self.options['in'], + out: self.options.out, + }); + } else if (id == 'embedSelection') { + that.triggerEvent('embedSelection', { + 'in': self.options['in'], + out: self.options.out, + }); } }, change: function(data) { diff --git a/source/Ox.UI/js/Window/Ox.Dialog.js b/source/Ox.UI/js/Window/Ox.Dialog.js index add4277b..32c407b5 100644 --- a/source/Ox.UI/js/Window/Ox.Dialog.js +++ b/source/Ox.UI/js/Window/Ox.Dialog.js @@ -271,7 +271,7 @@ Ox.Dialog = function(options, self) { } function maximize() { - var offset = that.offset(); + var data, offset = that.offset(); decenter(); if (!self.maximized) { self.originalLeft = offset.left; @@ -291,14 +291,12 @@ Ox.Dialog = function(options, self) { height: self.options.maxHeight }, true); self.maximized = !self.maximized; - that.triggerEvent('resize', { - width: self.options.width, - height: self.options.height - }); + data = {width: self.options.width, height: self.options.height}; + that.triggerEvent('resize', data).triggerEvent('resizeend', data); } function reset(animate) { - var offset, left, top; + var data, left, offset, top; if (!self.centered) { offset = that.offset(); left = Ox.limit( @@ -317,12 +315,8 @@ Ox.Dialog = function(options, self) { left: left, top: top }), animate); - /* - that.triggerEvent('resize', { - width: self.options.width, - height: self.options.height - }); - */ + data = {width: self.options.width, height: self.options.height}; + that.triggerEvent('resize', data).triggerEvent('resizeend', data); } function resizestart(event) {