svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
11.04k stars 1.08k forks source link

cy and cx not working when width and height of SVG containt unit (e.g: width="10px") #1036

Closed SirLewis closed 4 years ago

SirLewis commented 4 years ago

Tried to move objects by their center. Seemed to work for some, but not for all. Find out obj.width return a string when value contains the unit. Prevent cy and cx to calculate correctly the center position. <svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="none" x="0px" y="0px" width="181px" height="14px" viewBox="0 0 181 14">

Fuzzyma commented 4 years ago

Not all methods work when units are involved.