-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't .center() to percent values #60
Comments
That is not possible indeed. You can only use I have looked into implementing this but it is virtually impossible without adding 2k of code to the library. Because it would involve adding event listeners to the svg canvas so when it is resized the "fake" centered elements are moved accordingly. |
Interesting, I thought a single condition could fix that. That's what I'm doing atm: # TODO: won't have to do this once svg.js is fixed
if @isEllipse
@field.center '50%', '50%'
else
x = 50 - @fieldWidth/2
y = 50 - @fieldHeight/2
@field.move "#{ x }%", "#{ y }%" |
That's the easy part. But that if the svg canvas is resized? Or the nested svg... |
You're right. A generic solution is not an easy one. I am indeed listening to a resize event and updating some sort of an aspect ratio. Closing this as WONTFIX. Might update the README maybe ;) |
I just came up with an idea to fix it without an event listener. I'll look into it this week. |
Out of curiosity, what was this idea? |
Minimal (not) working example: http://jsfiddle.net/mreq/LP7sa/
There's a few more
%
-related issues (am working on a responsive app, where everything is in given relative). I'll try to pinpoint all of them.The text was updated successfully, but these errors were encountered: