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

Magic contour selection #1704

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Magic contour selection #1704

wants to merge 19 commits into from

Conversation

GaetanBaehr
Copy link
Collaborator

A pull request for magic contour selection with the pointer tool.

By holding the cmd (metaKey) modifier key:

  • Clicking anywhere in the glyph editor view selects the nearest contour.
  • Holding shift and clicking somewhere else adds the nearest contour to the selection.
  • Dragging the mouse changes the selection to the nearest contour.
  • Dragging while holding shift adds the nearest contours to the selection.

Note:
In path-hit-tester.js -> PathHitTester -> findNearest, I commented out line 65:
results = results.filter((hit) => hit.t != 0 && hit.t != 1);

This line restricts findNearest to only work when, in the case of a rectangular shape, the cursor's x value is between the rectangle's xmin and xmax, or the y value is between its ymin and ymax.
This function is used exclusively with the power ruler tool and now the pointer tool. Commenting out this line seems to have no effect on the power ruler tool.

Copy link
Collaborator

@justvanrossum justvanrossum left a comment

Choose a reason for hiding this comment

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

This is not yet a solid code review, but I found one small issue.

However, there is a bigger thing missing: whenever the "magic behavior" is active (regardless of how we decide to activate it), the user should see what will be selected once they click. In other words, this is missing "hover" behavior. It should set sceneController.hoverSelection appropriately while hovering.

}
const selection = this._selectionBeforeSingleClick || sceneController.selection;
this._selectionBeforeSingleClick = undefined;
const modeFunc = selectModeFunction(event);
Copy link
Collaborator

Choose a reason for hiding this comment

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

While refactoring this bit of code, you forgot to pass event down. This is now falling back to window.event, which is probably just accidentally working. (window.event is a deprecated property.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants