Skip to content

Commit 460e1f6

Browse files
committed
fix: solve horizontal overflowing problem of text in node
1 parent 7fe23b3 commit 460e1f6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/config/cytoscape-style.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ const style = [
1919
borderWidth: 'data(style.borderWidth)',
2020
textValign: 'center',
2121
textHalign: 'center',
22+
fontSize: (ele) => {
23+
const w = ele.data('style').width;
24+
const h = ele.data('style').height;
25+
const val = Math.min(w, h);
26+
if (val < 20) return 10;
27+
if (val > 500) return 60;
28+
return 10 + ((val - 20) * 50) / 480;
29+
},
30+
textWrap: 'wrap',
31+
textMaxWidth: 'data(style.width)',
2232
},
2333
},
2434
{

0 commit comments

Comments
 (0)