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

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