dagrejs / dagre

Directed graph layout for JavaScript
MIT License
4.69k stars 602 forks source link

Nodes are 2x bigger with labelType: 'html' #259

Open emlai opened 5 years ago

emlai commented 5 years ago

When I set labelType: 'html' for my nodes, Dagre seems to reserve 2 times as much space for the label rectangle.

I'm using a 4K monitor in case that could affect this.

Without labelType: 'html': lol2

With labelType: 'html': lol3

Here you can see that the width and height of the foreignObject is exactly 2x the width and height of the actual html content:

Inspector screenshots ![screenshot 25](https://user-images.githubusercontent.com/7543552/53696610-7ca29600-3dd1-11e9-87ab-f67471a9398c.png) ![screenshot 26](https://user-images.githubusercontent.com/7543552/53696611-7d3b2c80-3dd1-11e9-85a2-460f7c5dc993.png)
Daijobou commented 4 years ago

I can confirm this on my smartphone for chrome. Firefox working fine. See https://bugs.chromium.org/p/chromium/issues/detail?id=738022&q=foreign-object

desktop: window.devicePixelRatio is 1 mobile: window.devicePixelRatio is 2

mobile is 2 times bigger as in desktop, so text looks very small. I use dagre-d3.min.js v0.4.17. See https://github.com/dagrejs/dagre-d3/issues/336