mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 05:18:19 +00:00
Remove artboard from graphic element (#1824)
* Remove artboard from graphic element * Fix transform bug
This commit is contained in:
parent
027d3f4e60
commit
0c2e3361ab
4 changed files with 51 additions and 72 deletions
|
@ -121,15 +121,6 @@ impl ArtboardGroup {
|
|||
fn add_artboard(&mut self, artboard: Artboard) {
|
||||
self.artboards.push(artboard);
|
||||
}
|
||||
|
||||
pub fn get_graphic_group(&self) -> GraphicGroup {
|
||||
let mut graphic_group = GraphicGroup::EMPTY;
|
||||
for artboard in self.artboards.clone() {
|
||||
let graphic_element: GraphicElement = artboard.into();
|
||||
graphic_group.push(graphic_element);
|
||||
}
|
||||
graphic_group
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ConstructLayerNode<Stack, GraphicElement> {
|
||||
|
@ -240,11 +231,6 @@ impl From<GraphicGroup> for GraphicElement {
|
|||
GraphicElement::GraphicGroup(graphic_group)
|
||||
}
|
||||
}
|
||||
impl From<Artboard> for GraphicElement {
|
||||
fn from(artboard: Artboard) -> Self {
|
||||
GraphicElement::Artboard(artboard)
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for GraphicGroup {
|
||||
type Target = Vec<GraphicElement>;
|
||||
|
@ -265,7 +251,6 @@ trait ToGraphicElement: Into<GraphicElement> {}
|
|||
|
||||
impl ToGraphicElement for VectorData {}
|
||||
impl ToGraphicElement for ImageFrame<Color> {}
|
||||
impl ToGraphicElement for Artboard {}
|
||||
|
||||
impl<T> From<T> for GraphicGroup
|
||||
where
|
||||
|
|
|
@ -469,15 +469,19 @@ impl GraphicElementRendered for Artboard {
|
|||
|
||||
impl GraphicElementRendered for crate::ArtboardGroup {
|
||||
fn render_svg(&self, render: &mut SvgRender, render_params: &RenderParams) {
|
||||
self.get_graphic_group().render_svg(render, render_params);
|
||||
for artboard in &self.artboards {
|
||||
artboard.render_svg(render, render_params);
|
||||
}
|
||||
}
|
||||
|
||||
fn bounding_box(&self, transform: DAffine2) -> Option<[DVec2; 2]> {
|
||||
self.get_graphic_group().bounding_box(transform)
|
||||
self.artboards.iter().filter_map(|element| element.bounding_box(transform)).reduce(Quad::combine_bounds)
|
||||
}
|
||||
|
||||
fn add_click_targets(&self, click_targets: &mut Vec<ClickTarget>) {
|
||||
self.get_graphic_group().add_click_targets(click_targets);
|
||||
for artboard in &self.artboards {
|
||||
artboard.add_click_targets(click_targets);
|
||||
}
|
||||
}
|
||||
|
||||
fn contains_artboard(&self) -> bool {
|
||||
|
|
|
@ -289,7 +289,6 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
|||
async_node!(graphene_core::ops::IntoNode<_, GraphicGroup>, input: ImageFrame<Color>, output: GraphicGroup, params: []),
|
||||
async_node!(graphene_core::ops::IntoNode<_, GraphicGroup>, input: VectorData, output: GraphicGroup, params: []),
|
||||
async_node!(graphene_core::ops::IntoNode<_, GraphicGroup>, input: GraphicGroup, output: GraphicGroup, params: []),
|
||||
async_node!(graphene_core::ops::IntoNode<_, GraphicGroup>, input: Artboard, output: GraphicGroup, params: []),
|
||||
#[cfg(feature = "gpu")]
|
||||
async_node!(graphene_core::ops::IntoNode<_, &WgpuExecutor>, input: &WasmEditorApi, output: &WgpuExecutor, params: []),
|
||||
register_node!(graphene_std::raster::MaskImageNode<_, _, _>, input: ImageFrame<Color>, params: [ImageFrame<Color>]),
|
||||
|
@ -753,11 +752,9 @@ fn node_registry() -> HashMap<ProtoNodeIdentifier, HashMap<NodeIOTypes, NodeCons
|
|||
register_node!(graphene_core::ToGraphicElementNode, input: graphene_core::vector::VectorData, params: []),
|
||||
register_node!(graphene_core::ToGraphicElementNode, input: ImageFrame<Color>, params: []),
|
||||
register_node!(graphene_core::ToGraphicElementNode, input: GraphicGroup, params: []),
|
||||
register_node!(graphene_core::ToGraphicElementNode, input: Artboard, params: []),
|
||||
register_node!(graphene_core::ToGraphicGroupNode, input: graphene_core::vector::VectorData, params: []),
|
||||
register_node!(graphene_core::ToGraphicGroupNode, input: ImageFrame<Color>, params: []),
|
||||
register_node!(graphene_core::ToGraphicGroupNode, input: GraphicGroup, params: []),
|
||||
register_node!(graphene_core::ToGraphicGroupNode, input: Artboard, params: []),
|
||||
async_node!(graphene_core::ConstructArtboardNode<_, _, _, _, _, _>, input: Footprint, output: Artboard, fn_params: [Footprint => GraphicGroup, () => String, () => glam::IVec2, () => glam::IVec2, () => Color, () => bool]),
|
||||
async_node!(graphene_core::AddArtboardNode<_, _>, input: Footprint, output: ArtboardGroup, fn_params: [Footprint => ArtboardGroup, Footprint => Artboard]),
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue