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

feat: animation events #1276

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

Conversation

Kneemund
Copy link
Collaborator

@Kneemund Kneemund commented Nov 5, 2024

Adds the ability to (continuously) request AnimationFrame pen events to render animations that are not strictly tied to other pen events.

  • Needed (in some form) for Laser tool? (feature request) #476 and its upcoming PR.
  • An additional struct Animation is added to the engine and used to ensure that only one AnimationFrame is in flight at a time.

Things to Discuss

  • We can either "pull" handle_pen_event out of the engine and into the canvas, which is how it's currently done, or use EngineTasks to make the engine call itself (currently commented). The former seems cleaner and likely faster, the latter allows us to get rid of the additional EventResult field and request animation frames from anywhere with access to the engine (i.e. also in the event handlers themselves).
  • Use a struct instead of the tuple (EventPropagation, WidgetFlags, bool) in the handle_pen_event functions.
  • Give glib::source::idle_add_local_once a different priority or use a different method. I just used what works on my machine and seems correct given my limited knowledge of the glib event loop.

EDIT: Perhaps we could turn request_animated_frame into a field of PenProgress::InProgress. That would reduce the flexibility though.

@Kneemund Kneemund requested a review from flxzt November 5, 2024 19:19
@Kneemund Kneemund mentioned this pull request Nov 6, 2024
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.

1 participant