yds12 / tarsila

Pixel art and spritesheet editor
Other
141 stars 7 forks source link

WIP: Highlight active tool #24

Closed crumblingstatue closed 1 year ago

crumblingstatue commented 1 year ago

This is a proof-of-concept feature of highlighting the active tool. This allows the user to see what the current tool is, even if they are using the crosshair cursor.

In this screenshot, the eyedropper tool is active. image

crumblingstatue commented 1 year ago

Unresolved questions:

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage has no change and project coverage change: +4.47 :tada:

Comparison is base (6a4f2ba) 20.74% compared to head (4ce2752) 25.22%.

:exclamation: Current head 4ce2752 differs from pull request most recent head cd2acc7. Consider uploading reports for the commit cd2acc7 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #24 +/- ## ========================================== + Coverage 20.74% 25.22% +4.47% ========================================== Files 35 35 Lines 3610 3620 +10 ========================================== + Hits 749 913 +164 + Misses 2861 2707 -154 ``` | [Impacted Files](https://codecov.io/gh/yds12/tarsila/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=yds12) | Coverage Δ | | |---|---|---| | [tarsila/src/gui/mod.rs](https://codecov.io/gh/yds12/tarsila/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=yds12#diff-dGFyc2lsYS9zcmMvZ3VpL21vZC5ycw==) | `0.00% <0.00%> (ø)` | | | [tarsila/src/gui/toolbar.rs](https://codecov.io/gh/yds12/tarsila/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=yds12#diff-dGFyc2lsYS9zcmMvZ3VpL3Rvb2xiYXIucnM=) | `0.00% <0.00%> (ø)` | | ... and [6 files with indirect coverage changes](https://codecov.io/gh/yds12/tarsila/pull/24/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=yds12) Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=yds12). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=yds12)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

yds12 commented 1 year ago

I like it! For the color, maybe a lighter version of the normal color? Could also be a colored highlight. Feel free to choose.

Please pass LapixState in the sync phase, so we can have access to selected_tool in self. Before calling update we usually call sync on gui components, passing any updated info they need. On update they read from their own state. This is explained in more detail here: https://github.com/yds12/tarsila/blob/master/ARCHITECTURE.md#frontend-lifecycle

Other than that PR looks good to me.

Update: sorry, I made a confusion above, we need to pass just the selected tool in the sync phase, not the whole LapixState (that would be impossible due to lifetimes etc).

crumblingstatue commented 1 year ago

Thank you, I addressed your responses. This is ready for review now.

crumblingstatue commented 1 year ago

Hmm, actually there is one notable issue. I'm currently using Ui::scope for styling, but it seems to destroy the wrapping layout of the toolbar buttons.

Before: image

After: image

I'll try to look for some solution.

crumblingstatue commented 1 year ago

I'm working around the Ui::scoped problem by manually resetting the old style. Let me know if that's an acceptable solution to you.

yds12 commented 1 year ago

Thank you! It's a subtle but nice addition. The workaround is ok, if we find another way later we can try to fix but it's not a big deal.

Merging!