fix vertical path bug by not handling TB case

This commit is contained in:
Cindy Chang
2024-09-02 13:12:12 +08:00
parent 7b7b722efb
commit 35c7ac355e

View File

@@ -6,7 +6,6 @@ import cola from 'cytoscape-cola';
import tippy from 'tippy.js'; import tippy from 'tippy.js';
import 'tippy.js/dist/tippy.css'; import 'tippy.js/dist/tippy.css';
import MapPathStore from '@/stores/mapPathStore'; import MapPathStore from '@/stores/mapPathStore';
import Gradient from 'javascript-color-gradient'; // 多個色階產生器
import { getTimeLabel } from '@/module/timeLabel.js'; // 時間格式轉換器 import { getTimeLabel } from '@/module/timeLabel.js'; // 時間格式轉換器
import CytoscapeStore from '@/stores/cytoscapeStore'; import CytoscapeStore from '@/stores/cytoscapeStore';
import { SAVE_KEY_NAME } from '@/constants/constants.js'; import { SAVE_KEY_NAME } from '@/constants/constants.js';
@@ -224,11 +223,6 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
], ],
}); });
// 讓節點不要左右重疊的演算法
cy.layout({
name: 'spread',
minDist: 60, // 設置最小節點間距
}).run();
// 按下線條,線條及線條上數字有光暈效果 // 按下線條,線條及線條上數字有光暈效果
cy.on('tap', 'edge', function (event) { cy.on('tap', 'edge', function (event) {
@@ -266,8 +260,12 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
tip.hide(); tip.hide();
}); });
// here we remember and recall positions
const cytoscapeStore = CytoscapeStore(); const cytoscapeStore = CytoscapeStore();
cy.ready(() => { cy.ready(() => {
if (rank === 'TB') {
return; // early return; only handle 'LR' (horizontal) case
}
cytoscapeStore.loadPositionsFromStorage(); cytoscapeStore.loadPositionsFromStorage();
// 判斷localStorage是否儲存過拜訪資訊 // 判斷localStorage是否儲存過拜訪資訊
// 若曾經儲存過拜訪後的座標位置則restore位置來渲染出來 // 若曾經儲存過拜訪後的座標位置則restore位置來渲染出來