[DE] Page thumbnails: add handlers

This commit is contained in:
JuliaSvinareva 2021-08-26 18:39:06 +03:00
parent 6da800f8c0
commit c89bc87017
3 changed files with 44 additions and 1 deletions

View file

@ -167,6 +167,7 @@ define([
this.leftMenu.getMenu('file').setApi(api); this.leftMenu.getMenu('file').setApi(api);
if (this.mode.canUseHistory) if (this.mode.canUseHistory)
this.getApplication().getController('Common.Controllers.History').setApi(this.api).setMode(this.mode); this.getApplication().getController('Common.Controllers.History').setApi(this.api).setMode(this.mode);
this.getApplication().getController('PageThumbnails').setApi(this.api).setMode(this.mode);
return this; return this;
}, },

View file

@ -52,6 +52,10 @@ define([
], ],
initialize: function() { initialize: function() {
this._sendUndoPoint = true;
this.addListeners({
'PageThumbnails': {}
});
}, },
events: function() { events: function() {
@ -75,6 +79,43 @@ define([
}, },
onAfterRender: function(panelThumbnails) { onAfterRender: function(panelThumbnails) {
panelThumbnails.sldrThumbnailsSize.on('change', _.bind(this.onChangeSize, this));
panelThumbnails.sldrThumbnailsSize.on('changecomplete', _.bind(this.onSizeChangeComplete, this));
panelThumbnails.buttonSettings.menu.on('item:click', this.onHighlightVisiblePart.bind(this));
},
onHighlightVisiblePart: function(menu, item, e) {
if (item.value === 'highlight') {
//console.log(item.isChecked());
}
},
onChangeSize: function(field, newValue) {
this._sliderSizeChanged = newValue;
if (this._sendUndoPoint) {
this.api.setStartPointHistory();
this._sendUndoPoint = false;
this.updateslider = setInterval(_.bind(this._sizeApplyFunc, this), 100);
}
},
onSizeChangeComplete: function(field, newValue){
clearInterval(this.updateslider);
this._sliderChanged = newValue;
if (!this._sendUndoPoint) { // start point was added
this.api.setEndPointHistory();
this._sizeApplyFunc();
}
this._sendUndoPoint = true;
},
_sizeApplyFunc: function() {
if (this._sliderChanged!==undefined) {
// apply this._sliderChanged
this._sliderChanged = undefined;
}
}, },
}, DE.Controllers.PageThumbnails || {})); }, DE.Controllers.PageThumbnails || {}));

View file

@ -109,6 +109,7 @@ define([
{ {
caption: this.textHighlightVisiblePart, caption: this.textHighlightVisiblePart,
checkable: true, checkable: true,
value: 'highlight',
toggleGroup: 'menuThumbnails' toggleGroup: 'menuThumbnails'
} }
] ]
@ -116,7 +117,7 @@ define([
}); });
} }
this.sldrthumbnailsSize = new Common.UI.SingleSlider({ this.sldrThumbnailsSize = new Common.UI.SingleSlider({
el: $('#sld-thumbnails-size'), el: $('#sld-thumbnails-size'),
width: 120, width: 120,
minValue: 0, minValue: 0,