[DE] Page Thumbnails panel: apply change size handler, fix styles

This commit is contained in:
JuliaSvinareva 2021-10-12 21:33:30 +03:00
parent 28142781ba
commit aa3eca7715
2 changed files with 29 additions and 30 deletions

View file

@ -53,8 +53,11 @@ define([
initialize: function() {
this._sendUndoPoint = true;
this.firstShow = true;
this.addListeners({
'PageThumbnails': {}
'PageThumbnails': {
'show': _.bind(this.onAfterShow, this)
}
});
},
@ -70,6 +73,8 @@ define([
setApi: function(api) {
this.api = api;
this.api.asc_registerCallback('asc_onViewerThumbnailsZoomUpdate', _.bind(this.updateSize, this));
this.api.asc_registerCallback('asc_onViewerBookmarksUpdate', _.bind(this.updateBookmarks, this));
return this;
},
@ -80,11 +85,23 @@ define([
onAfterRender: function(panelThumbnails) {
panelThumbnails.sldrThumbnailsSize.on('change', _.bind(this.onChangeSize, this));
panelThumbnails.sldrThumbnailsSize.on('changecomplete', _.bind(this.onSizeChangeComplete, this));
//panelThumbnails.sldrThumbnailsSize.on('changecomplete', _.bind(this.onSizeChangeComplete, this));
panelThumbnails.buttonSettings.menu.on('item:click', this.onHighlightVisiblePart.bind(this));
},
onAfterShow: function() {
this.panelThumbnails.sldrThumbnailsSize.setValue(this.thumbnailsSize * 100);
if (this.firstShow) {
this.api.asc_setViewerThumbnailsZoom(this.thumbnailsSize);
this.firstShow = false;
}
},
updateSize: function (size) {
this.thumbnailsSize = size;
},
onHighlightVisiblePart: function(menu, item, e) {
if (item.value === 'highlight') {
//console.log(item.isChecked());
@ -92,31 +109,15 @@ define([
},
onChangeSize: function(field, newValue) {
this._sliderSizeChanged = newValue;
if (this._sendUndoPoint) {
this.api.setStartPointHistory();
this._sendUndoPoint = false;
this.updateslider = setInterval(_.bind(this._sizeApplyFunc, this), 100);
if (newValue!==undefined) {
this.api.asc_setViewerThumbnailsZoom(newValue / 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;
}
},
updateBookmarks: function (t) {
var r = t;
console.log(t);
}
}, DE.Controllers.PageThumbnails || {}));
});

View file

@ -4,17 +4,15 @@
border-collapse: collapse;
#thumbnails-list {
height: 100%;
position: relative;
height: calc(100% - 45px);
width: 100%;
overflow: hidden;
padding-top: 45px;
}
#thumbnails-header {
position: absolute;
position: relative;
height: 45px;
left: 0;
top: 0;
right: 0;
padding: 12px;
overflow: hidden;
border-bottom: @scaled-one-px-value-ie solid @border-toolbar-ie;