Skip to content

Feature pull request: Mutable SVG object in runtime#70

Open
wonson wants to merge 9 commits intoBigBadaboom:masterfrom
wonson:master
Open

Feature pull request: Mutable SVG object in runtime#70
wonson wants to merge 9 commits intoBigBadaboom:masterfrom
wonson:master

Conversation

@wonson
Copy link

@wonson wonson commented Oct 13, 2015

I modify your code to make the SVG mutable, Including:

  • public your svg tag classes and value type class (user may new and modify from outside)
  • add saveSVGState and restoreSVGState (like push and pop), restoreOriginalSVGState (Like openGL load identity)
    etc.

Please take a look.

I followed you from GoogleCode. You said you will parse it to DOM-tree, I dunno if it is still on. But may be you can accept this first and let people do these things first. After you finish the DOM-tree implementation, you can level up your version to 2.x.x

wonson added 3 commits October 9, 2015 02:43
Make public of value type classes and all SVG-Tag-related classes
Move the value type classes to new files
Add getters and setters for public access (Becoz of make it mutable from outside) but package-private direct access to instance variables
Minor changes to getElementByXXX methods
@wonson wonson closed this Oct 13, 2015
@wonson wonson reopened this Oct 13, 2015
@BigBadaboom
Copy link
Owner

Hi. Thanks for posting this. This is an interesting patch. I'm curious how you are using these changes yourself. What is it enabling you to do that you couldn't do before?

@wonson
Copy link
Author

wonson commented Oct 14, 2015

I have 2 major usage:

  • Change color in runtime
  • Draw only specified group with "display" attribute (so that I can draw sprite with common in different frame. Imagine that how u make a gif animation by enabling various layers in different frame)

After the change is set, I render the SVG object into picture, then restore original SVG state and the another change, and so on.

@wonson
Copy link
Author

wonson commented Oct 14, 2015

But the code is not thoroughly tested. I only use it with some tags I've used. You'd better test the code more with your own test case. :P

@ultimate-deej
Copy link

This is definitely stale, but it would still be a useful feature.
CSS customization is an option, but a very limited one. Mutable SVG objects could potentially provide much more flexibiltiy, along with a more natural programmatic way of doing so (as opposed to css strings).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants