loleaflet/src/layer/AnnotationManager.js    |    9 +++++++++
 loleaflet/src/layer/tile/WriterTileLayer.js |    9 ++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 42091f0b2010f66d8a1a0939f7c82926ca38c89d
Author: Henry Castro <hcas...@collabora.com>
Date:   Thu Apr 20 21:56:07 2017 -0400

    loleaflet: update document size when insert new annotation
    
    Change-Id: Iaaca82aba1c04de336e89ff4e854cc9632fbfc53

diff --git a/loleaflet/src/layer/AnnotationManager.js 
b/loleaflet/src/layer/AnnotationManager.js
index 88fbcaba..88cc2c6a 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -210,6 +210,12 @@ L.AnnotationManager = L.Class.extend({
                this.layout();
        },
 
+       updateDocBounds: function (count, extraSize) {
+               if (this._items.length === count) {
+                       this._map._docLayer._updateMaxBounds(true, extraSize);
+               }
+       },
+
        layoutUp: function (commentThread, latLng, layoutBounds) {
                if (commentThread.length <= 0)
                        return;
@@ -473,6 +479,7 @@ L.AnnotationManager = L.Class.extend({
                        if (this._selected && !this._selected.isEdit()) {
                                this._map.focus();
                        }
+                       this.updateDocBounds(1);
                        this.layout();
                } else if (action === 'Remove') {
                        id = changetrack ? 'change-' + obj.redline.index : 
obj.comment.id;
@@ -480,6 +487,7 @@ L.AnnotationManager = L.Class.extend({
                        if (removed) {
                                this.adjustParentRemove(removed);
                                this._map.removeLayer(this.removeItem(id));
+                               this.updateDocBounds(0);
                                if (this._selected === removed) {
                                        this.unselect();
                                } else {
@@ -508,6 +516,7 @@ L.AnnotationManager = L.Class.extend({
        _onAnnotationCancel: function (e) {
                if (e.annotation._data.id === 'new') {
                        
this._map.removeLayer(this.removeItem(e.annotation._data.id));
+                       this.updateDocBounds(0);
                }
                if (this._selected === e.annotation) {
                        this.unselect();
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js 
b/loleaflet/src/layer/tile/WriterTileLayer.js
index b45f584d..5610d010 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -12,6 +12,7 @@ L.WriterTileLayer = L.TileLayer.extend({
                        comment.anchorPix = 
this._twipsToPixels(comment.anchorPos.min);
                }
                if (comment.anchorPos) {
+                       this._annotations.updateDocBounds(0, 
this._annotations.options.extraSize);
                        
this._annotations.modify(this._annotations.add(comment));
                }
        },
@@ -229,9 +230,11 @@ L.WriterTileLayer = L.TileLayer.extend({
                this._update();
        },
 
-       _updateMaxBounds: function (sizeChanged) {
-               var extraSize = this._annotations && 
this._annotations._items.length > 0 ?
-                       this._annotations.options.extraSize : null;
+       _updateMaxBounds: function (sizeChanged, extraSize) {
+               if (!extraSize) {
+                       extraSize = this._annotations && 
this._annotations._items.length > 0 ?
+                               this._annotations.options.extraSize : null;
+               }
                L.GridLayer.prototype._updateMaxBounds.call(this, sizeChanged, 
extraSize, {panInside: false});
        }
 });
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to