[DE] Add handler for navigation button in view tab
This commit is contained in:
parent
63e8983359
commit
4583e2014c
|
@ -45,14 +45,16 @@ define([
|
||||||
'common/main/lib/util/Shortcuts',
|
'common/main/lib/util/Shortcuts',
|
||||||
'common/main/lib/view/SaveAsDlg',
|
'common/main/lib/view/SaveAsDlg',
|
||||||
'documenteditor/main/app/view/LeftMenu',
|
'documenteditor/main/app/view/LeftMenu',
|
||||||
'documenteditor/main/app/view/FileMenu'
|
'documenteditor/main/app/view/FileMenu',
|
||||||
|
'documenteditor/main/app/view/ViewTab',
|
||||||
], function () {
|
], function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
DE.Controllers.LeftMenu = Backbone.Controller.extend(_.extend({
|
DE.Controllers.LeftMenu = Backbone.Controller.extend(_.extend({
|
||||||
views: [
|
views: [
|
||||||
'LeftMenu',
|
'LeftMenu',
|
||||||
'FileMenu'
|
'FileMenu',
|
||||||
|
'ViewTab'
|
||||||
],
|
],
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
@ -106,6 +108,9 @@ define([
|
||||||
},
|
},
|
||||||
'Common.Views.ReviewChanges': {
|
'Common.Views.ReviewChanges': {
|
||||||
'collaboration:chat': _.bind(this.onShowHideChat, this)
|
'collaboration:chat': _.bind(this.onShowHideChat, this)
|
||||||
|
},
|
||||||
|
'ViewTab': {
|
||||||
|
'viewtab:navigation': _.bind(this.onShowHideNavigation, this)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -914,6 +919,16 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onShowHideNavigation: function(state) {
|
||||||
|
if (state) {
|
||||||
|
Common.UI.Menu.Manager.hideAll();
|
||||||
|
this.leftMenu.showMenu('navigation');
|
||||||
|
} else {
|
||||||
|
this.leftMenu.btnNavigation.toggle(false, true);
|
||||||
|
this.leftMenu.onBtnMenuClick(this.leftMenu.btnNavigation);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
isCommentsVisible: function() {
|
isCommentsVisible: function() {
|
||||||
return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
|
return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible();
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,6 +58,7 @@ define([
|
||||||
},
|
},
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
this._state = {};
|
this._state = {};
|
||||||
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
setApi: function (api) {
|
setApi: function (api) {
|
||||||
|
@ -97,5 +98,20 @@ define([
|
||||||
this.SetDisabled(true);
|
this.SetDisabled(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onAppReady: function (config) {
|
||||||
|
var me = this;
|
||||||
|
(new Promise(function (accept, reject) {
|
||||||
|
accept();
|
||||||
|
})).then(function(){
|
||||||
|
me.view.setEvents();
|
||||||
|
});
|
||||||
|
if (me.view.btnNavigation) {
|
||||||
|
me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function(btn, state){
|
||||||
|
if (state !== me.view.btnNavigation.pressed)
|
||||||
|
me.view.turnNavigation(state);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
}, DE.Controllers.ViewTab || {}));
|
}, DE.Controllers.ViewTab || {}));
|
||||||
});
|
});
|
|
@ -378,6 +378,13 @@ define([
|
||||||
this.onBtnMenuClick(this.btnComments);
|
this.onBtnMenuClick(this.btnComments);
|
||||||
this.onCoauthOptions();
|
this.onCoauthOptions();
|
||||||
}
|
}
|
||||||
|
} else if (menu == 'navigation') {
|
||||||
|
if (this.btnNavigation.isVisible() &&
|
||||||
|
!this.btnNavigation.isDisabled() && !this.btnNavigation.pressed) {
|
||||||
|
this.btnNavigation.toggle(true);
|
||||||
|
this.onBtnMenuClick(this.btnNavigation);
|
||||||
|
this.onCoauthOptions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/** coauthoring end **/
|
/** coauthoring end **/
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,13 +46,16 @@ define([
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
DE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){
|
DE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){
|
||||||
function setEvents() {
|
|
||||||
var me = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
options: {},
|
options: {},
|
||||||
|
|
||||||
|
setEvents() {
|
||||||
|
var me = this;
|
||||||
|
me.btnNavigation && me.btnNavigation.on('click', function (btn, e) {
|
||||||
|
me.fireEvent('viewtab:navigation', [btn.pressed]);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
Common.UI.BaseView.prototype.initialize.call(this);
|
Common.UI.BaseView.prototype.initialize.call(this);
|
||||||
this.toolbar = options.toolbar;
|
this.toolbar = options.toolbar;
|
||||||
|
@ -68,6 +71,7 @@ define([
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
iconCls: 'toolbar__icon btn-navigation',
|
iconCls: 'toolbar__icon btn-navigation',
|
||||||
caption: this.textNavigation,
|
caption: this.textNavigation,
|
||||||
|
enableToggle: true,
|
||||||
dataHint: '1',
|
dataHint: '1',
|
||||||
dataHintDirection: 'bottom',
|
dataHintDirection: 'bottom',
|
||||||
dataHintOffset: 'small'
|
dataHintOffset: 'small'
|
||||||
|
@ -190,6 +194,10 @@ define([
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
turnNavigation: function (state) {
|
||||||
|
this.btnNavigation && this.btnNavigation.toggle(state, true);
|
||||||
|
},
|
||||||
|
|
||||||
textNavigation: 'Navigation',
|
textNavigation: 'Navigation',
|
||||||
textZoom: 'Zoom',
|
textZoom: 'Zoom',
|
||||||
textFitToPage: 'Fit To Page',
|
textFitToPage: 'Fit To Page',
|
||||||
|
|
Loading…
Reference in a new issue