[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/src

Henry Castro hcastro at collabora.com
Thu Apr 13 11:21:18 UTC 2017


 loleaflet/src/layer/AnnotationManager.js |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 0d08a98ddf8bc48bcf48f12d7a5ca17072786c48
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Apr 12 17:19:17 2017 -0400

    loleaflet: animate the new position of selected annotation
    
    Change-Id: I47af4ac3ec01b03797a03dfcc91ec84f0fd39bb5
    Reviewed-on: https://gerrit.libreoffice.org/36512
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js
index 8f178357..93027dcc 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -13,6 +13,7 @@ L.AnnotationManager = L.Class.extend({
 		this._map = map;
 		this._items = [];
 		this._selected = null;
+		this._animation = new L.PosAnimation();
 		this._arrow = L.polyline([], {color: 'darkblue', weight: 1});
 		this._map.on('AnnotationCancel', this._onAnnotationCancel, this);
 		this._map.on('AnnotationClick', this._onAnnotationClick, this);
@@ -196,10 +197,12 @@ L.AnnotationManager = L.Class.extend({
 	layout: function () {
 		var docRight = this._map.project(this._map.options.maxBounds.getNorthEast());
 		var topRight = docRight.add(L.point(this.options.marginX, this.options.marginY));
-		var annotation, selectIndex, layoutBounds, point, index;
+		var latlng, annotation, selectIndex, layoutBounds, point, index;
 		if (this._selected) {
 			selectIndex = this.getIndexOf(this._selected._data.id);
-			this._selected.setLatLng(this._map.unproject(L.point(docRight.x, this._selected._data.anchorPix.y)));
+			latlng = this._map.unproject(L.point(docRight.x, this._selected._data.anchorPix.y));
+			this._animation.run(this._selected._container, this._map.latLngToLayerPoint(latlng));
+			this._selected.setLatLng(latlng);
 			layoutBounds = this._selected.getBounds();
 			layoutBounds.min = layoutBounds.min.add([this.options.marginX, 0]);
 			layoutBounds.max = layoutBounds.max.add([this.options.marginX, 0]);


More information about the Libreoffice-commits mailing list