From 9244d53e34ebd32185ed6a0fbabbd9995303fb5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20=C3=87i=C3=A7ek?= Date: Fri, 20 Dec 2024 14:26:39 +0300 Subject: [PATCH 1/3] sc autofill: disable mouse clicks for context-menu-layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - close popups if a dropdown menu is opened - this only applies to the autofill context-menu. other context menus should not be affected. Signed-off-by: Bayram Çiçek Change-Id: Iaf7b5c09003291f27155ae9ab6787f2f871ac466 --- browser/src/control/Control.ContextMenu.js | 6 ++++++ browser/src/control/jsdialog/Util.Dropdown.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/browser/src/control/Control.ContextMenu.js b/browser/src/control/Control.ContextMenu.js index aecb8a6fe7d7..4bd4f83e5f9b 100644 --- a/browser/src/control/Control.ContextMenu.js +++ b/browser/src/control/Control.ContextMenu.js @@ -204,6 +204,12 @@ L.Control.ContextMenu = L.Control.extend({ var $menu = opt.$menu; $menu.attr('tabindex', 0); // Make the context menu focusable }, + activated: function (opt) { + if (autoFillContextMenu) { + var $layer = opt.$layer; + $layer.css('pointer-events', 'none'); // disable mouse clicks for the layer + } + }, hide: function() { if(autoFillContextMenu) app.map._docLayer._resetReferencesMarks(); diff --git a/browser/src/control/jsdialog/Util.Dropdown.js b/browser/src/control/jsdialog/Util.Dropdown.js index 19052d3fbfa5..6f011e0637bb 100644 --- a/browser/src/control/jsdialog/Util.Dropdown.js +++ b/browser/src/control/jsdialog/Util.Dropdown.js @@ -154,6 +154,9 @@ JSDialog.OpenDropdown = function (id, popupParent, entries, innerCallback, popup }; }; L.Map.THIS.fire('jsdialog', {data: json, callback: generateCallback(entries)}); + + L.Map.THIS.fire('closepopups'); // close popups if a dropdown menu is opened + L.Map.THIS._docLayer._resetReferencesMarks(); }; JSDialog.CloseDropdown = function (id) { From 3a5a6181bb265a14f2175ab3548e9a928f3aa213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20=C3=87i=C3=A7ek?= Date: Wed, 8 Jan 2025 15:57:23 +0300 Subject: [PATCH 2/3] sc autofill: close all popups when scrolling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - and reset selection with _resetReferencesMarks() if autofill context menu is open Signed-off-by: Bayram Çiçek Change-Id: I0ecaf51deda76c9e8e33e2503a5d6c8c841eacf8 --- browser/src/canvas/sections/ScrollSection.ts | 2 ++ browser/src/control/Control.ContextMenu.js | 9 ++++++++- browser/src/control/jsdialog/Util.Dropdown.js | 4 +--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/browser/src/canvas/sections/ScrollSection.ts b/browser/src/canvas/sections/ScrollSection.ts index a0717393d26c..998671e0bc31 100644 --- a/browser/src/canvas/sections/ScrollSection.ts +++ b/browser/src/canvas/sections/ScrollSection.ts @@ -1148,6 +1148,8 @@ export class ScrollSection extends CanvasSectionObject { public onMouseWheel (point: Array, delta: Array, e: MouseEvent): void { if (e.ctrlKey) return; + this.map.fire('closepopups'); // close all popups when scrolling + let hscroll = 0, vscroll = 0; if (Math.abs(delta[1]) > Math.abs(delta[0])) { if (e.shiftKey) diff --git a/browser/src/control/Control.ContextMenu.js b/browser/src/control/Control.ContextMenu.js index 4bd4f83e5f9b..2b2947a6fbe4 100644 --- a/browser/src/control/Control.ContextMenu.js +++ b/browser/src/control/Control.ContextMenu.js @@ -109,6 +109,7 @@ L.Control.ContextMenu = L.Control.extend({ onAdd: function (map) { this._prevMousePos = null; + this._autoFillContextMenu = false; map._contextMenu = this; map.on('locontextmenu', this._onContextMenu, this); @@ -119,6 +120,12 @@ L.Control.ContextMenu = L.Control.extend({ }, _onClosePopup: function () { + + if (this._autoFillContextMenu) { + this._autoFillContextMenu = false; + app.map._docLayer._resetReferencesMarks(); + } + $.contextMenu('destroy', '.leaflet-layer'); this.hasContextMenu = false; }, @@ -168,7 +175,7 @@ L.Control.ContextMenu = L.Control.extend({ } else if (menuItem.indexOf('.uno:AutoFill') !== -1) { // we should close the autofill preview popup before open autofill context menu map.fire('closeautofillpreviewpopup'); - autoFillContextMenu = true; + this._autoFillContextMenu = autoFillContextMenu = true; break; } } diff --git a/browser/src/control/jsdialog/Util.Dropdown.js b/browser/src/control/jsdialog/Util.Dropdown.js index 6f011e0637bb..de2e6f98b796 100644 --- a/browser/src/control/jsdialog/Util.Dropdown.js +++ b/browser/src/control/jsdialog/Util.Dropdown.js @@ -153,10 +153,8 @@ JSDialog.OpenDropdown = function (id, popupParent, entries, innerCallback, popup JSDialog.CloseDropdown(id); }; }; - L.Map.THIS.fire('jsdialog', {data: json, callback: generateCallback(entries)}); - L.Map.THIS.fire('closepopups'); // close popups if a dropdown menu is opened - L.Map.THIS._docLayer._resetReferencesMarks(); + L.Map.THIS.fire('jsdialog', {data: json, callback: generateCallback(entries)}); }; JSDialog.CloseDropdown = function (id) { From f71ae0d9be63270b4537e84201e13bb333d0a696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20=C3=87i=C3=A7ek?= Date: Thu, 9 Jan 2025 18:17:38 +0300 Subject: [PATCH 3/3] close all popups if a row/column header is selected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bayram Çiçek Change-Id: I1149cc64482a8bd1370a9ebee53d044e12ce2927 --- browser/src/control/Control.Header.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/browser/src/control/Control.Header.ts b/browser/src/control/Control.Header.ts index bfd5cfeafe8e..d9441279fd00 100644 --- a/browser/src/control/Control.Header.ts +++ b/browser/src/control/Control.Header.ts @@ -635,6 +635,8 @@ export class Header extends app.definitions.canvasSectionObject { L.DomUtil.enableImageDrag(); L.DomUtil.enableTextSelection(); + this._map.fire('closepopups'); // close all popups if a row/column header is selected + if (this.containerObject.isDraggingSomething() && this._dragEntry) { this.onDragEnd(this.containerObject.getDragDistance()); this._dragEntry = null;