mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
New node: Pointer Position (#3535)
* New node: Pointer Position * Fix test
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use core_types::{Ctx, ExtractAnimationTime, ExtractRealTime};
|
||||
use core_types::{Ctx, ExtractAnimationTime, ExtractPointer, ExtractRealTime};
|
||||
use glam::DVec2;
|
||||
|
||||
const DAY: f64 = 1000. * 3600. * 24.;
|
||||
|
||||
@@ -47,6 +48,12 @@ fn animation_time(ctx: impl Ctx + ExtractAnimationTime) -> f64 {
|
||||
ctx.try_animation_time().unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Produces the current position of the user's pointer within the document canvas.
|
||||
#[node_macro::node(category("Animation"))]
|
||||
fn pointer_position(ctx: impl Ctx + ExtractPointer) -> DVec2 {
|
||||
ctx.try_pointer().unwrap_or_default()
|
||||
}
|
||||
|
||||
// TODO: These nodes require more sophisticated algorithms for giving the correct result
|
||||
// #[node_macro::node(category("Animation"))]
|
||||
// fn month(ctx: impl Ctx + ExtractRealTime) -> f64 {
|
||||
|
||||
Reference in New Issue
Block a user