Thanks for the tip.
In what kind of tiddler do you put the script instruction ?
Le mardi 17 novembre 2015 22:40:54 UTC+1, BJ a écrit :I can use it loading the lib like:
<script src='https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.4.1/snap.svg-min.js'/>
Did you get anything working with this? I have played with snap.js a bit and have a minimally working version but it is done in what is probably the worst way possible. The snap script is added using $:/tags/rawmarkup and the svg images are defined using raw javascript in a tiddler.
The script is included using raw markup because I tried to put it in a tiddler like with d3.js and the other javascript libraries and the library would load fine, but whenever I tried to use it I would get an error that said that eve was undefined.
The other problems I have encountered are that since the dom has to be able to refresh at any time if you have animations they will be repeated whenever a tiddler is opened or sometimes when tabs are changed and a lot of other times too. So if we are going to use something like this than there will need to be lots of state variables stored. Or we may need to copy some tricks from the list widget for selectively refreshing elements if possible.
One thing I don't remember how to do is make the widget refresh when the tiddler containing the svg script is changed. Any suggestions for that?
I spent a big chunk of my weekend playing with this. I like it. How easy it is to take a library like this and use tiddlywiki to make a simple svg authoring tool is one big reason I like tiddlywiki. Adding support for polygons was more work than I expected, but it mostly works now. There is some trouble with animating dragging polygons and there are some refresh problems associated with visually specifying points for the vertices. Even with this library being less flexible than d3 I think it has more potential for tiddlywiki because of how easy it is to use. The current version is here.