danzen / zimjs

ZIM JavaScript Canvas Framework - Code Creativity! Interactive Media For All.
Other
507 stars 47 forks source link

bug report: SVGContainer("xxx.svg") parse error, but bitmap ("xxx.svg") works. #42

Closed dnvs closed 4 years ago

dnvs commented 4 years ago

Uncaught TypeError: Cannot read property 'trim' of undefined at zim.js:1596 at go.loop (zim.js:10731) at C (zim.js:1593) at L (zim.js:1712) at k (zim.js:1730) at zim.js:1696 at Object.go.loop (zim.js:10732) at c (zim.js:1694) at zim.js:1704 at Object.go.loop (zim.js:10732)

here is my svg file:

`<?xml version="1.0" encoding="UTF-8"?>

`

dnvs commented 4 years ago

btw, another question about bitmap color, is there easy way to modify a tint color of bitmap shape? or is there a way to modify fillcolor of loaded svg file?

danzen commented 4 years ago

Hi @dnvs yes for the tint of a bitmap can be adjusted with createjs filter. https://www.createjs.com/docs/easeljs/classes/ColorFilter.html You need to cache() the bimap after - even though it is a bitmap. So that would be what to use as I think you would have modify the svg before sending it to a bitmap to change the fill of the "svg". If you get the SVG to Blob working then you can change color of the blob dynamically with color or borderColor properties.

For the SVG issue... SVGContainer and with SVG passed into Blob() and Squiggle() as points, it does not accept style parameters. We just added a test to pull them out rather than give an error. You could try that at https://zimjs.org/cdn/10.9.1/zim_doc.js or just remove the three or four style parameters in the SVG. I suspect that other things in there my not translate... not sure - like the overflow and symbols. We have a fellow called KV who requested SVG in the first place and has helped debug. You could come in to https://zimjs.com/slack and maybe we could look into more things there. There is also https://zimjs.com/nio/paths.html where you can make your own Blob and Squiggle points without SVG.

danzen commented 4 years ago

Cute! They are little houses...