fxsvgimage icon indicating copy to clipboard operation
fxsvgimage copied to clipboard

Scale to parent element

Open kxygk opened this issue 2 years ago • 2 comments

(Hope its okay to post questions in the Issues) I'm not much of an JavaFX expert .. but I'm a bit confused about the library design

I've been trying to get my SVGImage to scale to a parent element (ex: A StackPane). I'd like to avoid manually scaling it or passing around width/height parameters. However the SVGImage seems to refuse to rescale unless passed in a scaling parameter :) I can make a huge SVGImage group, but it'll just spill out of the StackPane or force the parent size to grow

Am I doing something wrong or is this the intended behavior? The library seems to be designed with the SVGImage being scaled itself. (I can see you can also rescale it after it's created as well)

Could you for instance have the SVGImage group as part of StackPane and have it rescale as the window size is changed? or would you need to track the window size and rescale the SVG all the time?

Unfortunately I'm working through Clojure (and cljfx), so I'm not able to make an minimal example here...

kxygk avatar Jan 27 '23 11:01 kxygk

Hello,

I will look at that problem this week-end normally :)

hervegirod avatar Jan 27 '23 15:01 hervegirod

I was a bit hesitant to post the issue b/c It's quite possible I just did something wrong! There might be some way to wrap the SVGImage so that it gets scaled (without having to rasterize to an Image) - but I haven't found the right combination yet

I think scaling to the parent, so it fills the StackPane of a V/HBox, is just a bit more idiomatic JFX. Maybe this doesn't come up for you though

Thanks again for the project, and for being so responsive on the Issues. Hope I can integrate this in my meteorology software

kxygk avatar Jan 28 '23 07:01 kxygk