From 0950214f19997319be331b9efa16c09ab4a44522 Mon Sep 17 00:00:00 2001 From: Cindy Chang Date: Mon, 19 Aug 2024 11:53:14 +0800 Subject: [PATCH] separate cases for text-margin-x --- src/module/cytoscapeMap.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/module/cytoscapeMap.js b/src/module/cytoscapeMap.js index 49cace9..882dcee 100644 --- a/src/module/cytoscapeMap.js +++ b/src/module/cytoscapeMap.js @@ -164,7 +164,9 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu 'text-wrap': 'wrap', 'text-max-width': 'data(width)', // 在 div 內換行 'text-overflow-wrap': 'anywhere', // 在 div 內換行 - 'text-margin-x': '-10px', + 'text-margin-x': function(node) { + return node.data('type') === 'activity' ? -10 : 0; + }, 'text-halign': 'center', 'text-valign': 'center', 'height': 'data(height)',