-
Notifications
You must be signed in to change notification settings - Fork 30
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
GLSP-1399: Fix MousePositionTracker #391
Conversation
Ensure that the `GLSPMousePositionTracker` correctly calculates the diagram local mouse position
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.
Change looks good to me and seems to work well. Just unsure whether we want to keep the now unused field injection.
@@ -38,9 +29,9 @@ export class GLSPMousePositionTracker extends MousePositionTracker implements Ra | |||
override mouseMove(target: GModelElement, event: MouseEvent): (Action | Promise<Action>)[] { | |||
// we cannot simply use the offsetX and offsetY properties of the event since they also consider nested HTML elements | |||
// such as foreignObjects or the projection bars divs. Instead, we manually translate the client coordinates to the diagram | |||
const clientToRoot = getAbsoluteClientBounds(target.root, this.domHelper, this.viewerOptions); |
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.
If we change this line, we might also remove the injection of the domHelper
and the viewerOptions
or is that something you would like to keep for backwards compatibility? I'm a bit unsure because it is only a single method that we are actually providing.
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.
You are absolutely right. I think we can just remove them
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.
LGTM!
What it does
Ensure that the
GLSPMousePositionTracker
correctly calculates the diagram local mouse positionHow to test
Ensure that resize/move still works as expected.
Also test the corner case with resizing/moving near/over the projection bars
If you want to verify the tracked position you can add a log point in the
GLSPMousePositionTracker.mouseMove
methodFollow-ups
Changelog