Skip to content
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

add support for percentage width and height styles #828

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zackbrown
Copy link

Problem: elements styled with percentage widths or heights (e.g. width: 100%) throw an error on the line cs.clip = "rect(0 " + width + " " + height + " 0)";

Proposed solution: apply to the canvas whatever width/height are provided, then if width/height are percentage strings, read the computed (pixel) width/height using offsetWidth and offsetHeight, passing those values to the cs.clip property.

Not extensively tested, but fixed the bugs I was coming up against. Hopefully someone with more knowledge of this project can review and see if this is a suitable fix.

@zackbrown
Copy link
Author

(I should specify, this was for IE8--I came up against issue this working with r2d3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant