AS3SVGRenderer icon indicating copy to clipboard operation
AS3SVGRenderer copied to clipboard

Adding and removing style declarations doesn't change render

Open markviewbix opened this issue 8 years ago • 2 comments

Hi,

I have an SVGDocument which I created by the load() function. Once the document has been rendered, I want to change some of the colors of the svg. I do this by calling removeStyleDeclaration and addStyleDeclaration for the style I want to change with a new style created by createdFromString.

The problem is that this doesn't change the colors of the render. Is there something else I need to do?

Thanks,

Mark

markviewbix avatar Jun 02 '16 08:06 markviewbix

Hey,

That's a bug, changes to declaration should invalidate all styles.

You can invalidate all styles by yourself calling:

document.invalidateStyle(true); //parameter is if the invalidation should be recursive, invalidating all nested elements

That method is here: https://github.com/LucasLorentz/AS3SVGRenderer/blob/master/SVGRenderer/src/com/lorentz/SVG/display/base/SVGElement.as#L329

Cheers,

Lucas Lorentz

lucaslorentz avatar Jun 03 '16 01:06 lucaslorentz

Thanks! I figured that out after I posted the issue. I'm glad the solution I hit on was the correct one.

On Fri, Jun 3, 2016, 4:46 AM Lucas Lorentz [email protected] wrote:

Hey,

That's a bug, changes to declaration should invalidate all styles.

You can invalidate all styles by yourself calling:

document.invalidateStyle(true); //parameter is if the invalidation should be recursive, invalidating all nested elements

That method is here:

https://github.com/LucasLorentz/AS3SVGRenderer/blob/master/SVGRenderer/src/com/lorentz/SVG/display/base/SVGElement.as#L329

Cheers,

Lucas Lorentz

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/LucasLorentz/AS3SVGRenderer/issues/53#issuecomment-223470882, or mute the thread https://github.com/notifications/unsubscribe/AJ4MwqF6JNTeHbJ34Qgvdu0nZoVle_bCks5qH4eMgaJpZM4IsTQ0 .

markviewbix avatar Jun 03 '16 05:06 markviewbix