[Libreoffice-commits] online.git: 36 commits - bundled/include loleaflet/css loleaflet/html loleaflet/images loleaflet/src
Marco Cecchetti (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 21 10:50:25 UTC 2019
bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h | 7
loleaflet/css/toolbar.css | 31 ++++
loleaflet/html/loleaflet.html.m4 | 1
loleaflet/images/sc_recsearch.svg | 7
loleaflet/src/control/Control.ContextMenu.js | 7
loleaflet/src/control/Control.LokDialog.js | 6
loleaflet/src/control/Control.Scroll.js | 8 -
loleaflet/src/control/Control.Toolbar.js | 33 +++-
loleaflet/src/errormessages.js | 5
loleaflet/src/geometry/Point.js | 5
loleaflet/src/layer/AnnotationManager.js | 146 +++++++++++--------
loleaflet/src/layer/marker/Annotation.js | 24 ++-
loleaflet/src/layer/tile/CalcTileLayer.js | 43 +++++
loleaflet/src/layer/tile/GridLayer.js | 25 ++-
loleaflet/src/layer/tile/ImpressTileLayer.js | 43 +++++
loleaflet/src/layer/tile/TileLayer.js | 8 -
loleaflet/src/layer/tile/WriterTileLayer.js | 43 +++++
loleaflet/src/layer/vector/SVGGroup.js | 13 -
loleaflet/src/map/Map.js | 2
loleaflet/src/map/handler/Map.FileInserter.js | 37 +++-
loleaflet/src/map/handler/Map.StateChanges.js | 4
loleaflet/src/map/handler/Map.TouchGesture.js | 127 +++++++++++++++-
22 files changed, 520 insertions(+), 105 deletions(-)
New commits:
commit 4b6807f6b9f2d7a90098f7e7eeec53cbfaa52553
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Mon Sep 16 17:05:10 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: comments layout improvements
This patch fixes the following problems:
1)
- create a document with several comments
- pan so that the comments are visible and the commented text is not
- tap on a comment box: no scroll action is performed for getting the
commented text visible
2)
Writer: in a document with a single page and a few comments,
clicking/tapping on a comment box doesn't align it with the commented
text since it is not possible to scroll the document (it is already
fully visible - it's made by a single page) and the comments are not
scrolled up/down.
Change-Id: Iaedbe9a89b5f45c322c5f9405960017cd7054e8e
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 371fe19d5..0a7c7a07b 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -414,44 +414,65 @@ L.AnnotationManager = L.Class.extend({
this._items[selectIndexFirst]._data.anchorPix = this._map._docLayer._twipsToPixels(this._items[selectIndexFirst]._data.anchorPos.min);
}
+ var anchorPx = this._items[selectIndexFirst]._data.anchorPix;
var posX = docRight.x;
- var posY = this._items[selectIndexFirst]._data.anchorPix.y;
+ var posY = anchorPx.y;
point = this._map._docLayer._twipsToPixels(this._items[selectIndexFirst]._data.anchorPos.min);
- if (L.Browser.mobile) {
- var mapBoundsPx = this._map.getPixelBounds();
- var annotationBoundsPx = this._items[selectIndexFirst].getBounds();
- var annotationSize = annotationBoundsPx.getSize();
- var topLeftPoint = L.point(posX, posY);
- annotationBoundsPx = L.bounds(topLeftPoint, topLeftPoint.add(annotationSize));
+ var mapBoundsPx = this._map.getPixelBounds();
+ var annotationBoundsPx = this._items[selectIndexFirst].getBounds();
+ var annotationSize = annotationBoundsPx.getSize();
+ var topLeftPoint = L.point(posX, posY);
+ var bottomRightPoint = topLeftPoint.add(annotationSize);
+ var scrollX = 0, scrollY = 0, spacing = 16;
+ // there is an odd gap between map top and anchor point y coordinate; is this due to the top ruler bar ?
+ // anyway without taking it into account the y-scroll offset is wrong
+ var gapY = 22;
+
+ if (this._selected !== this._lastSelected) {
+ this._lastSelected = this._selected;
+ if (anchorPx.x < mapBoundsPx.min.x) {
+ // a lot of spacing; we would need to know where is the left start of the annotated element;
+ // the anchor point is on the bottom right
+ scrollX = anchorPx.x - mapBoundsPx.min.x - 3 * spacing;
+ }
+ if (anchorPx.y < mapBoundsPx.min.y + gapY) {
+ scrollY = anchorPx.y - mapBoundsPx.min.y - gapY - spacing;
+ }
+ scrollX = Math.round(scrollX);
+ scrollY = Math.round(scrollY);
+ if (scrollX !== 0 || scrollY !== 0) {
+ this._map.fire('scrollby', {x: scrollX, y: scrollY});
+ return;
+ }
+ }
- if (!mapBoundsPx.contains(annotationBoundsPx)) {
- var scrollX = 0, scrollY = 0, spacing = 16;
+ // move the annotation box in order to make it visible but only if the annotated element is already visible
+ if (anchorPx.x >= mapBoundsPx.min.x && anchorPx.x <= mapBoundsPx.max.x
+ && anchorPx.y >= mapBoundsPx.min.y + gapY && anchorPx.y <= mapBoundsPx.max.y + gapY) {
+ scrollX = 0; scrollY = 0;
- if (annotationBoundsPx.min.x < mapBoundsPx.min.x) {
- scrollX = annotationBoundsPx.min.x - mapBoundsPx.min.x - spacing;
- } else if (annotationBoundsPx.max.x > mapBoundsPx.max.x) {
- scrollX = annotationBoundsPx.max.x - mapBoundsPx.max.x + spacing;
- }
- if (annotationBoundsPx.min.y < mapBoundsPx.min.y) {
- scrollY = annotationBoundsPx.min.y - mapBoundsPx.min.y + spacing;
- } else if (annotationBoundsPx.max.y > mapBoundsPx.max.y) {
- scrollY = annotationBoundsPx.max.y - mapBoundsPx.max.y - spacing;
- }
- scrollX = Math.round(scrollX);
- scrollY = Math.round(scrollY);
- posX -= scrollX;
- if (posX < mapBoundsPx.min.x)
- posX = Math.round(mapBoundsPx.min.x + spacing);
- posY -= scrollY;
- if (posY < mapBoundsPx.min.y)
- posY = Math.round(mapBoundsPx.min.y + spacing);
- if (posX < this._items[selectIndexFirst]._data.anchorPix.x + spacing) {
- var anchorPosMax = this._map._docLayer._twipsToPixels(this._items[selectIndexFirst]._data.anchorPos.max);
- var lineHeight = Math.round(anchorPosMax.y - this._items[selectIndexFirst]._data.anchorPix.y);
- posY += 2 * lineHeight;
- point.y += lineHeight;
- }
+ if (bottomRightPoint.x > mapBoundsPx.max.x) {
+ scrollX = bottomRightPoint.x - mapBoundsPx.max.x + spacing;
+ }
+ if (bottomRightPoint.y > mapBoundsPx.max.y) {
+ scrollY = bottomRightPoint.y - mapBoundsPx.max.y - spacing;
+ }
+ scrollX = Math.round(scrollX);
+ scrollY = Math.round(scrollY);
+ console.log('doLayout: scrollY 2: ' + scrollY);
+ posX -= scrollX;
+ if (posX < mapBoundsPx.min.x)
+ posX = Math.round(mapBoundsPx.min.x + spacing);
+ posY -= scrollY;
+ if (posY < mapBoundsPx.min.y)
+ posY = Math.round(mapBoundsPx.min.y + spacing);
+ // avoid the annotation box to cover the annotated element
+ if (posX < anchorPx.x + spacing) {
+ var anchorPosMax = this._map._docLayer._twipsToPixels(this._items[selectIndexFirst]._data.anchorPos.max);
+ var lineHeight = Math.round(anchorPosMax.y - anchorPx.y);
+ posY += 2 * lineHeight;
+ point.y += lineHeight;
}
}
@@ -461,15 +482,6 @@ L.AnnotationManager = L.Class.extend({
latlng = this._map.unproject(L.point(posX, posY));
var annotationCoords = this._map.latLngToLayerPoint(latlng);
- if (this._selected != this._lastSelected) {
- this._lastSelected = this._selected;
- var offsetX = this.options.marginX;
- var offsetY = this.options.marginY + 16;
- // Scroll to bring the comments in view, which will trigger layouting again.
- this._map.fire('scrollto', {x: posX-offsetX, y: posY-offsetY, calledFromInvalidateCursorMsg: false});
- return;
- }
-
(new L.PosAnimation()).run(this._items[selectIndexFirst]._container, annotationCoords);
this._items[selectIndexFirst].setLatLng(latlng, /*skip check bounds*/ true);
layoutBounds = this._items[selectIndexFirst].getBounds();
@@ -544,6 +556,7 @@ L.AnnotationManager = L.Class.extend({
this._selected.show();
}
} else if (this._items.length > 0) { // If nothing is selected, but there are comments:
+ this._lastSelected = null;
point = this._map.latLngToLayerPoint(this._map.unproject(L.point(topRight.x, this._items[0]._data.anchorPix.y)));
layoutBounds = L.bounds(point, point);
// Pass over all comments present
commit 91a8eccd270f8d3ba11bedebbe87a13cc275be19
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Thu Sep 19 12:38:24 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: update comments layout on pinch to zoom end
This patch mitigates but does not solve completely a problem that
seems to affect especially iOS devices when the user performs a pinch
to zoom the comments layout is not updated.
Change-Id: I04a0e91c11d07744653b6a25ffb553d22249bcb3
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 82d98b937..1d3e15c45 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -507,6 +507,13 @@ L.Map.TouchGesture = L.Handler.extend({
L.Util.cancelAnimFrame(this._animRequest);
this._map._animateZoom(this._center, finalZoom, true, true);
}
+
+ if (this._map._docLayer && this._map._docLayer._annotations) {
+ var annotations = this._map._docLayer._annotations;
+ setTimeout(function() {
+ annotations.update();
+ }, 250 /* ms */);
+ }
}
},
commit 144089e6392c50360476fd9de9a3aa3c1c218639
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Thu Sep 19 12:35:59 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: not forward mouse events to core when user tap on a comment
For instance on Writer that causes the text cursor to be moved to a
new position.
Change-Id: I92082b7d0a3b512e0ceaabcea8592d09d0da27be
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 369331ff2..82d98b937 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -301,6 +301,13 @@ L.Map.TouchGesture = L.Handler.extend({
// unselect if anything is selected already
if (this._map._docLayer && this._map._docLayer._annotations && this._map._docLayer._annotations.unselect) {
this._map._docLayer._annotations.unselect();
+ var pointPx = this._map._docLayer._twipsToPixels(mousePos);
+ var bounds = this._map._docLayer._annotations.getBounds();
+ if (bounds && bounds.contains(pointPx)) {
+ // not forward mouse events to core if the user tap on a comment box
+ // for instance on Writer that causes the text cursor to be moved
+ return;
+ }
}
this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
commit 62e1d9ad82b3227e6aefdb776ef6f93029b743de
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Thu Sep 19 12:29:55 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: writer: comments layout: comments overlaps
The selected comment can be placed far away from not selected comments
so the intersection could be empty, better to check for the y
coordinate only.
Change-Id: I2f649521bc5de44c89cbb61f76e6930aa5ccfe96
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 5a6f104aa..371fe19d5 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -335,7 +335,7 @@ L.AnnotationManager = L.Class.extend({
var posX = docRight.x + this.options.marginX;
posX = this._map.latLngToLayerPoint(this._map.unproject(L.point(posX, 0))).x;
var posY;
- if (layoutBounds.intersects(bounds)) {
+ if (layoutBounds.min.y <= bounds.max.y) {
layoutBounds.extend(layoutBounds.min.subtract([0, bounds.getSize().y]));
posY = layoutBounds.min.y;
}
@@ -377,7 +377,7 @@ L.AnnotationManager = L.Class.extend({
var posX = docRight.x + this.options.marginX;
posX = this._map.latLngToLayerPoint(this._map.unproject(L.point(posX, 0))).x;
var posY;
- if (layoutBounds.intersects(bounds)) {
+ if (layoutBounds.max.y >= bounds.min.y) {
posY = layoutBounds.getBottomLeft().y;
layoutBounds.extend(layoutBounds.max.add([0, bounds.getSize().y]));
}
commit 271889bf05b091eb3ed4f77d65160fd6eb8d4cd8
Author: merttumer <mert.tumer at collabora.com>
AuthorDate: Mon Aug 5 14:45:33 2019 +0300
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
Fix screen jumps away when inserting comments
Signed-off-by: merttumer <mert.tumer at collabora.com>
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 4f6d6f16f..5a6f104aa 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -463,8 +463,10 @@ L.AnnotationManager = L.Class.extend({
var annotationCoords = this._map.latLngToLayerPoint(latlng);
if (this._selected != this._lastSelected) {
this._lastSelected = this._selected;
+ var offsetX = this.options.marginX;
+ var offsetY = this.options.marginY + 16;
// Scroll to bring the comments in view, which will trigger layouting again.
- this._map.fire('scrollto', {x: annotationCoords.x, y: annotationCoords.y, calledFromInvalidateCursorMsg: false});
+ this._map.fire('scrollto', {x: posX-offsetX, y: posY-offsetY, calledFromInvalidateCursorMsg: false});
return;
}
commit 721b9ad7d670d9b595bd2dea46431ea44452b4c1
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Jul 4 13:49:17 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
Avoid errors on non existing objects
Change-Id: Iacf082eb356dcd0f1e52bf5c7f024d7143990655
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index da2ec79c7..4f6d6f16f 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -808,7 +808,9 @@ L.AnnotationManager = L.Class.extend({
_onAnnotationCancel: function (e) {
if (e.annotation._data.id === 'new') {
- this._map.removeLayer(this.removeItem(e.annotation._data.id));
+ var layer = this.removeItem(e.annotation._data.id);
+ if (layer)
+ this._map.removeLayer(layer);
this.updateDocBounds();
}
if (this._selected === e.annotation) {
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 5d5407bac..7623f7cd8 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -941,12 +941,11 @@ L.GridLayer = L.Layer.extend({
coords: coords
});
- if (this._tileCache[key]) {
+ if (tile && this._tileCache[key]) {
tile.src = this._tileCache[key];
}
}
}
-
}
// sort the tiles by the rows
commit 6ed4f372f94862e6752dcfc944a0d791e2623201
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jul 1 12:57:16 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
Don't jump to the previous pages when inserting a comment
Change-Id: I4d1573cd42b10388ee0265177a4c477c3a9b347d
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 7f5f5f1b1..da2ec79c7 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -464,7 +464,7 @@ L.AnnotationManager = L.Class.extend({
if (this._selected != this._lastSelected) {
this._lastSelected = this._selected;
// Scroll to bring the comments in view, which will trigger layouting again.
- this._map.fire('scrollto', {x: annotationCoords.x, y: annotationCoords.y - this.options.marginY, calledFromInvalidateCursorMsg: false});
+ this._map.fire('scrollto', {x: annotationCoords.x, y: annotationCoords.y, calledFromInvalidateCursorMsg: false});
return;
}
commit 7eba8628b5813999cd71a445ad4a3ee788742453
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Jun 30 13:32:25 2019 -0400
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
leaflet: scroll to bring the selected comment in view
Change-Id: I15888b55cd3fef266e5a7f2bedf04bdf153b6d4d
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 12217cd0f..7f5f5f1b1 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -18,6 +18,7 @@ L.AnnotationManager = L.Class.extend({
this._items = [];
this._hiddenItems = 0;
this._selected = null;
+ this._lastSelected = null; // Used to detect if selection changed.
L.setOptions(this, options);
this._arrow = L.polyline([], {color: 'darkblue', weight: 1});
this._map.on('zoomend', this._onAnnotationZoom, this);
@@ -459,7 +460,15 @@ L.AnnotationManager = L.Class.extend({
this._map.addLayer(this._arrow);
latlng = this._map.unproject(L.point(posX, posY));
- (new L.PosAnimation()).run(this._items[selectIndexFirst]._container, this._map.latLngToLayerPoint(latlng));
+ var annotationCoords = this._map.latLngToLayerPoint(latlng);
+ if (this._selected != this._lastSelected) {
+ this._lastSelected = this._selected;
+ // Scroll to bring the comments in view, which will trigger layouting again.
+ this._map.fire('scrollto', {x: annotationCoords.x, y: annotationCoords.y - this.options.marginY, calledFromInvalidateCursorMsg: false});
+ return;
+ }
+
+ (new L.PosAnimation()).run(this._items[selectIndexFirst]._container, annotationCoords);
this._items[selectIndexFirst].setLatLng(latlng, /*skip check bounds*/ true);
layoutBounds = this._items[selectIndexFirst].getBounds();
@@ -572,7 +581,6 @@ L.AnnotationManager = L.Class.extend({
me.doLayout(zoom);
}, 250 /* ms */);
} // else - avoid excessive re-layout
-
},
add: function (comment) {
commit d35508a38aa94c050f8463642153fa0565fbbc16
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Jun 30 10:25:30 2019 -0400
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
leaflet: the comments area is never scaled
extraSize is fixed because the comments are never
scaled themselves, so we shouldn't scale the extraSize.
This fixes the issue with not being able to see the
comment boxes fully, even when scrolling to the far right,
when the screen width is too small.
What happened with small screens is that the document
zoom factor (and hence the dimensions scaling) kicked
in and zoomed the document out (< 1 scaling factor).
So when we scaled the extraSize needed by the comments,
we reduced their available width and since the
comment boxes aren't scaled they were left outside
the document and outside the reach of the user.
Change-Id: I57df55963b6119d5dde878bf3e1c3ffe984b7c43
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index e88bdbe35..5d5407bac 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -390,6 +390,7 @@ L.GridLayer = L.Layer.extend({
var bottomRight = new L.Point(docPixelLimits.x, docPixelLimits.y);
bottomRight = bottomRight.multiplyBy(scale);
if (extraSize) {
+ // extraSize is unscalled.
bottomRight = bottomRight.add(extraSize);
}
bottomRight = this._map.unproject(bottomRight);
@@ -402,8 +403,11 @@ L.GridLayer = L.Layer.extend({
var scrollPixelLimits = new L.Point(this._docWidthTwips / this._tileWidthTwips,
this._docHeightTwips / this._tileHeightTwips);
- scrollPixelLimits = extraSize ? scrollPixelLimits.multiplyBy(this._tileSize).add(extraSize.multiplyBy(scale)) :
- scrollPixelLimits.multiplyBy(this._tileSize);
+ scrollPixelLimits = scrollPixelLimits.multiplyBy(this._tileSize);
+ if (extraSize) {
+ // extraSize is unscalled.
+ scrollPixelLimits = scrollPixelLimits.add(extraSize);
+ }
this._docPixelSize = {x: scrollPixelLimits.x, y: scrollPixelLimits.y};
this._map.fire('docsize', {x: scrollPixelLimits.x, y: scrollPixelLimits.y, extraSize: extraSize});
},
commit cb520986e753394f39d8d9e5671ca78e86988667
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Jun 30 10:17:15 2019 -0400
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
leaflet: misc minor improvements
* map may not have hasLayer defined during
initialization, so we protect against it.
* Show the inner html elements of the comment
boxes before showing the comment itself (smoother
UI experience).
* Reorder getBounds call first to short-circuit
early.
Change-Id: I0235d43d19c1b712df266d6e39738b1415c5d048
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index e7c801425..12217cd0f 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -294,12 +294,14 @@ L.AnnotationManager = L.Class.extend({
if (!this._map || this._map.animatingZoom || this._items.length === 0) {
return;
}
- var maxBounds = this._map.getLayerMaxBounds();
+
var thisBounds = this.getBounds();
if (!thisBounds)
return;
- var margin = this._items[0].getMargin();
+
+ var maxBounds = this._map.getLayerMaxBounds();
if (!maxBounds.contains(thisBounds)) {
+ var margin = this._items[0].getMargin();
var docBounds = this._map.getLayerDocBounds();
var delta = L.point(Math.max(thisBounds.max.x - docBounds.max.x, 0), Math.max(thisBounds.max.y - docBounds.max.y, 0));
if (delta.x > 0) {
diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index 173df6b7f..065585eda 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -71,6 +71,7 @@ L.Annotation = L.Layer.extend({
return this;
},
+ /// Returns two points: the top-left (min) and the bottom-right (max).
getBounds: function () {
var point = this._map.latLngToLayerPoint(this._latlng);
return L.bounds(point, point.add(L.point(this._container.offsetWidth, this._container.offsetHeight)));
@@ -85,7 +86,7 @@ L.Annotation = L.Layer.extend({
this._contentNode.style.display = '';
this._nodeModify.style.display = 'none';
this._nodeReply.style.display = 'none';
- if (this._data.textSelected && !this._map.hasLayer(this._data.textSelected)) {
+ if (this._data.textSelected && this._map.hasLayer && !this._map.hasLayer(this._data.textSelected)) {
this._map.addLayer(this._data.textSelected);
}
},
@@ -105,10 +106,10 @@ L.Annotation = L.Layer.extend({
},
edit: function () {
- this._container.style.visibility = '';
- this._contentNode.style.display = 'none';
this._nodeModify.style.display = '';
this._nodeReply.style.display = 'none';
+ this._container.style.visibility = '';
+ this._contentNode.style.display = 'none';
return this;
},
commit 3a6f66817b1cd0764efda53148f2f4f13cfd3c2f
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Jun 30 10:15:15 2019 -0400
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
leaflet: corrections
Get the coordinates from the first visible
annotation box, not the 0th.
Change-Id: I134369ed69653f34c365dca3acd84e8fc2ccbc13
diff --git a/loleaflet/src/control/Control.Scroll.js b/loleaflet/src/control/Control.Scroll.js
index 265640b53..043302004 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -222,8 +222,10 @@ L.Control.Scroll = L.Control.extend({
console.debug('_onUpdateSize: Ignore the scroll !');
this._ignoreScroll = true;
}
- L.DomUtil.setStyle(this._mockDoc, 'width', e.x + 'px');
- L.DomUtil.setStyle(this._mockDoc, 'height', e.y + 'px');
+
+ // Use the rounded pixel values as it makes little sense to use fractional pixels.
+ L.DomUtil.setStyle(this._mockDoc, 'width', newDocWidth + 'px');
+ L.DomUtil.setStyle(this._mockDoc, 'height', newDocHeight + 'px');
// custom scrollbar plugin checks automatically for content height changes but not for content width changes
// so we need to update scrollbars explicitly; moreover we want to avoid to have 'update' invoked twice
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index ef990549e..e7c801425 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -218,22 +218,19 @@ L.AnnotationManager = L.Class.extend({
if (this._items.length <= 0 || this._items.length === this._hiddenItems)
return null;
- var allCommentsBounds;
- var idx = 0;
- while (!allCommentsBounds) {
- if (this._items[idx].isVisible())
- allCommentsBounds = this._items[0].getBounds();
- idx++;
- }
-
- for (; idx < this._items.length; idx++) {
- if (!this._items[idx].isVisible())
- continue;
- var bounds = this._items[idx].getBounds();
- allCommentsBounds.extend(bounds.min);
- allCommentsBounds.extend(bounds.max);
+ var allCommentsBounds = null;
+ for (var idx = 0; idx < this._items.length; ++idx) {
+ if (this._items[idx].isVisible()) {
+ if (!allCommentsBounds) {
+ allCommentsBounds = this._items[idx].getBounds();
+ } else {
+ var bounds = this._items[idx].getBounds();
+ allCommentsBounds.extend(bounds.min);
+ allCommentsBounds.extend(bounds.max);
+ }
+ }
}
- return allCommentsBounds
+ return allCommentsBounds;
},
removeItem: function (id) {
commit db0d0170510e7588552e52daf95c1f2116cbf7ff
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Jun 29 20:31:28 2019 -0400
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
leaflet: correct floating-point equality comparison
The ieee 754 supports multiple representations
for the same mathematical value (such as 0 and -0).
Worse, because not all numbers can be represented
exactly, mathematically identical numbers will
not be equal (such as 0.1+0.2 != 0.3).
The proper way to compare floating-point numbers
is, therefore, to use the epsilon.
It was observed through debugging that often
we triggered layouting of comments even though
their coordinates hadn't changed, because the naive
!= comparison returned true. Also was observed
that when checking for (0,0) coordinates, sometimes
our value would be -0, which again the naive ==
comparison yields false.
Change-Id: I246fe02d3db4132bd1d7e7a1761d8a9ae1686fb2
diff --git a/loleaflet/src/geometry/Point.js b/loleaflet/src/geometry/Point.js
index 1738702d6..47d8fe433 100644
--- a/loleaflet/src/geometry/Point.js
+++ b/loleaflet/src/geometry/Point.js
@@ -98,8 +98,9 @@ L.Point.prototype = {
equals: function (point) {
point = L.point(point);
- return point.x === this.x &&
- point.y === this.y;
+ // Proper ieee 754 equality comparison.
+ return Math.abs(point.x - this.x) < Number.EPSILON &&
+ Math.abs(point.y - this.y) < Number.EPSILON;
},
contains: function (point) {
diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index b021c0f70..173df6b7f 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -62,7 +62,7 @@ L.Annotation = L.Layer.extend({
},
setLatLng: function (latlng, skipCheckBounds) {
- if (this._latlng != latlng) {
+ if (!this._latlng.equals(latlng)) {
this._skipCheckBounds = !!skipCheckBounds;
this._latlng = latlng;
this._updatePosition();
commit ff07323154bb5209b89b4012203dba3cd9befa50
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Aug 28 13:43:53 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
Not possible to unselect a comment by tapping on the document (mobile)
Copy-pasted the code used for desktop case. See _handleDOMEvent()
method.
Change-Id: I9e6c160dab74c7b837fa775e69e3ac0684faad69
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index af3b09ba7..369331ff2 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -298,6 +298,10 @@ L.Map.TouchGesture = L.Handler.extend({
this._toolbar.remove();
this._map.fire('closepopups');
+ // unselect if anything is selected already
+ if (this._map._docLayer && this._map._docLayer._annotations && this._map._docLayer._annotations.unselect) {
+ this._map._docLayer._annotations.unselect();
+ }
this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0);
commit c17ffdf327a6a0ba5a21d9924d56f08f0f86664a
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Aug 28 11:46:20 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
Writer: Adding comment doesn't focus popup, typing adds text to document
Call focus on the input field of the comment dialog after everything is
set. This focus call is also made by vex.dialog.open() method, but
the focus is lost by the modifications done after the open method.
Mobile only.
Change-Id: I6a8b9105a0682141d9cad12e3aeb41fd0efeecc5
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 56e780f1b..fc4c8d581 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -405,6 +405,8 @@ L.TileLayer = L.GridLayer.extend({
$(this._contentDate).text(isNaN(d.getTime()) ? comment.dateTime: d.toLocaleDateString(String.locale, dateOptions));
dialog.get(0).insertBefore(this._author, dialog.get(0).childNodes[0]);
+
+ dialog.find('textarea').focus();
},
clearAnnotations: function() {
commit 9a1cdfbd411c8bd2ef4ccf1703eed84e5b402105
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 20 17:43:57 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: check that the file object is reliable
Change-Id: Id46910c92e3e128295735ed6bd78ee2bf29c2617
diff --git a/loleaflet/src/map/handler/Map.FileInserter.js b/loleaflet/src/map/handler/Map.FileInserter.js
index 44dc671fd..728eb9ab0 100644
--- a/loleaflet/src/map/handler/Map.FileInserter.js
+++ b/loleaflet/src/map/handler/Map.FileInserter.js
@@ -79,6 +79,15 @@ L.Map.FileInserter = L.Handler.extend({
var map = this._map;
var url = this.getWopiUrl(map);
+ if (!(file.filename && file.url) && (file.name === '' || file.size === 0)) {
+ var errMsg = _('The file of type: %0 can not be uploaded to server since the file has no name');
+ if (file.size === 0)
+ errMsg = _('The file of type: %0 can not be uploaded to server since the file is empty');
+ errMsg.replace('%0', file.type);
+ map.fire('error', {msg: errMsg});
+ return;
+ }
+
if (window.ThisIsAMobileApp) {
// Pass the file contents as a base64-encoded parameter in an insertfile message
var reader = new FileReader();
commit 8d55ef06753d1fa1c437009a13214423b962f2c0
Author: Marco Cecchetti <mrcekets at gmail.com>
AuthorDate: Tue Aug 13 17:37:17 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
make user aware about the cause of insert file failure
Change-Id: Ia6079e09d084ef1722a1852f56d5be44b6ed0b31
diff --git a/loleaflet/src/errormessages.js b/loleaflet/src/errormessages.js
index 2d72cf4bd..16dc14086 100644
--- a/loleaflet/src/errormessages.js
+++ b/loleaflet/src/errormessages.js
@@ -42,6 +42,11 @@ if (window.ThisIsAMobileApp) {
};
}
+errorMessages.uploadfile = {
+ notfound: _('Uploading file to server failed, file not found.'),
+ toolarge: _('Uploading file to server failed, the file is too large.')
+};
+
if (typeof window !== 'undefined') {
window.errorMessages = errorMessages;
}
diff --git a/loleaflet/src/map/handler/Map.FileInserter.js b/loleaflet/src/map/handler/Map.FileInserter.js
index 969e17893..44dc671fd 100644
--- a/loleaflet/src/map/handler/Map.FileInserter.js
+++ b/loleaflet/src/map/handler/Map.FileInserter.js
@@ -3,7 +3,7 @@
* L.Map.FileInserter is handling the fileInserter action
*/
-/* global _ Uint8Array */
+/* global _ Uint8Array errorMessages */
L.Map.mergeOptions({
fileInserter: true
@@ -111,13 +111,15 @@ L.Map.FileInserter = L.Handler.extend({
socket.sendMessage('insertfile name=' + name + ' type=' + type);
}
else if (xmlHttp.status === 404) {
- console.error(_('Uploading file to server failed, file not found.'));
+ map.fire('error', {msg: errorMessages.uploadfile.notfound});
}
else if (xmlHttp.status === 413) {
- console.error(_('Uploading file to server failed, file is too large.'));
+ map.fire('error', {msg: errorMessages.uploadfile.toolarge});
}
else {
- console.error('Uploading file to server failed with status: ' + xmlHttp.status + ': ' + xmlHttp.statusText);
+ var msg = _('Uploading file to server failed with status: %0');
+ msg.replace('%0', xmlHttp.status);
+ map.fire('error', {msg: msg});
}
}
};
commit 26a2f552c0a9ea8a707a31b83d478a67dac027ba
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 20 17:23:24 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: handling server errors when uploading a file to server fails
Change-Id: I910833e23cf448697f20cb8e8173c151a11d65bf
diff --git a/loleaflet/src/map/handler/Map.FileInserter.js b/loleaflet/src/map/handler/Map.FileInserter.js
index a2047d41b..969e17893 100644
--- a/loleaflet/src/map/handler/Map.FileInserter.js
+++ b/loleaflet/src/map/handler/Map.FileInserter.js
@@ -47,7 +47,7 @@ L.Map.FileInserter = L.Handler.extend({
this._toInsert[Date.now()] = e.file;
}
else {
- this._sendFile(Date.now(), e.file);
+ this._sendFile(Date.now(), e.file, 'graphic');
}
},
@@ -64,7 +64,7 @@ L.Map.FileInserter = L.Handler.extend({
_onChildIdMsg: function (e) {
this._childId = e.id;
for (var name in this._toInsert) {
- this._sendFile(name, this._toInsert[name]);
+ this._sendFile(name, this._toInsert[name], 'graphic');
}
this._toInsert = {};
@@ -74,7 +74,7 @@ L.Map.FileInserter = L.Handler.extend({
this._toInsertURL = {};
},
- _sendFile: function (name, file) {
+ _sendFile: function (name, file, type) {
var socket = this._map._socket;
var map = this._map;
var url = this.getWopiUrl(map);
@@ -89,7 +89,7 @@ L.Map.FileInserter = L.Handler.extend({
for (var i = 0; i < byteBuffer.length; i++) {
strBytes += String.fromCharCode(byteBuffer[i]);
}
- window.postMobileMessage('insertfile name=' + aFile.name + ' type=graphic' +
+ window.postMobileMessage('insertfile name=' + aFile.name + ' type=' + type +
' data=' + window.btoa(strBytes));
};
})(file);
@@ -104,9 +104,21 @@ L.Map.FileInserter = L.Handler.extend({
var xmlHttp = new XMLHttpRequest();
this._map.showBusy(_('Uploading...'), false);
xmlHttp.onreadystatechange = function () {
- if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
+ if (xmlHttp.readyState === 4) {
map.hideBusy();
- socket.sendMessage('insertfile name=' + name + ' type=graphic');
+ socket.sendMessage('insertfile name=' + name + ' type=' + type);
+ if (xmlHttp.status === 200) {
+ socket.sendMessage('insertfile name=' + name + ' type=' + type);
+ }
+ else if (xmlHttp.status === 404) {
+ console.error(_('Uploading file to server failed, file not found.'));
+ }
+ else if (xmlHttp.status === 413) {
+ console.error(_('Uploading file to server failed, file is too large.'));
+ }
+ else {
+ console.error('Uploading file to server failed with status: ' + xmlHttp.status + ': ' + xmlHttp.statusText);
+ }
}
};
xmlHttp.open('POST', url, true);
commit 8a9502a98ce4267b717230f0a32eac42c03e6e76
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 20 15:04:54 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: re-enable date localization for calc
It seems it causes issues on IE11 but I can't see any problem after
performing some tests
Change-Id: I6da24a97f55aee3a41a05cb835fff0f04abd4036
diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index 5f9d8ad43..b021c0f70 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -384,7 +384,7 @@ L.Annotation = L.Layer.extend({
var d = new Date(this._data.dateTime.replace(/,.*/, 'Z'));
var dateOptions = { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' };
- $(this._contentDate).text((isNaN(d.getTime()) || this._map.getDocType() === 'spreadsheet')? this._data.dateTime: d.toLocaleDateString(String.locale, dateOptions));
+ $(this._contentDate).text(isNaN(d.getTime()) ? this._data.dateTime: d.toLocaleDateString(String.locale, dateOptions));
if (this._data.trackchange) {
$(this._captionText).text(this._data.description);
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 04787503e..56e780f1b 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -402,7 +402,7 @@ L.TileLayer = L.GridLayer.extend({
var d = new Date(comment.dateTime.replace(/,.*/, 'Z'));
var dateOptions = { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' };
- $(this._contentDate).text((isNaN(d.getTime()) || this._map.getDocType() === 'spreadsheet')? comment.dateTime: d.toLocaleDateString(String.locale, dateOptions));
+ $(this._contentDate).text(isNaN(d.getTime()) ? comment.dateTime: d.toLocaleDateString(String.locale, dateOptions));
dialog.get(0).insertBefore(this._author, dialog.get(0).childNodes[0]);
},
commit 84bc57c4d3711c604a29f9c20d1dcb53e4ba889d
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 20 14:56:33 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: headers/scrolling can become messed up on adding a new sheet
scroll up to 200, enter some text, add a new sheet, headers, grid
lines are wrong, swicth back to the previous sheet, now headers and
document position are wrong too
Change-Id: If9d59b5509584e92491bbce4b8db54ec5308b211
diff --git a/loleaflet/src/control/Control.Scroll.js b/loleaflet/src/control/Control.Scroll.js
index ab3fc47c6..265640b53 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -239,7 +239,7 @@ L.Control.Scroll = L.Control.extend({
_onUpdateScrollOffset: function (e) {
// used on window resize
- if (this._map._docLayer._docType === 'spreadsheet') {
+ if (e.updateHeaders && this._map._docLayer._docType === 'spreadsheet') {
var offset = new L.Point(e.x - this._prevScrollX, e.y - this._prevScrollY);
if (offset.x === 0) {
offset.x = 1;
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 26a3806d3..e88bdbe35 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -443,7 +443,7 @@ L.GridLayer = L.Layer.extend({
var newScrollPos = centerPixel.subtract(this._map.getSize().divideBy(2));
var x = Math.round(newScrollPos.x < 0 ? 0 : newScrollPos.x);
var y = Math.round(newScrollPos.y < 0 ? 0 : newScrollPos.y);
- this._map.fire('updatescrolloffset', {x: x, y: y});
+ this._map.fire('updatescrolloffset', {x: x, y: y, updateHeaders: true});
},
_setZoomTransforms: function (center, zoom) {
@@ -702,6 +702,18 @@ L.GridLayer = L.Layer.extend({
this._level.el.appendChild(fragment);
}
+
+ if (typeof (this._prevSelectedPart) === 'number' &&
+ this._prevSelectedPart !== this._selectedPart
+ && this._docType === 'spreadsheet') {
+ this._map.fire('updatescrolloffset', {x: 0, y: 0, updateHeaders: false});
+ this._map.scrollTop(0);
+ this._map.scrollLeft(0);
+ this._cellCursor = L.LatLngBounds.createDefault();
+ this._prevCellCursor = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(1, 1));
+ this._cellCursorXY = new L.Point(-1, -1);
+ this._prevCellCursorXY = new L.Point(0, 0);
+ }
},
_requestNewTiles: function () {
commit dcbf91b5976b7465418ba7c7655d4bda9de51dc5
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 20 14:41:23 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: calc: wrong index passed on appending a new tab/sheet
The wrong index prevented the execution of the code in Map.setPart
since `part < docLayer._parts` check failed.
Change-Id: I3077ffb68decc464e19ff7d54468ba5582bdc21e
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 5ec85341f..f6a2ae25c 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -237,7 +237,7 @@ function onClick(e, id, item, subItem) {
}
else if (id === 'insertsheet') {
var nPos = $('#spreadsheet-tab-scroll')[0].childElementCount;
- map.insertPage(nPos + 1);
+ map.insertPage(nPos);
$('#spreadsheet-tab-scroll').scrollLeft($('#spreadsheet-tab-scroll').prop('scrollWidth'));
}
else if (id === 'firstrecord') {
commit 96136d61114a47b8ef632734696f6282f7ad014c
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 20 14:25:56 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: timeout for triggering 'press' event increased to 500 ms
That has been done in order to avoid to trigger the context menu too
early; so the user can start panning in a relaxed way.
Change-Id: I64657efd55649584be74c96a31fbe2199a25f91a
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index e8277faab..af3b09ba7 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -37,6 +37,10 @@ L.Map.TouchGesture = L.Handler.extend({
this._hammer.get('pinch').set({
enable: true
});
+ // avoid to trigger the context menu too early so the user can start panning in a relaxed way
+ this._hammer.get('press').set({
+ time: 500
+ });
var singleTap = this._hammer.get('tap');
var doubleTap = this._hammer.get('doubletap');
commit fce665f6047da14e7a5db16f39c7e36683a06689
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 20 13:55:31 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
get spelling context menu on long press
This patch handles a new flag attached to the invalidate view cursor
message for informing the client when the text cursor is inside a
mispelled word.
This information is used for popping up the spelling context menu on a
long press event instead of the standard context menu for a selected
word.
Change-Id: Idf5994c022d66369f05f13b8549994155c9fad18
diff --git a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 40696da13..244a8ea20 100644
--- a/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -131,7 +131,12 @@ typedef enum
/**
* The size and/or the position of the visible cursor changed.
*
- * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ * Old format is the same as LOK_CALLBACK_INVALIDATE_TILES.
+ * New format is a JSON with 3 elements the 'viewId' element represented by
+ * an integer value, a 'rectangle' element in the format "x, y, width, height",
+ * and a 'mispelledWord' element represented by an integer value: '1' when
+ * a mispelled word is at the cursor position, '0' when the word is
+ * not mispelled.
*/
LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR = 1,
/**
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 062e31bd7..04787503e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1010,6 +1010,7 @@ L.TileLayer = L.GridLayer.extend({
textMsg = textMsg.substring('invalidatecursor:'.length + 1);
var obj = JSON.parse(textMsg);
var modifierViewId = parseInt(obj.viewId);
+ this._cursorAtMispelledWord = obj.mispelledWord ? Boolean(parseInt(obj.mispelledWord)).valueOf() : false;
var strTwips = obj.rectangle.match(/\d+/g);
var topLeftTwips = new L.Point(parseInt(strTwips[0]), parseInt(strTwips[1]));
var offset = new L.Point(parseInt(strTwips[2]), parseInt(strTwips[3]));
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 5808d2761..e8277faab 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -237,7 +237,8 @@ L.Map.TouchGesture = L.Handler.extend({
// check new selection if any
var graphicSelection = docLayer._graphicSelection;
var cellCursor = docLayer._cellCursor;
- if ((!graphicSelection || !graphicSelection.contains(latlng))
+ if (!docLayer._cursorAtMispelledWord
+ && (!graphicSelection || !graphicSelection.contains(latlng))
&& (!cellCursor || !cellCursor.contains(latlng))) {
// try to select text
doubleClick();
commit ac4173d8e176d900b5327a54869dbbf1a9458a7f
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sat Oct 19 18:39:53 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: lowering the minimum zoom level
... so that slide are visible on smartphones
Change-Id: I73d9ed8f74a8e88fa1f6a93ee58897511ef1daa5
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index d5feb7c25..09e7cbd98 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -31,7 +31,7 @@ L.Map = L.Evented.extend({
crs: L.CRS.Simple,
center: [0, 0],
zoom: 10,
- minZoom: 6,
+ minZoom: 4,
maxZoom: 14,
maxBounds: L.latLngBounds([0, 0], [-100, 100]),
fadeAnimation: false, // Not useful for typing.
commit b6edfc542115394eceb7700c8656a3487a7d89a1
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sat Oct 19 18:36:44 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: fix redundant press events generation
Selection handlers dragging is not handled through hammer so the event
handlers registered for hammer need to be disabled on dragging start
and enabled on dragging end: this is done by invoking
TouchGesture.removeHooks and TouchGesture.addHooks, anyway
TouchGesture.removeHooks didn't remove the 'press' event, while
TouchGesture.addHooks was adding a new 'press' event handler every
time the selection handler dragging ended.
Change-Id: I557beae1ac66fd2095b996e08dcf2eac611d216a
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index f47dead41..5808d2761 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -105,6 +105,7 @@ L.Map.TouchGesture = L.Handler.extend({
this._hammer.off('pinchmove', L.bind(this._onPinch, this));
this._hammer.off('pinchend', L.bind(this._onPinchEnd, this));
this._hammer.off('doubletap', L.bind(this._onDoubleTap, this));
+ this._hammer.off('press', L.bind(this._onPress, this));
this._hammer.off('tripletap', L.bind(this._onTripleTap, this));
this._map.off('updatepermission', this._onPermission, this);
},
commit 115264c7653369ed660cf1d692a02fcab79daeb4
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sat Oct 19 18:33:22 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: select long touched object before triggering the context menu
for selecting text we need to simulate a double click, anyway for a
graphic object a single click is enough, while a double click can lead
to switch to edit mode (not only for an embedded ole object, even for
entering text inside a shape);
a similar problem regards spreadsheet cell: a single click moves the
cell cursor, while a double click enables text input;
in order to avoid these cases, we send a single click and wait for a
few milliseconds before checking if we received a possible selection
message; if no such message is received we simulate a double click for
trying to select text and finally, in any case, we trigger the context
menu by sending a right click;
Change-Id: I16722b5f1208b9bb22c613a8417c9c34ac310033
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 56ee968a5..f47dead41 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -198,6 +198,9 @@ L.Map.TouchGesture = L.Handler.extend({
this._map.fire('closepopups');
+ var that = this;
+ var docLayer = this._map._docLayer;
+
if (window.ThisIsTheiOSApp) {
// console.log('==> ' + e.timeStamp);
if (!this._toolbar._map && this._map._docLayer.containsSelection(latlng)) {
@@ -214,10 +217,64 @@ L.Map.TouchGesture = L.Handler.extend({
this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 4, 0);
}
} else {
- this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
- // send right click to trigger context menus
- this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 4, 0);
- this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 4, 0);
+ var singleClick = function () {
+ docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
+ docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0);
+ };
+
+ var doubleClick = function () {
+ docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 2, 1, 0);
+ docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 2, 1, 0);
+ };
+
+ var rightClick = function () {
+ docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 4, 0);
+ docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 4, 0);
+ };
+
+ var waitForSelectionMsg = function () {
+ // check new selection if any
+ var graphicSelection = docLayer._graphicSelection;
+ var cellCursor = docLayer._cellCursor;
+ if ((!graphicSelection || !graphicSelection.contains(latlng))
+ && (!cellCursor || !cellCursor.contains(latlng))) {
+ // try to select text
+ doubleClick();
+ }
+ // send right click to trigger context menus
+ that._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
+ rightClick();
+ };
+
+ // we want to select the long touched object before triggering the context menu;
+ // for selecting text we need to simulate a double click, anyway for a graphic object
+ // a single click is enough, while a double click can lead to switch to edit mode
+ // (not only for an embedded ole object, even for entering text inside a shape);
+ // a similar problem regards spreadsheet cell: a single click moves the cell cursor,
+ // while a double click enables text input;
+ // in order to avoid these cases, we send a single click and wait for a few milliseconds
+ // before checking if we received a possible selection message; if no such message is received
+ // we simulate a double click for trying to select text and finally, in any case,
+ // we trigger the context menu by sending a right click
+ var graphicSelection = docLayer._graphicSelection;
+ var cellCursor = docLayer._cellCursor;
+ var textSelection;
+ if (docLayer._textSelectionStart && docLayer._textSelectionEnd)
+ textSelection = new L.LatLngBounds(docLayer._textSelectionStart.getSouthWest(), docLayer._textSelectionEnd.getNorthEast());
+
+ if ((textSelection && textSelection.contains(latlng))
+ || (graphicSelection && graphicSelection.contains(latlng))
+ || (cellCursor && cellCursor.contains(latlng))) {
+ // long touched an already selected object
+ // send right click to trigger context menus
+ this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
+ rightClick();
+ }
+ else {
+ // try to select a graphic object or move the cell cursor
+ singleClick();
+ setTimeout(waitForSelectionMsg, 300);
+ }
}
this._map.notifyActive();
commit 5ce03e8d1bb4f3bcc639046ca97383faf1f3a3ca
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sat Oct 19 17:24:08 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: avoid to have jquery context-menu in a dirty state
sometimes online receives several messages from core for the same
context menu: that probably leaves the jquery context-menu in a dirty
state, causing to not update it correctly with the new menu entries
Change-Id: I45356670978a8e8eb2c1ef5e32276b08d5042c41
diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js
index 4d67b67c3..5e61f91bd 100644
--- a/loleaflet/src/control/Control.ContextMenu.js
+++ b/loleaflet/src/control/Control.ContextMenu.js
@@ -60,6 +60,7 @@ L.Control.ContextMenu = L.Control.extend({
_onClosePopup: function () {
$.contextMenu('destroy', '.leaflet-layer');
+ this.hasContextMenu = false;
},
_onMouseDown: function(e) {
@@ -80,6 +81,9 @@ L.Control.ContextMenu = L.Control.extend({
return;
}
+ if (this.hasContextMenu) {
+ this._onClosePopup();
+ }
var contextMenu = this._createContextMenuStructure(obj);
L.installContextMenu({
selector: '.leaflet-layer',
@@ -99,6 +103,7 @@ L.Control.ContextMenu = L.Control.extend({
});
$('.leaflet-layer').contextMenu(this._prevMousePos);
+ this.hasContextMenu = true;
},
_createContextMenuStructure: function(obj) {
@@ -202,7 +207,7 @@ L.installContextMenu = function(options) {
}
rewrite(items[key].items);
}
- }
+ };
rewrite(options.items);
$.contextMenu(options);
};
commit 9c60354fda9c7005c57f150a5fffba81944d646b
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sat Oct 19 17:11:43 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: hard coded product name substitution
Change-Id: I408531859503322e3dd8d73a84c0546f369aa4dc
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 1c1c88eae..f21cc2fb9 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -3,7 +3,7 @@
* L.Control.LokDialog used for displaying LOK dialogs
*/
-/* global $ L Hammer w2ui */
+/* global $ L Hammer w2ui brandProductName */
L.WinUtil = {
};
@@ -256,6 +256,10 @@ L.Control.LokDialog = L.Control.extend({
top = parseInt(e.position.split(',')[1]);
}
+ if (e.title && typeof brandProductName !== 'undefined') {
+ e.title = e.title.replace('Collabora Office', brandProductName);
+ }
+
if (e.action === 'created') {
if (e.winType === 'dialog') {
// When left/top are invalid, the dialog shows in the center.
commit 8913d1bf2c7e1f8eb3e689fa0d49490b810bed39
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sat Oct 19 16:58:18 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: mobile: avoid cursors/handlers aren't made visible after zoom
So in same case pinch event is triggered even on a single tap. In that
cases the _onPinchEnd animation fails causing to not change
cursors/handlers opacity back to 1, for that reason I pushed a patch
which move the animation stuff to the end of _onPinchEnd and moreover
I even check that the center parameter is really defined.
Change-Id: I1f1c98fb3ad056aa14ee5657e2f5f1cf489789eb
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index 4e0fe9812..56ee968a5 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -416,8 +416,6 @@ L.Map.TouchGesture = L.Handler.extend({
zoomDelta = this._zoom - oldZoom,
finalZoom = this._map._limitZoom(zoomDelta > 0 ? Math.ceil(this._zoom) : Math.floor(this._zoom));
- L.Util.cancelAnimFrame(this._animRequest);
- this._map._animateZoom(this._center, finalZoom, true, true);
if (this._map._docLayer.isCursorVisible()) {
this._map._docLayer._cursorMarker.setOpacity(1);
}
@@ -430,6 +428,11 @@ L.Map.TouchGesture = L.Handler.extend({
if (this._map._docLayer._selectionHandles['end']) {
this._map._docLayer._selectionHandles['end'].setOpacity(1);
}
+
+ if (this._center) {
+ L.Util.cancelAnimFrame(this._animRequest);
+ this._map._animateZoom(this._center, finalZoom, true, true);
+ }
}
},
commit 5800eaa66e0744de18cbfd570fb156d21d3dd808
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sat Oct 19 16:54:16 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: hide text cursors and handlers on pinch to zoom
Change-Id: I8592d7d2bcd249cda26f769d232f17f977dc78cd
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index ae35507fa..4e0fe9812 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -369,6 +369,25 @@ L.Map.TouchGesture = L.Handler.extend({
_onPinchStart: function (e) {
if (this._map.getDocType() !== 'spreadsheet') {
this._pinchStartCenter = {x: e.center.x, y: e.center.y};
+ if (this._map._docLayer.isCursorVisible()) {
+ this._map._docLayer._cursorMarker.setOpacity(0);
+ }
+ if (this._map._clipboardContainer._cursorHandler) {
+ this._map._clipboardContainer._cursorHandler.setOpacity(0);
+ }
+ if (this._map._docLayer._selectionHandles['start']) {
+ this._map._docLayer._selectionHandles['start'].setOpacity(0);
+ }
+ if (this._map._docLayer._selectionHandles['end']) {
+ this._map._docLayer._selectionHandles['end'].setOpacity(0);
+ }
+
+ this._map._docLayer.eachView(this._map._docLayer._viewCursors, function (item) {
+ var viewCursorMarker = item.marker;
+ if (viewCursorMarker) {
+ viewCursorMarker.setOpacity(0);
+ }
+ }, this._map._docLayer, true);
}
},
@@ -399,6 +418,18 @@ L.Map.TouchGesture = L.Handler.extend({
L.Util.cancelAnimFrame(this._animRequest);
this._map._animateZoom(this._center, finalZoom, true, true);
+ if (this._map._docLayer.isCursorVisible()) {
+ this._map._docLayer._cursorMarker.setOpacity(1);
+ }
+ if (this._map._clipboardContainer._cursorHandler) {
+ this._map._clipboardContainer._cursorHandler.setOpacity(1);
+ }
+ if (this._map._docLayer._selectionHandles['start']) {
+ this._map._docLayer._selectionHandles['start'].setOpacity(1);
+ }
+ if (this._map._docLayer._selectionHandles['end']) {
+ this._map._docLayer._selectionHandles['end'].setOpacity(1);
+ }
}
},
commit ceb3dc8785d614a05a505bdaab530f6bc6ab9fe8
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sat Oct 19 16:25:13 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: mobile: search bar improvements
Change-Id: I64882620c99beadef6acfa6647083a12d96b1e9f
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 7d7ba3406..5ec85341f 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -83,13 +83,20 @@ function resizeToolbar() {
}
function _cancelSearch() {
- var toolbar = w2ui['actionbar'];
+ var toolbar = _inMobileMode() ? w2ui['searchbar'] : w2ui['actionbar'];
+ var searchInput = L.DomUtil.get('search-input');
map.resetSelection();
toolbar.hide('cancelsearch');
toolbar.disable('searchprev');
toolbar.disable('searchnext');
- L.DomUtil.get('search-input').value = '';
- map.focus();
+ searchInput.value = '';
+ if (_inMobileMode()) {
+ searchInput.focus();
+ // odd, but on mobile we need to invoke it twice
+ toolbar.hide('cancelsearch');
+ }
+ else
+ map.focus();
}
function onClick(e, id, item, subItem) {
@@ -192,6 +199,7 @@ function onClick(e, id, item, subItem) {
else if (id === 'showsearchbar') {
$('#toolbar-down').hide();
$('#toolbar-search').show();
+ L.DomUtil.get('search-input').focus();
}
else if (id === 'hidesearchbar') {
$('#toolbar-search').hide();
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 3a43c26d5..fca8845a7 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -253,7 +253,7 @@ L.CalcTileLayer = L.TileLayer.extend({
},
{type: 'button', id: 'searchprev', img: 'prev', hint: _UNO('.uno:UpSearch'), disabled: true},
{type: 'button', id: 'searchnext', img: 'next', hint: _UNO('.uno:DownSearch'), disabled: true},
- {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Cancel the search'), hidden: true},
+ {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Clear the search field'), hidden: true},
{type: 'html', id: 'left'},
{type: 'button', id: 'hidesearchbar', img: 'unfold', hint: _('Hide the search bar')}
],
@@ -261,7 +261,6 @@ L.CalcTileLayer = L.TileLayer.extend({
window.onClick(e, e.target, e.item, e.subItem);
},
onRefresh: function () {
- console.log('searchwidget.onRefresh');
$('#search-input').off('input', window.onSearch).on('input', window.onSearch);
$('#search-input').off('keydown', window.onSearchKeyDown).on('keydown', window.onSearchKeyDown);
}
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index d5c6360a5..66163c82d 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -232,7 +232,7 @@ L.ImpressTileLayer = L.TileLayer.extend({
},
{type: 'button', id: 'searchprev', img: 'prev', hint: _UNO('.uno:UpSearch'), disabled: true},
{type: 'button', id: 'searchnext', img: 'next', hint: _UNO('.uno:DownSearch'), disabled: true},
- {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Cancel the search'), hidden: true},
+ {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Clear the search field'), hidden: true},
{type: 'html', id: 'left'},
{type: 'button', id: 'hidesearchbar', img: 'unfold', hint: _('Hide the search bar')}
],
@@ -240,7 +240,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
window.onClick(e, e.target, e.item, e.subItem);
},
onRefresh: function () {
- console.log('searchwidget.onRefresh');
$('#search-input').off('input', window.onSearch).on('input', window.onSearch);
$('#search-input').off('keydown', window.onSearchKeyDown).on('keydown', window.onSearchKeyDown);
}
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js
index 32943441c..fa26b1bb2 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -178,7 +178,7 @@ L.WriterTileLayer = L.TileLayer.extend({
},
{type: 'button', id: 'searchprev', img: 'prev', hint: _UNO('.uno:UpSearch'), disabled: true},
{type: 'button', id: 'searchnext', img: 'next', hint: _UNO('.uno:DownSearch'), disabled: true},
- {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Cancel the search'), hidden: true},
+ {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Clear the search field'), hidden: true},
{type: 'html', id: 'left'},
{type: 'button', id: 'hidesearchbar', img: 'unfold', hint: _('Hide the search bar')}
],
@@ -186,7 +186,6 @@ L.WriterTileLayer = L.TileLayer.extend({
window.onClick(e, e.target, e.item, e.subItem);
},
onRefresh: function () {
- console.log('searchwidget.onRefresh');
$('#search-input').off('input', window.onSearch).on('input', window.onSearch);
$('#search-input').off('keydown', window.onSearchKeyDown).on('keydown', window.onSearchKeyDown);
}
commit 1309cdea7d6483ec3f94956ce0e67adea03006d4
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sat Oct 19 15:33:29 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: search-bar for mobile device
Change-Id: I5acb79d5bb81470aa76ce51b3e81c44909ae80e5
diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css
index 47993bca2..d229d25ce 100644
--- a/loleaflet/css/toolbar.css
+++ b/loleaflet/css/toolbar.css
@@ -291,6 +291,28 @@
background-color: #ef324e;;
}
+#toolbar-search {
+ left: 0;
+ right: 0;
+ text-align: center;
+ padding: 0;
+ position: fixed;
+ bottom: 0;
+ z-index: 1000;
+ border-top: 1px solid #bbbbbb;
+}
+
+#toolbar-search {
+ left: 0;
+ right: 0;
+ text-align: center;
+ padding: 0;
+ position: fixed;
+ bottom: 0;
+ z-index: 1000;
+ border-top: 1px solid #bbbbbb;
+}
+
w2ui-toolbar {
position: absolute;
right: 10px;
@@ -429,6 +451,14 @@ w2ui-toolbar {
width: 100%;
}
+#tb_searchbar_item_left {
+ width: 95%;
+}
+
+#tb_searchbar_item_left {
+ width: 95%;
+}
+
.w2ui-button{
margin:0 !important;
}
@@ -868,6 +898,7 @@ button.leaflet-control-search-next
.w2ui-icon.insertpage{ background: url('images/lc_insertpage.svg') no-repeat center !important; }
.w2ui-icon.insertsheet{ background: url('images/plus.svg') no-repeat center !important; }
.w2ui-icon.conditionalformatdialog{ background: url('images/lc_conditionalformatdialog.svg') no-repeat center !important; }
+.w2ui-icon.search{ background: url('images/sc_recsearch.svg') no-repeat center !important; }
.w2ui-icon.next{ background: url('images/lc_downsearch.svg') no-repeat center !important; }
.w2ui-icon.presentation{ background: url('images/lc_dia.svg') no-repeat center !important; }
.w2ui-icon.prev{ background: url('images/lc_upsearch.svg') no-repeat center !important; }
diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index ed0efcc85..7401c4724 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -185,6 +185,7 @@ ifelse(MOBILEAPP,[true],
</div>
<div id="toolbar-down" style="display: none"></div>
+ <div id="toolbar-search" style="display: none"></div>
<div id="mobile-wizard" style="display: none">
<div id="mobile-wizard-tabs"></div>
<table id="mobile-wizard-titlebar" width="100%">
diff --git a/loleaflet/images/sc_recsearch.svg b/loleaflet/images/sc_recsearch.svg
new file mode 100644
index 000000000..76a052b3f
--- /dev/null
+++ b/loleaflet/images/sc_recsearch.svg
@@ -0,0 +1,7 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
+ />
+ <path
+ style="fill:#4d4d4d"
+ d="M 6.5 2 C 4.01472 2 2 4.01472 2 6.5 C 2 8.98528 4.01472 11 6.5 11 C 7.56305 11 8.54248 10.61639 9.3125 10 L 13.3125 14 L 14 13.3125 L 10 9.3125 C 10.61639 8.54248 11 7.56305 11 6.5 C 11 4.01472 8.98528 2 6.5 2 z M 6.5 3 A 3.5 3.5 0 0 1 10 6.5 A 3.5 3.5 0 0 1 6.5 10 A 3.5 3.5 0 0 1 3 6.5 A 3.5 3.5 0 0 1 6.5 3 z "
+ />
+ </svg>
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 839a5df86..7d7ba3406 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -117,6 +117,10 @@ function onClick(e, id, item, subItem) {
toolbar = w2ui['presentation-toolbar'];
item = toolbar.get(id);
}
+ else if (w2ui['searchbar'].get(id) !== null) {
+ toolbar = w2ui['searchbar'];
+ item = toolbar.get(id);
+ }
else {
throw new Error('unknown id: ' + id);
}
@@ -185,6 +189,14 @@ function onClick(e, id, item, subItem) {
map.setPart(id);
}
}
+ else if (id === 'showsearchbar') {
+ $('#toolbar-down').hide();
+ $('#toolbar-search').show();
+ }
+ else if (id === 'hidesearchbar') {
+ $('#toolbar-search').hide();
+ $('#toolbar-down').show();
+ }
else if (id === 'searchprev') {
map.search(L.DomUtil.get('search-input').value, true);
}
@@ -733,6 +745,7 @@ var fontsSelectValue;
function createToolbar() {
if (_inMobileMode()) {
+ $('#toolbar-search').hide();
$('#mobile-edit-button').show();
} else {
$('#toolbar-down').show();
@@ -1184,7 +1197,7 @@ function unoCmdToToolbarId(commandname)
}
function onSearch() {
- var toolbar = w2ui['actionbar'];
+ var toolbar = _inMobileMode() ? w2ui['searchbar'] : w2ui['actionbar'];
// conditionally disabling until, we find a solution for tdf#108577
if (L.DomUtil.get('search-input').value === '') {
toolbar.disable('searchprev');
@@ -2505,5 +2518,7 @@ global.onStyleSelect = onStyleSelect;
global.insertTable = insertTable;
global.insertShapes = insertShapes;
global.onUpdatePermission = onUpdatePermission;
+global.onSearch = onSearch;
+global.onSearchKeyDown = onSearchKeyDown;
}(window));
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 837dd79eb..3a43c26d5 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -73,6 +73,8 @@ L.CalcTileLayer = L.TileLayer.extend({
onMobileInit: function () {
var map = this._map;
var toolItems = [
+ {type: 'button', id: 'showsearchbar', img: 'search', hint: _('Show the search bar')},
+ {type: 'break'},
{type: 'button', id: 'bold', img: 'bold', hint: _UNO('.uno:Bold'), uno: 'Bold'},
// {type: 'button', id: 'italic', img: 'italic', hint: _UNO('.uno:Italic'), uno: 'Italic'},
{type: 'button', id: 'underline', img: 'underline', hint: _UNO('.uno:Underline'), uno: 'Underline'},
@@ -236,6 +238,48 @@ L.CalcTileLayer = L.TileLayer.extend({
}
});
+ toolbar = $('#toolbar-search');
+ toolbar.w2toolbar({
+ name: 'searchbar',
+ tooltip: 'top',
+ items: [
+ {
+ type: 'html', id: 'search',
+ html: '<div style="padding: 3px 10px;" class="loleaflet-font">' +
+ ' ' + _('Search:') +
+ ' <input size="10" id="search-input"' +
+ 'style="padding: 3px; border-radius: 2px; border: 1px solid silver"/>' +
+ '</div>'
+ },
+ {type: 'button', id: 'searchprev', img: 'prev', hint: _UNO('.uno:UpSearch'), disabled: true},
+ {type: 'button', id: 'searchnext', img: 'next', hint: _UNO('.uno:DownSearch'), disabled: true},
+ {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Cancel the search'), hidden: true},
+ {type: 'html', id: 'left'},
+ {type: 'button', id: 'hidesearchbar', img: 'unfold', hint: _('Hide the search bar')}
+ ],
+ onClick: function (e) {
+ window.onClick(e, e.target, e.item, e.subItem);
+ },
+ onRefresh: function () {
+ console.log('searchwidget.onRefresh');
+ $('#search-input').off('input', window.onSearch).on('input', window.onSearch);
+ $('#search-input').off('keydown', window.onSearchKeyDown).on('keydown', window.onSearchKeyDown);
+ }
+ });
+
+ toolbar.bind('touchstart', function(e) {
+ w2ui['searchbar'].touchStarted = true;
+ var touchEvent = e.originalEvent;
+ if (touchEvent && touchEvent.touches.length > 1) {
+ L.DomEvent.preventDefault(e);
+ }
+ });
+
+ $(w2ui.searchbar.box).find('.w2ui-scroll-left, .w2ui-scroll-right').hide();
+ w2ui.searchbar.on('resize', function(target, e) {
+ e.isCancelled = true;
+ });
+
map.on('updatetoolbarcommandvalues', function() {
w2ui['editbar'].refresh();
});
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index dc2d69db3..d5c6360a5 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -104,6 +104,8 @@ L.ImpressTileLayer = L.TileLayer.extend({
onMobileInit: function () {
var map = this._map;
var toolItems = [
+ {type: 'button', id: 'showsearchbar', img: 'search', hint: _('Show the search bar')},
+ {type: 'break'},
{type: 'button', id: 'bold', img: 'bold', hint: _UNO('.uno:Bold'), uno: 'Bold'},
// {type: 'button', id: 'italic', img: 'italic', hint: _UNO('.uno:Italic'), uno: 'Italic'},
{type: 'button', id: 'underline', img: 'underline', hint: _UNO('.uno:Underline'), uno: 'Underline'},
@@ -215,6 +217,48 @@ L.ImpressTileLayer = L.TileLayer.extend({
}
});
+ toolbar = $('#toolbar-search');
+ toolbar.w2toolbar({
+ name: 'searchbar',
+ tooltip: 'top',
+ items: [
+ {
+ type: 'html', id: 'search',
+ html: '<div style="padding: 3px 10px;" class="loleaflet-font">' +
+ ' ' + _('Search:') +
+ ' <input size="10" id="search-input"' +
+ 'style="padding: 3px; border-radius: 2px; border: 1px solid silver"/>' +
+ '</div>'
+ },
+ {type: 'button', id: 'searchprev', img: 'prev', hint: _UNO('.uno:UpSearch'), disabled: true},
+ {type: 'button', id: 'searchnext', img: 'next', hint: _UNO('.uno:DownSearch'), disabled: true},
+ {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Cancel the search'), hidden: true},
+ {type: 'html', id: 'left'},
+ {type: 'button', id: 'hidesearchbar', img: 'unfold', hint: _('Hide the search bar')}
+ ],
+ onClick: function (e) {
+ window.onClick(e, e.target, e.item, e.subItem);
+ },
+ onRefresh: function () {
+ console.log('searchwidget.onRefresh');
+ $('#search-input').off('input', window.onSearch).on('input', window.onSearch);
+ $('#search-input').off('keydown', window.onSearchKeyDown).on('keydown', window.onSearchKeyDown);
+ }
+ });
+
+ toolbar.bind('touchstart', function(e) {
+ w2ui['searchbar'].touchStarted = true;
+ var touchEvent = e.originalEvent;
+ if (touchEvent && touchEvent.touches.length > 1) {
+ L.DomEvent.preventDefault(e);
+ }
+ });
+
+ $(w2ui.searchbar.box).find('.w2ui-scroll-left, .w2ui-scroll-right').hide();
+ w2ui.searchbar.on('resize', function(target, e) {
+ e.isCancelled = true;
+ });
+
map.on('updatetoolbarcommandvalues', function() {
w2ui['editbar'].refresh();
});
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js
index 2b50e443c..32943441c 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -53,6 +53,8 @@ L.WriterTileLayer = L.TileLayer.extend({
onMobileInit: function () {
var map = this._map;
var toolItems = [
+ {type: 'button', id: 'showsearchbar', img: 'search', hint: _('Show the search bar')},
+ {type: 'break'},
{type: 'button', id: 'bold', img: 'bold', hint: _UNO('.uno:Bold'), uno: 'Bold'},
{type: 'button', id: 'italic', img: 'italic', hint: _UNO('.uno:Italic'), uno: 'Italic'},
{type: 'button', id: 'underline', img: 'underline', hint: _UNO('.uno:Underline'), uno: 'Underline'},
@@ -161,6 +163,48 @@ L.WriterTileLayer = L.TileLayer.extend({
}
});
+ toolbar = $('#toolbar-search');
+ toolbar.w2toolbar({
+ name: 'searchbar',
+ tooltip: 'top',
+ items: [
+ {
+ type: 'html', id: 'search',
+ html: '<div style="padding: 3px 10px;" class="loleaflet-font">' +
+ ' ' + _('Search:') +
+ ' <input size="10" id="search-input"' +
+ 'style="padding: 3px; border-radius: 2px; border: 1px solid silver"/>' +
+ '</div>'
+ },
+ {type: 'button', id: 'searchprev', img: 'prev', hint: _UNO('.uno:UpSearch'), disabled: true},
+ {type: 'button', id: 'searchnext', img: 'next', hint: _UNO('.uno:DownSearch'), disabled: true},
+ {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Cancel the search'), hidden: true},
+ {type: 'html', id: 'left'},
+ {type: 'button', id: 'hidesearchbar', img: 'unfold', hint: _('Hide the search bar')}
+ ],
+ onClick: function (e) {
+ window.onClick(e, e.target, e.item, e.subItem);
+ },
+ onRefresh: function () {
+ console.log('searchwidget.onRefresh');
+ $('#search-input').off('input', window.onSearch).on('input', window.onSearch);
+ $('#search-input').off('keydown', window.onSearchKeyDown).on('keydown', window.onSearchKeyDown);
+ }
+ });
+
+ toolbar.bind('touchstart', function(e) {
+ w2ui['searchbar'].touchStarted = true;
+ var touchEvent = e.originalEvent;
+ if (touchEvent && touchEvent.touches.length > 1) {
+ L.DomEvent.preventDefault(e);
+ }
+ });
+
+ $(w2ui.searchbar.box).find('.w2ui-scroll-left, .w2ui-scroll-right').hide();
+ w2ui.searchbar.on('resize', function(target, e) {
+ e.isCancelled = true;
+ });
+
map.on('updatepermission', window.onUpdatePermission);
},
commit c4075298fb45e1ea35e3e9f3e7cc7755f794f779
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Fri Oct 18 10:38:32 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: limit mouseout event to constrained dragging
When drag a shape or image very quickly, the mouse pointer can get out
of the dragged object causing an unexpected drag action end.
So better to limit the mouseout event only where it is really needed.
Change-Id: I68fa596c17be0c80112ea755f446e6705e07f81a
diff --git a/loleaflet/src/layer/vector/SVGGroup.js b/loleaflet/src/layer/vector/SVGGroup.js
index f571a5eab..a44418df3 100644
--- a/loleaflet/src/layer/vector/SVGGroup.js
+++ b/loleaflet/src/layer/vector/SVGGroup.js
@@ -68,7 +68,8 @@ L.SVGGroup = L.Layer.extend({
if (!this.options.manualDrag) {
L.DomEvent.on(this._dragShape, 'mousemove', this._onDrag, this);
L.DomEvent.on(this._dragShape, 'mouseup', this._onDragEnd, this);
- L.DomEvent.on(this._dragShape, 'mouseout', this._onDragEnd, this);
+ if (this.dragging.constraint)
+ L.DomEvent.on(this._dragShape, 'mouseout', this._onDragEnd, this);
}
var data = {
@@ -100,7 +101,8 @@ L.SVGGroup = L.Layer.extend({
if (!this.options.manualDrag) {
L.DomEvent.off(this._dragShape, 'mousemove', this._onDrag, this);
L.DomEvent.off(this._dragShape, 'mouseup', this._onDragEnd, this);
- L.DomEvent.off(this._dragShape, 'mouseout', this._onDragEnd, this);
+ if (this.dragging.constraint)
+ L.DomEvent.off(this._dragShape, 'mouseout', this._onDragEnd, this);
}
this._moved = false;
commit d0fb7d1f4fc2c3fd2936616e738c707cf7430841
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Thu Oct 17 10:06:10 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
Revert "suppress mouseout even when dragging a graphic selection"
This reverts commit 1e044a40aa9e0b8e2313d4677755c630cb444448.
The mouseout issue is going to be fixed by a cheery-picked commit:
"loleaflet: limit mouseout event to constrained dragging"
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 7587096fb..062e31bd7 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -2597,8 +2597,7 @@ L.TileLayer = L.GridLayer.extend({
transform: true,
stroke: false,
fillOpacity: 0,
- fill: true,
- ignoreMouseOut: true
+ fill: true
});
if (!this._graphicMarker) {
diff --git a/loleaflet/src/layer/vector/SVGGroup.js b/loleaflet/src/layer/vector/SVGGroup.js
index b90957d1e..f571a5eab 100644
--- a/loleaflet/src/layer/vector/SVGGroup.js
+++ b/loleaflet/src/layer/vector/SVGGroup.js
@@ -7,8 +7,7 @@ L.SVGGroup = L.Layer.extend({
options: {
noClip: true,
- manualDrag: false,
- ignoreMouseOut: false
+ manualDrag: false
},
initialize: function (bounds, options) {
@@ -69,8 +68,7 @@ L.SVGGroup = L.Layer.extend({
if (!this.options.manualDrag) {
L.DomEvent.on(this._dragShape, 'mousemove', this._onDrag, this);
L.DomEvent.on(this._dragShape, 'mouseup', this._onDragEnd, this);
- if (!this.options.ignoreMouseOut)
- L.DomEvent.on(this._dragShape, 'mouseout', this._onDragEnd, this);
+ L.DomEvent.on(this._dragShape, 'mouseout', this._onDragEnd, this);
}
var data = {
@@ -102,8 +100,7 @@ L.SVGGroup = L.Layer.extend({
if (!this.options.manualDrag) {
L.DomEvent.off(this._dragShape, 'mousemove', this._onDrag, this);
L.DomEvent.off(this._dragShape, 'mouseup', this._onDragEnd, this);
- if (!this.options.ignoreMouseOut)
- L.DomEvent.off(this._dragShape, 'mouseout', this._onDragEnd, this);
+ L.DomEvent.off(this._dragShape, 'mouseout', this._onDragEnd, this);
}
this._moved = false;
commit df7e77415f2774990b0ef4daa2c9ed8314906a5e
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 6 22:22:50 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: change-annotation navigation through prev/next command
Change-Id: I4ea33e38a947d3b93b716d5f9080c91db1daf7fa
diff --git a/loleaflet/src/map/handler/Map.StateChanges.js b/loleaflet/src/map/handler/Map.StateChanges.js
index d59af59e9..cdee49161 100644
--- a/loleaflet/src/map/handler/Map.StateChanges.js
+++ b/loleaflet/src/map/handler/Map.StateChanges.js
@@ -29,6 +29,10 @@ L.Map.StateChangeHandler = L.Handler.extend({
var index = e.state.indexOf('{');
var state = index !== -1 ? JSON.parse(e.state.substring(index)) : e.state;
this._items[e.commandName] = state;
+ if (e.commandName === '.uno:CurrentTrackedChangeId') {
+ var redlineId = 'change-' + state;
+ this._map._docLayer._annotations.selectById(redlineId);
+ }
},
getItems: function() {
commit 0ee3bc5c70a3adff67019ce92ca8f4502d6ca687
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 6 22:20:54 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: fix: redline annotations are not displayed
Change-Id: I8aaa330667f1e06506f74ee9de1611aa32f45a82
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index c4b5a955d..ef990549e 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -904,9 +904,17 @@ L.AnnotationManager = L.Class.extend({
_updateScaling: function () {
if (!L.Browser.mobile || this._items.length === 0)
return;
+ var contentWrapperClassName, menuClassName;
+ if (this._items[0]._data.trackchange) {
+ contentWrapperClassName = '.loleaflet-annotation-redline-content-wrapper';
+ menuClassName = '.loleaflet-annotation-menu-redline';
+ } else {
+ contentWrapperClassName = '.loleaflet-annotation-content-wrapper';
+ menuClassName = '.loleaflet-annotation-menu';
+ }
var initNeeded = (this._initialLayoutData === undefined);
- var contentWrapperClass = $('.loleaflet-annotation-content-wrapper');
+ var contentWrapperClass = $(contentWrapperClassName);
if (initNeeded && contentWrapperClass.length > 0) {
var contentAuthor = $('.loleaflet-annotation-content-author');
var dateClass = $('.loleaflet-annotation-date');
@@ -927,7 +935,7 @@ L.AnnotationManager = L.Class.extend({
if (this._initialLayoutData === undefined)
return;
- var menuClass = $('.loleaflet-annotation-menu');
+ var menuClass = $(menuClassName);
if ((this._initialLayoutData.menuWidth === undefined) && menuClass.length > 0) {
this._initialLayoutData.menuWidth = parseInt(menuClass.css('width'));
this._initialLayoutData.menuHeight = parseInt(menuClass.css('height'));
diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index a934a5e81..5f9d8ad43 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -210,9 +210,9 @@ L.Annotation = L.Layer.extend({
if (this._data.trackchange && this._map._permission !== 'readonly') {
var tdAccept = L.DomUtil.create(tagTd, 'loleaflet-annotation-menubar', tr);
- var acceptButton = L.DomUtil.create('button', 'loleaflet-redline-accept-button', tdAccept);
+ var acceptButton = this._acceptButton = L.DomUtil.create('button', 'loleaflet-redline-accept-button', tdAccept);
var tdReject = L.DomUtil.create(tagTd, 'loleaflet-annotation-menubar', tr);
- var rejectButton = L.DomUtil.create('button', 'loleaflet-redline-reject-button', tdReject);
+ var rejectButton = this._rejectButton = L.DomUtil.create('button', 'loleaflet-redline-reject-button', tdReject);
acceptButton.title = _('Accept change');
L.DomEvent.on(acceptButton, click, function() {
@@ -416,6 +416,15 @@ L.Annotation = L.Layer.extend({
this._menu.style.width = menuWidth + 'px';
var menuHeight = Math.round(initialLayoutData.menuHeight * scaleFactor);
this._menu.style.height = menuHeight + 'px';
+
+ if (this._acceptButton) {
+ this._acceptButton.style.width = menuWidth + 'px';
+ this._acceptButton.style.height = menuHeight + 'px';
+ }
+ if (this._rejectButton) {
+ this._rejectButton.style.width = menuWidth + 'px';
+ this._rejectButton.style.height = menuHeight + 'px';
+ }
}
var authorImageWidth = Math.round(this.options.imgSize.x * scaleFactor);
commit eca2a7ce4d600da9ad1ce2227b78c0fad39b1c09
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Thu Oct 3 21:33:27 2019 +0200
Commit: Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Mon Oct 21 12:41:05 2019 +0200
loleaflet: fix: can't drag images between pages
The problem seems to be that the preview arrives with a not so small
delay, when the user has already started to perform a new dragging:
1) the drag starts using the transparent rectangle to which is
attached (on drag start) the _onDragEnd handler
2) the user sees moving only the selection rectangle
3) the svg preview arrives in the middle of dragging overwriting the
transparent rectangle element
4) when dragging ends _onDragEnd is not invoked since the transparent
rectangle has been discarded in favor of the svg preview
It is possible to avoid the step (3) to occur by checking if the
dragging is already started. In this case _onDragEnd is invoked and
the TransformDialog UNO command is sent. So, even with a delay the
image position will be finally updated.
Change-Id: Ifefd46f470b090089385083e4e2d643eb8e7017c
diff --git a/loleaflet/src/layer/vector/SVGGroup.js b/loleaflet/src/layer/vector/SVGGroup.js
index 26cac2c8b..b90957d1e 100644
--- a/loleaflet/src/layer/vector/SVGGroup.js
+++ b/loleaflet/src/layer/vector/SVGGroup.js
@@ -36,7 +36,7 @@ L.SVGGroup = L.Layer.extend({
var size = L.bounds(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
this._map.latLngToLayerPoint(this._bounds.getSouthEast())).getSize();
- if (doc.lastChild.localName !== 'svg')
+ if (doc.lastChild.localName !== 'svg' || this._dragStarted)
return;
if (svgString.indexOf('XTEXT_PAINTSHAPE_BEGIN') !== -1) {
@@ -63,7 +63,7 @@ L.SVGGroup = L.Layer.extend({
_onDragStart: function(evt) {
if (!this._map || !this._dragShape || !this.dragging)
return;
-
+ this._dragStarted = true;
this._moved = false;
if (!this.options.manualDrag) {
@@ -116,6 +116,7 @@ L.SVGGroup = L.Layer.extend({
if (this.options.manualDrag || evt.type === 'mouseup')
this.dragging._onDragEnd(evt);
+ this._dragStarted = false;
},
bringToFront: function () {
@@ -141,6 +142,7 @@ L.SVGGroup = L.Layer.extend({
},
onAdd: function () {
+ this._dragStarted = false;
this._renderer = this._map.getRenderer(this);
this._renderer._initGroup(this);
this._renderer._initPath(this._rect);
More information about the Libreoffice-commits
mailing list