[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - 4 commits - loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue May 14 12:57:15 UTC 2019
loleaflet/src/control/Control.LokDialog.js | 32 +++++++++++++++++------------
loleaflet/src/map/Map.js | 14 ++++++++++--
2 files changed, 31 insertions(+), 15 deletions(-)
New commits:
commit 72025d21cb127aadeb092e564da8acc884188032
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon May 13 06:50:32 2019 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue May 14 14:53:24 2019 +0200
leaflet: update the cursor when the editor gets focus back
After closing dialog that had its own cursor, the editor
loses the cursor until the user types, which forces a
cursor invalidation from Core. This is to make sure that
the editor always updates the visibility of its cursor
when the editor get focus back.
Change-Id: Icba5e6c2c94da7488131269749fc96e185dec6a2
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index aee2f4cb3..9e25fbe04 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -801,6 +801,7 @@ L.Map = L.Evented.extend({
focus: function () {
this._clipboardContainer.focus();
+ this._onEditorGotFocus();
},
setHelpTarget: function(page) {
commit c97defd5f65a1bbc69247f74a943b224111f2ca2
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun May 12 16:52:35 2019 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue May 14 14:53:24 2019 +0200
leaflet: initialize the sidebar only once
Calc tends to issue document size change very
frequently (after certain operations), and this
results in the status: message to be generated.
Unfortunately, this message signals finishing
document loading, which means it also triggers
post-loading events.
This fix is to hold a new flag in map to track
the true first laod event, to avoid triggering
post-load handlers.
Ideally, we will get a different and unambiguous
message for document loading, vs. generic status
updates.
Change-Id: Ib8b59c04a770cbfcaf443608c418557671ed207b
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 95facb614..aee2f4cb3 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -204,9 +204,13 @@ L.Map = L.Evented.extend({
// This becomes true if document was ever modified by the user
this._everModified = false;
- // Document is completely loaded or not
+ // Document is completely loaded or not.
this._docLoaded = false;
+ // Unlike _docLoaded, this is flagged only once,
+ // after we receive status for the first time.
+ this._docLoadedOnce = false;
+
this.on('commandstatechanged', function(e) {
if (e.commandName === '.uno:ModifiedStatus')
this._everModified = this._everModified || (e.state === 'true');
@@ -230,7 +234,7 @@ L.Map = L.Evented.extend({
this.initializeModificationIndicator();
// Show sidebar.
- if (this._docLayer && !window.mode.isMobile() && !window.mode.isTablet() &&
+ if (this._docLayer && !this._docLoadedOnce && !window.mode.isMobile() && !window.mode.isTablet() &&
(this._docLayer._docType === 'spreadsheet' || this._docLayer._docType === 'text')) {
// Let the first page finish loading then load the sidebar.
var map = this;
@@ -242,6 +246,11 @@ L.Map = L.Evented.extend({
map._socket.sendMessage('uno .uno:Sidebar');
}, 200);
}
+
+ // We have loaded.
+ if (!this._docLoadedOnce) {
+ this._docLoadedOnce = this._docLoaded;
+ }
}, this);
},
commit 977858b8720516d50a4e0365dce5d486939427b1
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Thu May 9 08:15:14 2019 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue May 14 14:53:24 2019 +0200
leaflet: Keep active even in windows and child windows
Change-Id: I7e72b21d9276e96e94852916f9e6a8e04d73c222
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index b768ddc10..b1ea6b54e 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -570,7 +570,6 @@ L.Control.LokDialog = L.Control.extend({
_setupWindowEvents: function(id, canvas, dlgInput) {
L.DomEvent.on(canvas, 'contextmenu', L.DomEvent.preventDefault);
L.DomEvent.on(canvas, 'mousemove', function(e) {
- this._map.lastActiveTime = Date.now();
this._postWindowMouseEvent('move', id, e.offsetX, e.offsetY, 1, 0, 0);
// Keep map active while user is playing with sidebar/dialog.
this._map.lastActiveTime = Date.now();
@@ -693,23 +692,31 @@ L.Control.LokDialog = L.Control.extend({
_postWindowCompositionEvent: function(winid, type, text) {
this._map._docLayer._postCompositionEvent(winid, type, text);
+ // Keep map active while user is playing with sidebar/dialog.
+ this._map.lastActiveTime = Date.now();
},
_postWindowMouseEvent: function(type, winid, x, y, count, buttons, modifier) {
this._map._socket.sendMessage('windowmouse id=' + winid + ' type=' + type +
' x=' + x + ' y=' + y + ' count=' + count +
' buttons=' + buttons + ' modifier=' + modifier);
+ // Keep map active while user is playing with sidebar/dialog.
+ this._map.lastActiveTime = Date.now();
},
_postWindowGestureEvent: function(winid, type, x, y, offset) {
console.log('x ' + x + ' y ' + y + ' o ' + offset);
this._map._socket.sendMessage('windowgesture id=' + winid + ' type=' + type +
' x=' + x + ' y=' + y + ' offset=' + offset);
+ // Keep map active while user is playing with sidebar/dialog.
+ this._map.lastActiveTime = Date.now();
},
_postWindowKeyboardEvent: function(winid, type, charcode, keycode) {
this._map._socket.sendMessage('windowkey id=' + winid + ' type=' + type +
' char=' + charcode + ' key=' + keycode);
+ // Keep map active while user is playing with sidebar/dialog.
+ this._map.lastActiveTime = Date.now();
},
_onSidebarClose: function(dialogId) {
@@ -928,7 +935,6 @@ L.Control.LokDialog = L.Control.extend({
}
firstTouchPositionX = null;
firstTouchPositionY = null;
-
}
else if (e.type === 'touchmove')
{
commit 2f0e39b39cc16e4bc3c6157de3ba4b32dba7abf4
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue May 7 20:59:13 2019 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Tue May 14 14:53:24 2019 +0200
leaflet: show message box dialogs centered
Change-Id: Ic55f48067c918aac2bdcfe998c8d4b5cbbcc008d
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 5c292b297..b768ddc10 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -214,8 +214,8 @@ L.Control.LokDialog = L.Control.extend({
height = parseInt(e.size.split(',')[1]);
}
- var left = 0;
- var top = 0;
+ var left;
+ var top;
if (e.position) {
left = parseInt(e.position.split(',')[0]);
top = parseInt(e.position.split(',')[1]);
@@ -223,14 +223,19 @@ L.Control.LokDialog = L.Control.extend({
if (e.action === 'created') {
if (e.winType === 'dialog') {
+ // When left/top are invalid, the dialog shows in the center.
this._launchDialog(e.id, left, top, width, height, e.title);
} else if (e.winType === 'deck') {
- this._launchSidebar(e.id, left, top, width, height);
+ this._launchSidebar(e.id, width, height);
} else if (e.winType === 'child') {
var parentId = parseInt(e.parentId);
if (!this._isOpen(parentId))
return;
+ if (!left)
+ left = 0;
+ if (!top)
+ top = 0;
this._removeDialogChild(parentId);
this._dialogs[parentId].childid = e.id;
this._dialogs[parentId].childwidth = width;
@@ -464,12 +469,7 @@ L.Control.LokDialog = L.Control.extend({
this._sendPaintWindow(id, this._createRectStr(id));
},
- _launchSidebar: function(id, left, top, width, height) {
-
- if (!left)
- left = 0;
- if (!top)
- top = 0;
+ _launchSidebar: function(id, width, height) {
if ((window.mode.isMobile() || window.mode.isTablet())
&& this._map._permission != 'edit')
@@ -534,8 +534,8 @@ L.Control.LokDialog = L.Control.extend({
id: id,
strId: strId,
isSidebar: true,
- left: left,
- top: top,
+ left: 0,
+ top: 0,
width: width,
height: height,
cursor: null,
More information about the Libreoffice-commits
mailing list