[Libreoffice-commits] online.git: loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 8 20:48:13 UTC 2019
loleaflet/src/control/Control.PartsPreview.js | 33 ++++++++++++--------------
1 file changed, 16 insertions(+), 17 deletions(-)
New commits:
commit 1eb1adc9dacc6e877c75f82ec1c8d1fe71a053b6
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Tue Jan 8 11:23:52 2019 -0400
Commit: Henry Castro <hcastro at collabora.com>
CommitDate: Tue Jan 8 16:47:24 2019 -0400
loleaflet: create only once slide sorter scrollbar
affects performance recreating scrollbar each slide preview
Change-Id: I2e414850b920de69da119dc57310d3960b5a343e
diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index c5b24729c..f21d4811a 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -34,6 +34,7 @@ L.Control.PartsPreview = L.Control.extend({
if (!this._previewInitialized)
{
// make room for the preview
+ var control = this;
var docContainer = this._map.options.documentContainer;
L.DomUtil.addClass(docContainer, 'parts-preview-document');
setTimeout(L.bind(function () {
@@ -43,6 +44,20 @@ L.Control.PartsPreview = L.Control.extend({
var previewContBB = this._partsPreviewCont.getBoundingClientRect();
this._previewContTop = previewContBB.top;
var bottomBound = previewContBB.bottom + previewContBB.height / 2;
+
+ $('#slide-sorter').mCustomScrollbar({
+ axis: 'y',
+ theme: 'dark-thick',
+ scrollInertia: 0,
+ alwaysShowScrollbar: 1,
+ callbacks:{
+ whileScrolling: function() {
+ control._onScroll(this);
+ }
+ }
+ });
+ this._scrollContainer = $('#slide-sorter .mCSB_container').get(0);
+
for (var i = 0; i < parts; i++) {
this._previewTiles.push(this._createPreview(i, e.partNames[i], bottomBound));
}
@@ -65,7 +80,7 @@ L.Control.PartsPreview = L.Control.extend({
},
_createPreview: function (i, hashCode, bottomBound) {
- var frame = L.DomUtil.create('div', 'preview-frame', this._partsPreviewCont);
+ var frame = L.DomUtil.create('div', 'preview-frame', this._scrollContainer);
L.DomUtil.create('span', 'preview-helper', frame);
var imgClassName = 'preview-img';
@@ -187,22 +202,6 @@ L.Control.PartsPreview = L.Control.extend({
_updatePreview: function (e) {
if (this._map.getDocType() === 'presentation' || this._map.getDocType() === 'drawing') {
- // the scrollbar has to be re-initialized here else it doesn't work
- // probably a bug from the scrollbar
- var control = this;
- this._previewTiles[e.id].onload = function () {
- $('#slide-sorter').mCustomScrollbar({
- axis: 'y',
- theme: 'dark-thick',
- scrollInertia: 0,
- alwaysShowScrollbar: 1,
- callbacks:{
- whileScrolling: function() {
- control._onScroll(this);
- }
- }
- });
- };
this._previewTiles[e.id].src = e.tile;
}
},
More information about the Libreoffice-commits
mailing list