Handle calc-input-win position changes

When notebookbar is created calc-input-win is moved down.
This change takes into account that change and allows
us to handle click position correctly.

Change-Id: I7dd6f3ec7d65cd293721321b080626c61a84daf7
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100649
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
This commit is contained in:
Szymon Kłos 2020-08-13 10:52:49 +02:00
parent 5fb98cde35
commit 35534b7d63

View file

@ -380,8 +380,8 @@ L.Control.LokDialog = L.Control.extend({
this._launchSidebar(e.id, width, height); this._launchSidebar(e.id, width, height);
} else if (e.winType === 'calc-input-win' || this.isCalcInputBar(e.id)) { } else if (e.winType === 'calc-input-win' || this.isCalcInputBar(e.id)) {
lines = parseInt(e.lines); lines = parseInt(e.lines);
left = left | this._calcInputBar.left; left = left || this._calcInputBar.left;
top = top | this._calcInputBar.top; top = top || this._calcInputBar.top;
this._launchCalcInputBar(e.id, left, top, width, height, lines); this._launchCalcInputBar(e.id, left, top, width, height, lines);
} }
else { else {
@ -839,8 +839,10 @@ L.Control.LokDialog = L.Control.extend({
_adjustCalcInputBar: function(id, left, top, width, height, textLines) { _adjustCalcInputBar: function(id, left, top, width, height, textLines) {
if (this._calcInputBar) { if (this._calcInputBar) {
var oldHeight = this._calcInputBar.height; var oldHeight = this._calcInputBar.height;
var oldX = this._calcInputBar.left;
var oldY = this._calcInputBar.top;
var delta = height - oldHeight; var delta = height - oldHeight;
if (delta !== 0) { if (delta !== 0 || oldX !== left || oldY !== top) {
console.log('_adjustCalcInputBar: start: id: ' + id + ', height: ' + oldHeight + ' -> ' + height); console.log('_adjustCalcInputBar: start: id: ' + id + ', height: ' + oldHeight + ' -> ' + height);
// Recreate the input-bar. // Recreate the input-bar.