loleaflet/src/control/Control.LokDialog.js | 41 ++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-)
New commits: commit 35457c4cf7c9408fb5cb8736e284800fd2fa3bda Author: Pranav Kant <pran...@collabora.co.uk> Date: Tue Nov 14 18:47:58 2017 +0530 lokdialog: Handle 'cursor_visible' callback to hide the cursor Change-Id: Ia4be5f1533226b493387af896812924d4bf81a72 diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js index d599d6a3..0914d9b6 100644 --- a/loleaflet/src/control/Control.LokDialog.js +++ b/loleaflet/src/control/Control.LokDialog.js @@ -35,10 +35,15 @@ L.Control.LokDialog = L.Control.extend({ var height = parseInt(rectangle[3]); $('#' + e.dialogId + '-cursor').css({height: height}); - // set the position of the lokdialog-cursor $(this._dialogs[e.dialogId].cursor).css({left: x, top: y}); } + } else if (e.action === 'cursor_visible') { + var visible = e.visible === 'true'; + if (visible) + $('#' + e.dialogId + '-cursor').css({display: 'block'}); + else + $('#' + e.dialogId + '-cursor').css({display: 'none'}); } else if (e.action === 'close') { this._onDialogClose(e.dialogId); } commit 2dcd75ccac9b4c219777c2d4e8e1859928b9c146 Author: Pranav Kant <pran...@collabora.co.uk> Date: Mon Nov 13 17:25:47 2017 +0530 lokdialog: Blinking cursor for editing fields in dialog Change-Id: Ib75e87134e650053dbcd5e78f9c52ea7b7fb4f98 diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js index 8460eb0d..d599d6a3 100644 --- a/loleaflet/src/control/Control.LokDialog.js +++ b/loleaflet/src/control/Control.LokDialog.js @@ -15,7 +15,9 @@ L.Control.LokDialog = L.Control.extend({ _dialogs: {}, _isOpen: function(dialogId) { - return $('#' + dialogId).length > 0; + return this._dialogs[dialogId] && + this._dialogs[dialogId].open && + $('#' + dialogId).length > 0; }, _onDialogMsg: function(e) { @@ -25,6 +27,18 @@ L.Control.LokDialog = L.Control.extend({ if (this._isOpen(e.dialogId)) { this._map.sendDialogCommand(e.dialogId, e.rectangle); } + } else if (e.action === 'cursor_invalidate') { + if (this._isOpen(e.dialogId) && !!e.rectangle) { + var rectangle = e.rectangle.split(','); + var x = parseInt(rectangle[0]); + var y = parseInt(rectangle[1]); + var height = parseInt(rectangle[3]); + + $('#' + e.dialogId + '-cursor').css({height: height}); + + // set the position of the lokdialog-cursor + $(this._dialogs[e.dialogId].cursor).css({left: x, top: y}); + } } else if (e.action === 'close') { this._onDialogClose(e.dialogId); } @@ -32,11 +46,21 @@ L.Control.LokDialog = L.Control.extend({ _openDialog: function(e) { e.dialogId = e.dialogId.replace('.uno:', ''); - this._dialogs[e.dialogId] = true; + this._dialogs[e.dialogId] = {open: true}; this._map.sendDialogCommand(e.dialogId); }, + _launchDialogCursor: function(dialogId) { + if (!this._isOpen(dialogId)) + return; + + this._dialogs[dialogId].cursor = L.DomUtil.create('div', 'leaflet-cursor-container', L.DomUtil.get(dialogId)); + var cursor = L.DomUtil.create('div', 'leaflet-cursor lokdialog-cursor', this._dialogs[dialogId].cursor); + cursor.id = dialogId + '-cursor'; + L.DomUtil.addClass(cursor, 'blinking-cursor'); + }, + _launchDialog: function(dialogId, width, height) { var canvas = '<div class="lokdialog" style="padding: 0px; margin: 0px; overflow: hidden;" id="' + dialogId + '">' + '<canvas class="lokdialog_canvas" tabindex="0" id="' + dialogId + '-canvas" width="' + width + 'px" height="' + height + 'px"></canvas>' + @@ -87,7 +111,11 @@ L.Control.LokDialog = L.Control.extend({ return false; }); - this._dialogs[dialogId] = true; + // set the dialog's cursor + this._launchDialogCursor(dialogId); + + if (!this._dialogs[dialogId] || !this._dialogs[dialogId].open) + this._dialogs[dialogId] = { open: true }; }, _postDialogMouseEvent: function(type, dialogid, x, y, count, buttons, modifier) { @@ -195,7 +223,7 @@ L.Control.LokDialog = L.Control.extend({ _onDialogPaint: function (e) { var dialogId = e.id.replace('.uno:', ''); // is our request to open dialog still valid? - if (!this._dialogs[dialogId]) + if (!this._dialogs[dialogId] || !this._dialogs[dialogId].open) return; if (!this._isOpen(dialogId)) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits