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

Rendering a Single Element Produces Oversized Canvas #27

Closed
clintonb opened this issue Nov 7, 2011 · 3 comments
Closed

Rendering a Single Element Produces Oversized Canvas #27

clintonb opened this issue Nov 7, 2011 · 3 comments

Comments

@clintonb
Copy link

clintonb commented Nov 7, 2011

I am attempting to render a single element (a div in my case). When I do this I end up with a canvas that is the size of the entire body instead of the single element. It would be ideal if the canvas were the size of the element passed in.

@niklasvh
Copy link
Owner

niklasvh commented Nov 7, 2011

It unfortunately isn't that simple. Just because an element is of a certain size, doesn't mean that the contents of that element reside inside of that space. Very simple examples are shadows or positioned elements, example:

http://jsfiddle.net/E7FGU/

@clintonb
Copy link
Author

clintonb commented Nov 7, 2011

In my case it is simple since I have no shadows or positioned elements. Can you provide the option to render just the passed in element?

@niklasvh
Copy link
Owner

niklasvh commented Nov 7, 2011

There is currently no option to automatically clip it. You could just fetch the position of the element (x and y) and check its width and height and clip the canvas using that. (I included jQuery methods already in that fiddle)

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

No branches or pull requests

2 participants