mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 21:37:59 +00:00
Bézier-rs: Add ids to manipulator groups (#1054)
* Add ids to manipulator groups * Fix tests * Rename trait from ManipulatorGroupId to Identifier * Rename EmptyManipulatorGroupId to EmptyId
This commit is contained in:
parent
7a52e50a94
commit
08b2782917
8 changed files with 93 additions and 27 deletions
|
@ -6,9 +6,18 @@ use glam::DVec2;
|
|||
use std::fmt::Write;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
pub(crate) struct EmptyId;
|
||||
|
||||
impl bezier_rs::Identifier for EmptyId {
|
||||
fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper of the `Subpath` struct to be used in JS.
|
||||
#[wasm_bindgen]
|
||||
pub struct WasmSubpath(Subpath);
|
||||
pub struct WasmSubpath(Subpath<EmptyId>);
|
||||
|
||||
const SCALE_UNIT_VECTOR_FACTOR: f64 = 50.;
|
||||
|
||||
|
@ -31,6 +40,7 @@ impl WasmSubpath {
|
|||
anchor: point_triple[0].unwrap(),
|
||||
in_handle: point_triple[1],
|
||||
out_handle: point_triple[2],
|
||||
id: EmptyId,
|
||||
})
|
||||
.collect();
|
||||
WasmSubpath(Subpath::new(manipulator_groups, closed))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue