diff --git a/apps/documenteditor/forms/app/controller/ApplicationController.js b/apps/documenteditor/forms/app/controller/ApplicationController.js index 6761785c19..c319ff0b7a 100644 --- a/apps/documenteditor/forms/app/controller/ApplicationController.js +++ b/apps/documenteditor/forms/app/controller/ApplicationController.js @@ -1728,12 +1728,23 @@ define([ (item.value!==null) && Common.UI.Themes.setTheme(item.value); }, onApiZoomChange: function(percent, type) { + var me = this; + var correspondingZoomFound = false; + this.view.mnuZoom.items[0].setChecked(type == 2, true); this.view.mnuZoom.items[1].setChecked(type == 1, true); - this.view.mnuZoom.options.value = percent; - if ( this.view.mnuZoom.$el ) - $('.menu-zoom label.zoom', this.view.mnuZoom.$el).html(percent + '%'); + this.view.mnuZoom.items.forEach(function (item, index) { + if (percent === item.value) { + me.view.mnuZoom.items[index].setChecked(true); + correspondingZoomFound = true; + }; + }); + + if (!correspondingZoomFound) + for (var i = 2; i < this.view.mnuZoom.items.length; i++) { + this.view.mnuZoom.items[i].setChecked(false); + }; }, onMenuZoomClick: function(menu, item, e){ @@ -1744,12 +1755,9 @@ define([ case 'zoom:width': item.isChecked() ? this.api.zoomFitToWidth() : this.api.zoomCustomMode(); break; + default: + this.api.zoom(item.value); } - - }, - onBtnZoom: function (btn, e) { - btn == 'up' ? this.api.zoomIn() : this.api.zoomOut(); - e.stopPropagation(); }, onDarkModeClick: function(item) { @@ -1933,8 +1941,6 @@ define([ // zoom $('#id-btn-zoom-in').on('click', this.api.zoomIn.bind(this.api)); $('#id-btn-zoom-out').on('click', this.api.zoomOut.bind(this.api)); - $('#id-menu-zoom-in').on('click', _.bind(this.onBtnZoom, this,'up')); - $('#id-menu-zoom-out').on('click', _.bind(this.onBtnZoom, this,'down')); this.view.btnOptions.menu.on('item:click', _.bind(this.onOptionsClick, this)); this.view.mnuZoom.on('item:click', _.bind(this.onMenuZoomClick, this)); diff --git a/apps/documenteditor/forms/app/view/ApplicationView.js b/apps/documenteditor/forms/app/view/ApplicationView.js index f1409ca6d5..692b4003d0 100644 --- a/apps/documenteditor/forms/app/view/ApplicationView.js +++ b/apps/documenteditor/forms/app/view/ApplicationView.js @@ -76,21 +76,17 @@ define([ items: [ {caption: this.textFitToPage, value: 'zoom:page', toggleGroup: 'view-zoom', checkable: true}, {caption: this.textFitToWidth, value: 'zoom:width', toggleGroup: 'view-zoom', checkable: true}, - (new Common.UI.MenuItem({ - template: _.template([ - '
' - ].join('')), - stopPropagation: true, - value: 30 - })) + {caption: '--'}, + {caption: '50%', value: 50, toggleGroup: 'zoom-list', checkable: true}, + {caption: '75%', value: 75, toggleGroup: 'zoom-list', checkable: true}, + {caption: '100%', value: 100, toggleGroup: 'zoom-list', checkable: true}, + {caption: '125%', value: 125, toggleGroup: 'zoom-list', checkable: true}, + {caption: '150%', value: 150, toggleGroup: 'zoom-list', checkable: true}, + {caption: '175%', value: 175, toggleGroup: 'zoom-list', checkable: true}, + {caption: '200%', value: 200, toggleGroup: 'zoom-list', checkable: true}, + {caption: '300%', value: 300, toggleGroup: 'zoom-list', checkable: true}, + {caption: '400%', value: 400, toggleGroup: 'zoom-list', checkable: true}, + {caption: '500%', value: 500, toggleGroup: 'zoom-list', checkable: true}, ] }) },