javascript - svg transform matrix changes the stroke of an element. How to prevent this? -
i doing modification of svg-edit , have written function user selects element , clicks button fire function asks new dimensions , element gets resized resized dimensions.
however there problem. when dimensions resized stroke width gets resized sometimes. lines appear thinner. there way prevent happening?
this function:
function changedimensions() { svgnode = svgcanvas.getselectedelems()[0]; var transformw=prompt("enter new width"); var transformh=prompt("enter new height"); var lastw = svgnode.getboundingclientrect().width; var lasth = svgnode.getboundingclientrect().height; neww=transformw/lastw; newh=transformh/lasth; alert(newh); alert(neww); svgcanvas.changeselectedattribute("transform", "matrix(" + neww + ", 0, 0, " + newh + ", 0, 0)"); svgcanvas.recalculateallselecteddimensions(); }
opera, webkit , firefox implement svg tiny vector-effects="non-scaling-stroke". it's not supported ie though far know though if need back upwards you'll need in javascript adjusts stroke manually.
javascript html svg jquery-svg
No comments:
Post a Comment