loleaflet/dist/leaflet.css                |    1 -
 loleaflet/src/layer/tile/TileLayer.js     |   14 +++++++++++---
 loleaflet/src/map/Map.js                  |    2 +-
 loleaflet/src/map/handler/Map.Keyboard.js |    8 --------
 4 files changed, 12 insertions(+), 13 deletions(-)

New commits:
commit 9a3e71bad8a415d026547d6650a0736a4538a2ec
Author: Mihai Varga <mihai.va...@collabora.com>
Date:   Fri Jun 26 19:20:21 2015 +0300

    Keyboard input is handled in a hidden textarea
    
    We now have a hidden text area where the user's input actually goes,
    but it also fires events that are caught by leaflet and are sent
    to the server

diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index 3c03665..25038ee 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -623,7 +623,6 @@
        width: 0px;
        height: 0px;
        z-index: 100;
-       display: none;
        opacity: 0;
 }
 #clipboard {
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index d46617d..36e416e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -154,6 +154,8 @@ L.TileLayer = L.GridLayer.extend({
                        }),
                        draggable: true
                });
+               this._textArea = L.DomUtil.get('clipboard');
+               this._textArea.focus();
        },
 
        _initDocument: function () {
@@ -699,6 +701,7 @@ L.TileLayer = L.GridLayer.extend({
                        if (this._endMarker._icon) {
                                L.DomUtil.removeClass(this._endMarker._icon, 
'leaflet-not-clickable');
                        }
+                       this._textArea.focus();
                }
                else if (e.type === 'mousemove' && this._selecting) {
                        if (this._holdStart) {
@@ -767,6 +770,14 @@ L.TileLayer = L.GridLayer.extend({
                        return;
                }
 
+               if (e.originalEvent.ctrlKey) {
+                       // we prepare for a copy event
+                       this._textArea.value = 'dummy text';
+                       this._textArea.focus();
+                       this._textArea.select();
+                       return;
+               }
+
                var charCode = e.originalEvent.charCode;
                var keyCode = e.originalEvent.keyCode;
                if (e.type === 'keypress') {
@@ -903,9 +914,6 @@ L.TileLayer = L.GridLayer.extend({
                }
                else {
                        e.clipboardData.setData('text/plain', 
this._selectionTextContent);
-                       var clipboardContainer = 
L.DomUtil.get('clipboard-container');
-                       L.DomUtil.setStyle(clipboardContainer, 'display', 
'none');
-                       this._map._container.focus();
                }
        }
 });
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 85ab119..4f25698 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -584,7 +584,7 @@ L.Map = L.Evented.extend({
 
                L.DomEvent[onOff](this._container, 'click dblclick mousedown 
mouseup ' +
                        'mouseover mouseout mousemove contextmenu keydown 
keypress keyup', this._handleDOMEvent, this);
-               L.DomEvent[onOff](L.DomUtil.get('clipboard'), 'copy', 
this._handleDOMEvent, this);
+               L.DomEvent[onOff](L.DomUtil.get('clipboard'), 'copy keydown 
keypress keyup', this._handleDOMEvent, this);
 
                if (this.options.trackResize) {
                        L.DomEvent[onOff](window, 'resize', this._onResize, 
this);
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js 
b/loleaflet/src/map/handler/Map.Keyboard.js
index afc0763..e524ce8 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -125,14 +125,6 @@ L.Map.Keyboard = L.Handler.extend({
        },
 
        _onKeyDown: function (e) {
-               if (e.ctrlKey) {
-                       var clipboardContainer = 
L.DomUtil.get('clipboard-container');
-                       var textArea = L.DomUtil.get('clipboard');
-                       L.DomUtil.setStyle(clipboardContainer, 'display', 
'inline');
-                       textArea.value = 'dummy text';
-                       textArea.focus();
-                       textArea.select();
-               }
                if (this._map._bDisableKeyboard || e.altKey || e.ctrlKey || 
e.metaKey) { return; }
 
                var key = e.keyCode,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to