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

Make the svg function to accept a path #2235

Merged
merged 2 commits into from
Feb 5, 2024
Merged

Make the svg function to accept a path #2235

merged 2 commits into from
Feb 5, 2024

Conversation

fogarecious
Copy link
Contributor

Currently, to load an SVG file by the svg function, we have to call Handle::from_path.

use iced::widget::{svg, svg::Handle};
// ...
svg(Handle::from_path("path-to-pic.svg"));

A more ideal way is to pass the path directly into the svg function.

svg("path-to-pic.svg");

This PR enhances the convenience by adding From<T: Into<PathBuf>> to the Svg Handle. The modified code achieves consistency with the image counterpart.

@hecrj hecrj added this to the 0.12 milestone Feb 4, 2024
@hecrj hecrj added feature New feature or request svg addition labels Feb 4, 2024
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@hecrj hecrj enabled auto-merge February 5, 2024 22:53
@hecrj hecrj merged commit b5b267c into iced-rs:master Feb 5, 2024
13 checks passed
@fogarecious fogarecious deleted the add-from-pathbuf-to-svg-handle branch February 22, 2024 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition feature New feature or request svg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants