loleaflet/debug/document/document_simple_example.html |    3 +
 loleaflet/src/control/Control.EditView.js             |    5 ++
 loleaflet/src/layer/tile/TileLayer.js                 |   36 +++++++++++-------
 3 files changed, 29 insertions(+), 15 deletions(-)

New commits:
commit da568fc09778ca5b0e34f749b315a545ef396539
Author: Mihai Varga <mihai.va...@collabora.com>
Date:   Thu Jul 9 15:09:25 2015 +0300

    loleaflet: fixed short document panning in view mode

diff --git a/loleaflet/debug/document/document_simple_example.html 
b/loleaflet/debug/document/document_simple_example.html
index 4137dfe..27edf71 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -72,7 +72,7 @@
         doc: filePath,
         useSocket : true,
         editMode: editMode,
-        readOnly: true
+        readOnly: false
     });
     map.addLayer(docLayer);
 
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index d64a972..fa5100e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -750,10 +750,14 @@ L.TileLayer = L.GridLayer.extend({
                }
                else if (e.type === 'mouseup') {
                        this._mouseDown = false;
-                       if (this._holdMouseEvent) {
-                               clearTimeout(this._holdMouseEvent);
-                               this._holdMouseEvent = null;
+                       if (!this._editMode) {
+                               if (this._mouseEventsQueue.length === 0) {
+                                       // mouse up after panning
+                                       return;
+                               }
                        }
+                       clearTimeout(this._holdMouseEvent);
+                       this._holdMouseEvent = null;
                        if (this._clickTime && Date.now() - this._clickTime <= 
250) {
                                // double click, a click was sent already
                                this._mouseEventsQueue = [];
@@ -761,18 +765,16 @@ L.TileLayer = L.GridLayer.extend({
                        }
                        else {
                                // if it's a click or mouseup after selecting
-                               if (this._mouseEventsQueue.length > 0 || 
this._editMode) {
+                               if (this._mouseEventsQueue.length > 0) {
+                                       // it's a click, fire mousedown
+                                       this._mouseEventsQueue[0]();
                                        this._clickTime = Date.now();
-                                       if (this._mouseEventsQueue.length > 0) {
-                                               // fire mousedown
-                                               this._mouseEventsQueue[0]();
+                                       if (!this._editMode) {
+                                               this._editMode = true;
+                                               
this._map.fire('updatemode:edit');
                                        }
-                                       this._mouseEventsQueue = [];
-                               }
-                               if (!this._editMode) {
-                                       this._editMode = true;
-                                       this._map.fire('updatemode:edit');
                                }
+                               this._mouseEventsQueue = [];
                                mousePos = this._latLngToTwips(e.latlng);
                                this._postMouseEvent('buttonup', mousePos.x, 
mousePos.y, 1);
                                this._textArea.focus();
commit 4e03f3127660d70406c03587b717481a05e58b81
Author: Mihai Varga <mihai.va...@collabora.com>
Date:   Thu Jul 9 14:50:21 2015 +0300

    loleaflet: start in readOnly mode option

diff --git a/loleaflet/debug/document/document_simple_example.html 
b/loleaflet/debug/document/document_simple_example.html
index 2b4b394..4137dfe 100644
--- a/loleaflet/debug/document/document_simple_example.html
+++ b/loleaflet/debug/document/document_simple_example.html
@@ -71,7 +71,8 @@
     var docLayer = new L.TileLayer('', {
         doc: filePath,
         useSocket : true,
-        editMode: editMode
+        editMode: editMode,
+        readOnly: true
     });
     map.addLayer(docLayer);
 
diff --git a/loleaflet/src/control/Control.EditView.js 
b/loleaflet/src/control/Control.EditView.js
index c81787d..748d312 100644
--- a/loleaflet/src/control/Control.EditView.js
+++ b/loleaflet/src/control/Control.EditView.js
@@ -14,7 +14,7 @@ L.Control.EditViewSwitch = L.Control.extend({
                this._checkBox = L.DomUtil.create('input', 'editview-cb', 
container);
                this._checkBox.type = 'checkbox';
                L.DomEvent.on(this._checkBox, 'change', this._onChange, this);
-        map.on('updatemode:view updatemode:edit', this._onUpdateMode, this);
+               map.on('updatemode:view updatemode:edit updatemode:readonly', 
this._onUpdateMode, this);
                container.appendChild(document.createTextNode('Enable 
editing'));
                return container;
        },
@@ -43,6 +43,9 @@ L.Control.EditViewSwitch = L.Control.extend({
                        L.DomUtil.removeClass(this._map._container, className);
                        this._checkBox.checked = false;
                }
+               else if (e.type === 'updatemode:readonly') {
+                       this._checkBox.disabled = true;
+               }
        }
 });
 
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index de52184..d64a972 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -200,9 +200,13 @@ L.TileLayer = L.GridLayer.extend({
                                this._onMouseEvent, this);
                this._startMarker.on('drag dragend', 
this._onSelectionHandleDrag, this);
                this._endMarker.on('drag dragend', this._onSelectionHandleDrag, 
this);
-               if (this.options.editMode) {
+               if (this.options.editMode && !this.options.readOnly) {
                        this._map.fire('updatemode:edit');
                }
+               if (this.options.readOnly) {
+                       this._map.fire('updatemode:readonly');
+                       this._readOnlyMode = true;
+               }
        },
 
        getEvents: function () {
@@ -730,6 +734,10 @@ L.TileLayer = L.GridLayer.extend({
                        return;
                }
 
+               if (this._readOnlyMode) {
+                       return;
+               }
+
                if (e.type === 'mousedown') {
                        this._mouseDown = true;
                        if (this._holdMouseEvent) {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to