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 based dimensions #49

Closed
miguelmota opened this issue Apr 29, 2015 · 8 comments
Closed

Add support for percentage based dimensions #49

miguelmota opened this issue Apr 29, 2015 · 8 comments

Comments

@miguelmota
Copy link

No description provided.

@benlesh
Copy link
Contributor

benlesh commented Apr 30, 2015

percentage based dimensions for? The nf-graph container itself?

@miguelmota
Copy link
Author

Yeah for the nf-graph component, instead of pixel based width/height

@benlesh
Copy link
Contributor

benlesh commented Apr 30, 2015

So this is tricky.

The pixel values passed to width and height are used to calculate the scale of the graphed elements. In order to get those, I'd need to check to see if what was passed happened to be a string ending with "%", then setup an event to detect when the SVG has resized. ... that's where this gets tricky. The only reliable way I know of to get when the SVG has been resized is to poll repeatedly and check it's computed size. This is because while a document resize event will help, it's not the only way to resize the parents of the SVG of the nf-graph component. If any DOM parent of the SVG element is updated, it will resize the SVG, and we need to know. Unfortunately there isn't a great event for that. MutationObservers may help, but aren't reliable in every browser, and may have performance implications... So I'd want to set them up only when the size was set to a percentage, and tear them down otherwise.

@benlesh
Copy link
Contributor

benlesh commented Apr 30, 2015

I'm not saying we're definitely not going to implement this. In fact, it might even end up being a requirement for the project this was birthed from. I'm really saying that this is a non-trivial change that could end up being buggy or slow on some platforms.

@benlesh
Copy link
Contributor

benlesh commented Apr 30, 2015

I'm adding wontfix to this and closing it, for now.

BUT I will keep this in mind because it's likely to come up on our app here.

@benlesh benlesh closed this as completed Apr 30, 2015
@miguelmota
Copy link
Author

@Blesh I figured that would be case. Basically all the work would have to be invoked after the node is inserted in the DOM. Thanks anyway!

@ming-codes
Copy link
Contributor

This could be the solution: EmberSherpa/ember-element-resize-detector

@benlesh
Copy link
Contributor

benlesh commented Aug 14, 2016

@ming-codes as I recall, we used something like that to handle resizing these components at Netflix

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

No branches or pull requests

3 participants