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

refactor(ui): layer interaction locking #7234

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

psychedelicious
Copy link
Collaborator

Summary

Previously we maintained an isInteractable flag, which was derived from these layer flags:

  • Locked/unlocked
  • Enabled/disabled
  • Layer's type visible/hidden

When a layer was not interactable, we blocked all layer actions.

After comparing to the behaviour in Affinity and considering user feedback, I've loosened these restrictions while maintaining safety. First, some definitions.

There two kinds of layer actions - mutating actions and non-mutating actions.

  • Mutating actions are drawing on the layer, cropping it, filtering it, converting it, etc. Anything that changes the layer.
  • Non-mutating actions are copying the layer, saving the layer to gallery, etc. Anything that uses the layer.

Then, there are two broad canvas states - busy and not busy. "Busy" means the canvas is actively filtering, staging, compositing layers together, etc - something that is "single-threaded" by nature.

And here are the revised restrictions:

  • When canvas is busy, you cannot initiate any layer actions.
  • When the canvas is not busy, and the layer is locked, you initiate any mutating actions.
  • When the canvas is not busy and the layer is not locked, you can initiate any layer action.

Besides safely giving users more freedom, it also fixes an issue where the context menu for a layer was disabled if it was not the selected layer.

Related Issues / Discussions

https://discord.com/channels/1020123559063990373/1149506274971631688/1301195129570201680

QA Instructions

Test out combinations of the restrictions. There are a lot of permutations.

Merge Plan

n/a

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

@github-actions github-actions bot added the frontend PRs that change frontend files label Oct 31, 2024
@psychedelicious psychedelicious enabled auto-merge (rebase) October 31, 2024 05:52
Previously we maintained an `isInteractable` flag, which was derived from these layer flags:
- Locked/unlocked
- Enabled/disabled
- Layer's type visible/hidden

When a layer was not interactable, we blocked all layer actions.

After comparing to the behaviour in Affinity and considering user feedback, I've loosened these restrictions while maintaining safety. First, some definitions.

There two kinds of layer actions - mutating actions and non-mutating actions.
- Mutating actions are drawing on the layer, cropping it, filtering it, converting it, etc. Anything that changes the layer.
- Non-mutating actions are copying the layer, saving the layer to gallery, etc. Anything that _uses_ the layer.

Then, there are two broad canvas states - busy and not busy. "Busy" means the canvas is actively filtering, staging, compositing layers together, etc - something that is "single-threaded" by nature.

And here are the revised restrictions:
- When canvas is busy, you cannot initiate any layer actions.
- When the canvas is not busy, and the layer is locked, you initiate any mutating actions.
- When the canvas is not busy and the layer is not locked, you can initiate any layer action.

Besides safely giving users more freedom, it also fixes an issue where the context menu for a layer was disabled if it was not the selected layer.
@psychedelicious psychedelicious merged commit 0f5df8b into main Oct 31, 2024
14 checks passed
@psychedelicious psychedelicious deleted the psyche/fix/ui/canvas-misc branch October 31, 2024 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants