svgedit icon indicating copy to clipboard operation
svgedit copied to clipboard

svgedit.math.hasMatrixTransform possible error

Open soulmare opened this issue 7 years ago • 0 comments

I use parts of SVG-Edit code in my own application, so I don't know if this issue makes some effect on original SVG-Edit app. svgedit.utilities.getBBoxWithTransform() returns correct bbox coordinates in case of transform like "matrix(1,0,0,1,0,100)" but not for the same "translate(0,100)". Resulting bbox coordinates are wrong in second case - transformation is not taken in account. It seems that the reason is because svgedit.math.hasMatrixTransform must return true not only in case of "matrix" type transform, but also with "translate" transforms, and maybe in other similar cases. I've resolved my problem with such a fix in svgedit.math.hasMatrixTransform(): replaced line: if (xform.type == 1 && !svgedit.math.isIdentity(xform.matrix)) {return true;} with: if (((xform.type == 1) || (xform.type == 2)) && !svgedit.math.isIdentity(xform.matrix)) {return true;} And now it svgedit.utilities.getBBoxWithTransform works ok for me with "translate" transformations. Hope if this fix is applicable also for SVG-Edit.

soulmare avatar Oct 23 '17 11:10 soulmare