Skip to content
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

Merged
merged 2 commits into from
Sep 10, 2024
Merged

GLSP-1399: Fix MousePositionTracker #391

merged 2 commits into from
Sep 10, 2024

Conversation

tortmayr
Copy link
Contributor

@tortmayr tortmayr commented Sep 4, 2024

What it does

Ensure that the GLSPMousePositionTracker correctly calculates the diagram local mouse position

How 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 method

Follow-ups

Changelog

  • This PR should be mentioned in the changelog
  • This PR introduces a breaking change (if yes, provide more details below for the changelog and the migration guide)

Ensure that the `GLSPMousePositionTracker` correctly calculates the
diagram local mouse position
Copy link
Contributor

@martin-fleck-at martin-fleck-at left a 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);
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@martin-fleck-at martin-fleck-at left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tortmayr tortmayr merged commit d472c7a into master Sep 10, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants