-
Notifications
You must be signed in to change notification settings - Fork 732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sc: remove context-menu-layer for autofill context-menu #10784
base: master
Are you sure you want to change the base?
Conversation
Peek.2024-12-20.14-45.mp4 |
is it finished? or still draft/wip ? |
still WIP. I'm trying to fix some issues. |
- generate a left mouse click so that a single click can select a cell after closing the autofill context menu. - we avoid the second click to select a cell after autofill context menu is opened. - this only applies to the autofill context-menu. other context menus should not be affected. Signed-off-by: Bayram Çiçek <[email protected]> Change-Id: Iaf7b5c09003291f27155ae9ab6787f2f871ac466
0be6fd4
to
594b2f8
Compare
before: (master)Peek.2025-01-03.12-55-master.mp4after:Peek.2025-01-03.12-58-after.mp4 |
// generate a left mouse click so that a single click can select a cell | ||
// after closing the autofill context menu | ||
this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0); | ||
this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, isn't the autofill menu generated in online?
or do we pass it from core? (I don't remember)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
autofill contextmenu is generated in online. (only items in the context menu send UNO command to the core.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but does it take any data from core to create that popup?
if NOT use core at all to invoke popup -> this approach is possibly wrong -> why we would need to do additional click in core while popup was online only? or I missed something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but does it take any data from core to create that popup? if NOT use core at all to invoke popup -> this approach is possibly wrong -> why we would need to do additional click in core while popup was online only? or I missed something?
yes, that's right. Is there any way to do additional click on the online? I thought _postMouseEvent
is on the online.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then - adding a click feels like workaround. It would be good to be able to answer: why we need additional click?
Do we have present .jsdialog-overlay
on the screen maybe? Or the map/canvas
is not in focus?
Do you have some logs from the browser - what happens just after the first click?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then - adding a click feels like workaround.
- yes. we can say that it is a workaround.
It would be good to be able to answer:
why we need additional click?
- after opening the autofill contexmenu there is a id="context-menu-layer" that blocks scroll and clicking on the cells.
- if we click on a cell -to select it-, it does not click the cell but removes the layer. So if we add an additional click at this point, then we can click on the cell we are on - after that layer was removed - without need to double click.
Do we have present
.jsdialog-overlay
on the screen maybe?
- we have
id="context-menu-layer"
Or the
map/canvas
is not in focus?
gets focus after contextmenu is hidden.
Control.ContextMenu.js:219
hide: function() {
if(autoFillContextMenu)
app.map._docLayer._resetReferencesMarks();
map.focus();
}
Do you have some logs from the browser - what happens just after the first click?
hide: function()
^^^ executes and id="context-menu-layer"
is removed. then auto contextmenu is closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. what about something like:
diff --git a/browser/src/control/Control.ContextMenu.js b/browser/src/control/Control.ContextMenu.js
index aecb8a6fe7..c7a13d264c 100644
--- a/browser/src/control/Control.ContextMenu.js
+++ b/browser/src/control/Control.ContextMenu.js
@@ -204,9 +204,22 @@ L.Control.ContextMenu = L.Control.extend({
var $menu = opt.$menu;
$menu.attr('tabindex', 0); // Make the context menu focusable
},
+ activated: function (opt) {
+ console.error('activated');
+ console.error(opt);
+
+ var $layer = opt.$layer;
+ $layer.css('pointer-events', 'none'); // layer doesn't get mouse clicks
+
+ $layer.on('mousedown', function () {
+ console.error('This click handler will not be fired');
+ });
+ },
hide: function() {
- if(autoFillContextMenu)
+ if(autoFillContextMenu) {
app.map._docLayer._resetReferencesMarks();
+ console.error('but this will be still fired thanks to entry in context menu');
+ }
map.focus();
activated
event is called when context menu is built and ready to use.
We can just remove the layer on show but.. perfect would be to just not handle clicks to avoid errors inside jQuery.
you can read also internals of jQuery: browser/node_modules/jquery-contextmenu/src/jquery.contextMenu.js
for interesting details
did you test that with multiple users? does the autofil from A view have impact on B? |
my experience with multiple users seem work as expected. (or should it behave different?) Peek.2025-01-03.15-26.mp4 |
Change-Id: Iaf7b5c09003291f27155ae9ab6787f2f871ac466
Checklist
make prettier-write
and formatted the code.make check
make run
and manually verified that everything looks okay