-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
mouse standard actions #2337
Comments
Current issues:
To overcome the currently scattered event listener handling in Why do we need such a global event listener service? Imho we have several services already competing over the the limited resource "eventXY", thus such a service can act as an dispatching gateway dealing with these aspects:
Basically this reads like we are doing our own GUI event framework, still I think we need a single point of responsibility for event listeners and dispatching rules to overcome the problems we currently have here. |
Can you elaborate on your idea with routing and rules a little more closely? I do like the // selection manager
terminalElement.addEventListener('mousedown', (e) => ...)
// input handler
terminalElement.addEventListener('mousedown', (e) => ...) We would have something like this: // selection manager
const disposable = domEventService.addEventListener('mousedown', 10, (e) => ...)
// input handler
const disposable = domEventService.addEventListener('mousedown', 100, (e) => ...) This way, we would dispatch the This would establish an ordered chain of listeners, where any listener in the chain can decide to stop the event, so it doesn't get consumed by lower prio listeners: mousedown > selection manager > input handler > some other listener > ... Is this in line with your idea? |
@mofux: I have not yet thought about this in detail, but imho this could be part of the routing. The CoreMouseService.triggerMouseEvent already contains a boolean return value, that could be used to decide the further bubbling. A priority setting would help during initial setup to get it working without caring to much about attach order from other services. Without it we would have to make sure that services register the events in the right order, with the priority setting we can juggle that in the event service itself. Getting this wrapped into a good interface design is abit tricky, not sure yet if we should go with multiple listeners that use native event handler queueing and bubbling (preventDefault, stopPropagation and such), or if it might be easier to register just one listener for eventXY and do the routing/dispatching afterwards. From my limited mouse event listener understanding, the latter might be easier in combination with our own custom internal events for a simple reason - the service can replace the native listeners anytime to fullfill the requested events needs, while dealing with those within the listener code directly might be hard to catch all conditions. I can imagine that something like this would work:
|
Closing this as it got stale. This might be relevant once we get to internal API-asation, but its easy to come up with better suitable ideas based on the shifted services later on. |
While reworking the mouse handling and writing tests for it it became obvious that we have issues with mouse standard actions:
Whats needed:
Refs:
The text was updated successfully, but these errors were encountered: