diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 26fefc738..241a1b866 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -223,6 +223,7 @@ define([ listenStoreEvents: true, allowScrollbar: true, scrollAlwaysVisible: false, + minScrollbarLength: 40, showLast: true, useBSKeydown: false, cls: '' @@ -272,6 +273,7 @@ define([ me.listenStoreEvents= (me.options.listenStoreEvents!==undefined) ? me.options.listenStoreEvents : true; me.allowScrollbar = (me.options.allowScrollbar!==undefined) ? me.options.allowScrollbar : true; me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false; + me.minScrollbarLength = me.options.minScrollbarLength || 40; me.tabindex = me.options.tabindex || 0; me.delayRenderTips = me.options.delayRenderTips || false; if (me.parentMenu) @@ -355,7 +357,7 @@ define([ this.scroller = new Common.UI.Scroller({ el: $(this.el).find('.inner').addBack().filter('.inner'), useKeyboard: this.enableKeyEvents && !this.handleSelect, - minScrollbarLength : 40, + minScrollbarLength : this.minScrollbarLength, wheelSpeed: 10, alwaysVisibleY: this.scrollAlwaysVisible }); @@ -548,7 +550,7 @@ define([ this.scroller = new Common.UI.Scroller({ el: $(this.el).find('.inner').addBack().filter('.inner'), useKeyboard: this.enableKeyEvents && !this.handleSelect, - minScrollbarLength : 40, + minScrollbarLength : this.minScrollbarLength, wheelSpeed: 10, alwaysVisibleY: this.scrollAlwaysVisible }); @@ -816,7 +818,7 @@ define([ paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')), menuH = menuRoot.outerHeight(), top = parseInt(menuRoot.css('top')), - props = {minScrollbarLength : 40}; + props = {minScrollbarLength : this.minScrollbarLength}; this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible); if (top + menuH > docH ) { @@ -987,7 +989,7 @@ define([ this.scroller = new Common.UI.Scroller({ el: $(this.el).find('.inner').addBack().filter('.inner'), useKeyboard: this.enableKeyEvents && !this.handleSelect, - minScrollbarLength : 40, + minScrollbarLength : this.minScrollbarLength, wheelSpeed: 10, alwaysVisibleY: this.scrollAlwaysVisible }); @@ -1079,7 +1081,7 @@ define([ this.scroller = new Common.UI.Scroller({ el: $(this.el).find('.inner').addBack().filter('.inner'), useKeyboard: this.enableKeyEvents && !this.handleSelect, - minScrollbarLength : 40, + minScrollbarLength : this.minScrollbarLength, wheelSpeed: 10, alwaysVisibleY: this.scrollAlwaysVisible }); @@ -1287,7 +1289,7 @@ define([ paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')), menuH = menuRoot.outerHeight(), top = parseInt(menuRoot.css('top')), - props = {minScrollbarLength : 40}; + props = {minScrollbarLength : this.minScrollbarLength}; this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible); if (top + menuH > docH ) { diff --git a/apps/common/main/lib/component/TreeView.js b/apps/common/main/lib/component/TreeView.js index d362f44de..2b2ac7add 100644 --- a/apps/common/main/lib/component/TreeView.js +++ b/apps/common/main/lib/component/TreeView.js @@ -235,31 +235,31 @@ define([ var isExpanded = !record.get('isExpanded'); record.set('isExpanded', isExpanded); this.store[(isExpanded) ? 'expandSubItems' : 'collapseSubItems'](record); - this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible}); + this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); } else Common.UI.DataView.prototype.onClickItem.call(this, view, record, e); }, expandAll: function() { this.store.expandAll(); - this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible}); + this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); }, collapseAll: function() { this.store.collapseAll(); - this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible}); + this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); }, expandToLevel: function(expandLevel) { this.store.expandToLevel(expandLevel); - this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible}); + this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); }, expandRecord: function(record) { if (record) { record.set('isExpanded', true); this.store.expandSubItems(record); - this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible}); + this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); } }, @@ -267,7 +267,7 @@ define([ if (record) { record.set('isExpanded', false); this.store.collapseSubItems(record); - this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible}); + this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); } }, diff --git a/apps/common/main/lib/controller/Chat.js b/apps/common/main/lib/controller/Chat.js index 04d8474df..c012503f1 100644 --- a/apps/common/main/lib/controller/Chat.js +++ b/apps/common/main/lib/controller/Chat.js @@ -85,6 +85,14 @@ define([ storeUsers: this.getApplication().getCollection('Common.Collections.Users'), storeMessages: this.getApplication().getCollection('Common.Collections.ChatMessages') }); + this.panelChat.on('render:after', _.bind(this.onAfterRender, this)); + }, + + onAfterRender: function(panel) { + var viewport = this.getApplication().getController('Viewport').getView('Viewport'); + viewport.hlayout.on('layout:resizedrag', _.bind(function () { + panel && panel.updateScrolls(); + }, this)); }, setMode: function(mode) { diff --git a/apps/common/main/lib/controller/History.js b/apps/common/main/lib/controller/History.js index cdac7eb07..17b00a7b3 100644 --- a/apps/common/main/lib/controller/History.js +++ b/apps/common/main/lib/controller/History.js @@ -262,7 +262,7 @@ define([ store.where({isRevision: false}).forEach(function(item){ item.set('isVisible', needExpand); }); - this.panelHistory.viewHistoryList.scroller.update({minScrollbarLength: 40}); + this.panelHistory.viewHistoryList.scroller.update({minScrollbarLength: this.panelHistory.viewHistoryList.minScrollbarLength}); this.panelHistory.btnExpand.cmpEl.text(needExpand ? this.panelHistory.textHideAll : this.panelHistory.textShowAll); }, diff --git a/apps/common/main/lib/view/Chat.js b/apps/common/main/lib/view/Chat.js index 9017293c4..583c90461 100644 --- a/apps/common/main/lib/view/Chat.js +++ b/apps/common/main/lib/view/Chat.js @@ -136,7 +136,7 @@ define([ this.txtMessage.on('keydown', _.bind(this._onKeyDown, this)); this.setupLayout(); - + this.trigger('render:after', this); return this; }, diff --git a/apps/common/main/lib/view/Comments.js b/apps/common/main/lib/view/Comments.js index dd04ce064..d904467af 100644 --- a/apps/common/main/lib/view/Comments.js +++ b/apps/common/main/lib/view/Comments.js @@ -492,7 +492,7 @@ define([ }, updateScrolls: function () { if (this.commentsView && this.commentsView.scroller) { - this.commentsView.scroller.update({minScrollbarLength: 40, alwaysVisibleY: true}); + this.commentsView.scroller.update({minScrollbarLength: this.commentsView.minScrollbarLength, alwaysVisibleY: true}); } }, diff --git a/apps/common/main/lib/view/History.js b/apps/common/main/lib/view/History.js index a8d0b5130..5c79d22b9 100644 --- a/apps/common/main/lib/view/History.js +++ b/apps/common/main/lib/view/History.js @@ -110,7 +110,7 @@ define([ for(var i=1; i