Skip to content

Commit

Permalink
feat: svg required components
Browse files Browse the repository at this point in the history
  • Loading branch information
simbleau committed Feb 10, 2025
1 parent a2ba893 commit 6d73312
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 6 additions & 7 deletions examples/svg/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ fn main() {
fn load_svg(mut commands: Commands, asset_server: ResMut<AssetServer>) {
commands.spawn((Camera2d, VelloView));

// Yes, it's this simple.
commands.spawn(VelloSvgBundle {
asset: VelloSvgHandle(asset_server.load("embedded://svg/assets/fountain.svg")),
debug_visualizations: DebugVisualizations::Visible,
transform: Transform::from_scale(Vec3::splat(5.0)),
..default()
});
// You can also use `VelloSvgBundle`
commands
.spawn(VelloSvgHandle(
asset_server.load("embedded://svg/assets/fountain.svg"),
))
.insert(Transform::from_scale(Vec3::splat(5.0)));
}
8 changes: 8 additions & 0 deletions src/integrations/svg/asset.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
use crate::prelude::*;
use bevy::{prelude::*, reflect::TypePath};
use std::sync::Arc;

#[derive(Component, Default, Debug, Clone, Deref, DerefMut, PartialEq, Eq)]
#[require(
VelloSvgAnchor,
CoordinateSpace,
Transform,
DebugVisualizations,
Visibility
)]
pub struct VelloSvgHandle(pub Handle<VelloSvg>);

#[derive(Asset, TypePath, Clone)]
Expand Down

0 comments on commit 6d73312

Please sign in to comment.