Paper.js: wrong position with svg imported embedded Raster with transform="matrix()"

Created on 17 May 2017  路  7Comments  路  Source: paperjs/paper.js

i found a bug that has to do with if an svg element has an transform="matrix(0.21 0 0 0.21 43.54 43.531)" in it.

example at sketch.paperjs.org

if i import this file shadowtest_transformmatrix.svg
i get
image

but i would expect
image

this transform arrangement can happen with illustrator exports (there i originally found it)
if i open such a file in inkscape and move the 'shadow image' one step left and one step back inkscape converts the transform matrix into x and y values. if i save this and try with it all is fine again.

i have not tested if this happens with not-Raster items too.

Most helpful comment

@sapics great idea about the prebuilt sketch! We should maybe have a pulldown on sketch itself where versions can be selected, prebuilt being one of them.

All 7 comments

This has been reported in the past and it looks like its from the transformation on the embedded image is applied twice or is done incorrectly if a transformation is applied in the onLoad function. @lilltiger found a fix for it by wrapping the content in the onLoad in a timeout.

See: #1192

+1 would like to see this fixed

This is fixed in #1452. You can check it in prebuilt version of sketch.

@sapics great idea about the prebuilt sketch! We should maybe have a pulldown on sketch itself where versions can be selected, prebuilt being one of them.

I totally agree with you! It is the one!

thanks for fixing this :+1:

@lehni I would like to create a code for We should maybe have a pulldown on sketch itself where versions can be selected, prebuilt being one of them. Is it OK?

I create a PR in paperjs/sketch.paperjs.org#4 to execute paparscript in multi-version of paperjs .
You can preview the result in https://raw.githack.com/sapics/sketch.paperjs.org/feature/multi-version2/index.html.

Was this page helpful?
0 / 5 - 0 ratings