[Libreoffice-commits] online.git: loleaflet/src
Henry Castro
hcastro at collabora.com
Fri Mar 3 20:50:12 UTC 2017
loleaflet/src/layer/AnnotationManager.js | 4 ++--
loleaflet/src/layer/marker/Annotation.js | 8 +++++---
2 files changed, 7 insertions(+), 5 deletions(-)
New commits:
commit 64dd84125b5cbe046f6fc8e97e0ee76b366c2ba4
Author: Henry Castro <hcastro at collabora.com>
Date: Fri Mar 3 16:51:04 2017 -0400
loleaflet: fix min width of an annotation
Change-Id: I129faa235ee5d22b77f935e89de0756807f276c6
diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 4d7a66f..3f4f431 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -203,7 +203,7 @@ L.AnnotationManager = L.Class.extend({
return Math.abs(a._data.anchorPos.y) - Math.abs(b._data.anchorPos.y) ||
Math.abs(a._data.anchorPos.x) - Math.abs(b._data.anchorPos.x);
});
- added._updateContent();
+ added.update();
}
else { // annotation is added by some other view
this.add(obj.comment, false);
@@ -219,7 +219,7 @@ L.AnnotationManager = L.Class.extend({
var modified = this.getItem(obj.comment.id);
if (modified) {
modified._data = obj.comment;
- modified._updateContent();
+ modified.update();
this.update();
}
}
diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js
index 995087d..14383a9 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -81,8 +81,8 @@ L.Annotation = L.Layer.extend({
L.DomUtil.create('div', 'loleaflet-annotation');
var wrapper = this._wrapper =
L.DomUtil.create('div', 'loleaflet-annotation-content-wrapper', container);
- var table = L.DomUtil.create('table', 'loleaflet-annotation-table', wrapper);
- var tbody = L.DomUtil.create('tbody', '', table);
+ this._tableAuthor = L.DomUtil.create('table', 'loleaflet-annotation-table', wrapper);
+ var tbody = L.DomUtil.create('tbody', '', this._tableAuthor);
var tr = L.DomUtil.create('tr', '', tbody);
var tdImg = L.DomUtil.create('td', 'loleaflet-annotation-img', tr);
var tdAuthor = L.DomUtil.create('td', 'loleaflet-annotation-author', tr);
@@ -162,8 +162,10 @@ L.Annotation = L.Layer.extend({
_updateLayout: function () {
var style = this._wrapper.style;
- var width = Math.min(this._wrapper.offsetWidth, this.options.minWidth);
+ style.width = '';
+ style.whiteSpace = 'nowrap';
+ var width = Math.min(Math.max(this._tableAuthor.offsetWidth, this._contentText.offsetWidth), this.options.minWidth);
style.width = (width + 1) + 'px';
style.whiteSpace = '';
},
More information about the Libreoffice-commits
mailing list