Skip to content

Implement fill tool #254

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

Merged
merged 9 commits into from
Jul 14, 2021
Merged

Implement fill tool #254

merged 9 commits into from
Jul 14, 2021

Conversation

henryksloan
Copy link
Contributor

@henryksloan henryksloan commented Jul 13, 2021

Closes #152

  • Enabled the Fill tool icon
  • Added a set_fill method to Fill
    • Should all getters and setters be added to Fill and Stroke for consistency?
  • Added a new operation that replaces a layer's fill with a given color
  • Added an input entry mapping MouseDown + Lmb to the Fill tool
  • Added Fill as a #[child] to the tool_message_handler
  • Implemented the Fill click handler, generating a FillLayer operation with the primary color, targeting a clicked layer (if any)

The biggest caveat at the moment is the ad hoc click detection. I'm using intersects_quad_root with a small rectangle centered on the mouse. This works (though it gives an extra pixel of padding to the click), but I imagine intersects_point and intersects_point_root functions should be implemented in the future (I can open an issue for that if we agree it would be preferred).

Also, when multiple layers are returned by intersects_quad_root, I am using the first of them. This seems to correspond to the visually lowest layer; should it instead use the last item returned?


This change is Reviewable

@Keavon Keavon requested a review from TrueDoctor July 13, 2021 06:38
@Keavon
Copy link
Member

Keavon commented Jul 13, 2021

Should all getters and setters be added to Fill and Stroke for consistency?

Might as well!

@henryksloan henryksloan requested a review from 0HyperCube July 14, 2021 06:23
@Keavon Keavon requested a review from TrueDoctor July 14, 2021 06:34
@@ -56,6 +56,24 @@ impl PathStyle {
pub fn new(stroke: Option<Stroke>, fill: Option<Fill>) -> Self {
Self { stroke, fill }
}
pub fn get_fill(&self) -> Option<Fill> {
Copy link
Member

Choose a reason for hiding this comment

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

please remove the get wherever you see it: https://rust-lang.github.io/api-guidelines/naming.html
our codebase is not yet consistent in that regard but it is something we want to improve on

@TrueDoctor TrueDoctor dismissed 0HyperCube’s stale review July 14, 2021 07:00

It seems to me, as if all points have been addressed

@TrueDoctor
Copy link
Member

Alright, feel free to merge once the ci is done

@Keavon Keavon merged commit 9d34aa4 into GraphiteEditor:master Jul 14, 2021
Keavon pushed a commit that referenced this pull request Jun 16, 2022
* Implement fill tool

* Add fill tool shortcut

* Add getters and setters to styles

* Make fill tool act on the topmost layer clicked

* Refactor fill operation

* Refactor and unify selection tolerance

* Add mark_as_dirty function

* Fix getter names
Keavon pushed a commit that referenced this pull request Jul 30, 2023
* Implement fill tool

* Add fill tool shortcut

* Add getters and setters to styles

* Make fill tool act on the topmost layer clicked

* Refactor fill operation

* Refactor and unify selection tolerance

* Add mark_as_dirty function

* Fix getter names
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.

New Tool: Fill Tool
4 participants