Conversation
|
|
||
| function toggleSize() { | ||
| $scope.showSize = !$scope.showSize; | ||
| refreshGraph(); |
There was a problem hiding this comment.
@anvaka I have no idea how to use Angular and it seems like there is some wrapper (an) around Angular that makes this even more mysterious.
How can I make this toggleSize() function refresh/re-render the graph?
There was a problem hiding this comment.
I don't remember most of it as well :). I think you could use approach similar to node highlighting. Check the graphViewer.js and graphUI.js files.
There was a problem hiding this comment.
Now that I think about it, I think I want to make this part of the url, because I would like to link directly to this page from https://packagephobia.com
Actually, I already have a link but I would like the link to enable this feature which is why I need it in the URL.
Thoughts?
| 'root': '=', | ||
| 'mode': '=' | ||
| 'mode': '=', | ||
| 'showSize': '=' |
There was a problem hiding this comment.
I thought that showSize was going to show up from the parent $scope but this didn't work. Any ideas?
|
|
||
| function getNodeRadius(node) { | ||
| var radius = defaultRadius; | ||
| if (showSize && node.data && node.data.dist && node.data.dist.unpackedSize) { |
There was a problem hiding this comment.
Just curious - where does unpackedSize come from? I tried to explore a random package from the registry.npmjs.cf and I don't see it there
There was a problem hiding this comment.
@anvaka I think this was introduced in the last 4 months or so, so only packages published since then will have this information populated. I asked the npm team if there are plans to backfill.
I originally planned to make a HTTP request to my tool, Package Phobia, which will work for any arbitrary package, but I realized that I would need to submit a PR to the other repo (which would take more time and I'm lazy 😄)
I fallback to the 5px radius if the size was not found (this was the previous size used) .
|
Well done @styfle, this would change my life. |
This project is actively maintained so more likely to get a size feature to land. ### Related - anvaka/npmgraph.an#27 - npmgraph/npmgraph#132
Fixes #25
Size disabled (default)
Size enabled