loleaflet/src/layer/AnnotationManager.js |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 7521e9bb91993af2dfbe7cf3a1507b32b9e5b906
Author: Henry Castro <hcas...@collabora.com>
Date:   Mon Apr 10 21:43:42 2017 -0400

    loleaflet: add line between the currently selected comment ...
    
    and the associated selection
    
    Change-Id: I58d548f78e9d6594336abed8e77993d2fafe867e

diff --git a/loleaflet/src/layer/AnnotationManager.js 
b/loleaflet/src/layer/AnnotationManager.js
index 8308d485..8f178357 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -5,13 +5,15 @@
 L.AnnotationManager = L.Class.extend({
        options: {
                marginX: 50,
-               marginY: 10
+               marginY: 10,
+               offset: 5
        },
 
        initialize: function (map) {
                this._map = map;
                this._items = [];
                this._selected = null;
+               this._arrow = L.polyline([], {color: 'darkblue', weight: 1});
                this._map.on('AnnotationCancel', this._onAnnotationCancel, 
this);
                this._map.on('AnnotationClick', this._onAnnotationClick, this);
                this._map.on('AnnotationReply', this._onAnnotationReply, this);
@@ -29,6 +31,7 @@ L.AnnotationManager = L.Class.extend({
                }
                this._items = [];
                this._selected = null;
+               this._map.removeLayer(this._arrow);
        },
 
        // Remove only change tracking comments from the document
@@ -146,6 +149,17 @@ L.AnnotationManager = L.Class.extend({
        },
 
        update: function () {
+               if (this._selected) {
+                       var point0, point1, point2;
+                       var topRight = 
this._map.project(this._map.options.maxBounds.getNorthEast());
+                       point0 = 
this._map._docLayer._twipsToPixels(this._selected._data.anchorPos.max);
+                       point1 = L.point(point0.x, point0.y + 
this.options.offset);
+                       point2 = L.point(topRight.x, point1.y);
+                       this._arrow.setLatLngs([this._map.unproject(point0), 
this._map.unproject(point1), this._map.unproject(point2)]);
+                       this._map.addLayer(this._arrow);
+               } else {
+                       this._map.removeLayer(this._arrow);
+               }
                this.layout();
        },
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to