From c1333599b9c8953beca95a37888f680b77385a17 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 2 Sep 2016 15:30:55 +0300 Subject: [PATCH] [DE][SSE] Update zoom value in the toolbar menu when editor is loading. --- apps/documenteditor/main/app/controller/Toolbar.js | 2 +- apps/documenteditor/main/app/view/Toolbar.js | 10 ++++++---- apps/spreadsheeteditor/main/app/controller/Toolbar.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 0f6a96ba0..8259d977f 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -765,7 +765,7 @@ define([ onApiZoomChange: function(percent, type) { this.toolbar.btnFitPage.setChecked(type == 2, true); this.toolbar.btnFitWidth.setChecked(type == 1, true); - + this.toolbar.mnuZoom.options.value = percent; $('.menu-zoom .zoom', this.toolbar.el).html(percent + '%'); }, diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 76fd3bd35..fff5239b5 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -748,6 +748,7 @@ define([ isChecked: function () { return this.conf.checked; } }; this.btnFitWidth = _.clone(this.btnFitPage); + this.mnuZoom = {options: {value: 100}}; this.btnAdvSettings = new Common.UI.Button({ id : 'id-toolbar-btn-settings', @@ -1169,7 +1170,7 @@ define([ checkable: true, checked: this.btnFitWidth.isChecked() }), - (new Common.UI.MenuItem({ + this.mnuZoom = new Common.UI.MenuItem({ template: _.template([ '' ].join('')), - stopPropagation: true - })) + stopPropagation: true, + value: this.mnuZoom.options.value + }) ] }) ); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index d605b098c..a8dbd4872 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -270,6 +270,7 @@ define([ this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); + this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); }, onNewDocument: function(btn, e) { @@ -1156,7 +1157,6 @@ define([ this.api.asc_registerCallback('asc_onCanRedoChanged', _.bind(this.onApiCanRevert, this, 'redo')); this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this)); this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this)); - this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.onApiSheetChanged, this)); this.api.asc_registerCallback('asc_onStopFormatPainter', _.bind(this.onApiStyleChange, this)); this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', _.bind(this.onApiSheetChanged, this));