WIP: createAllPaths
This commit is contained in:
34
src/stores/mapPathStore.ts
Normal file
34
src/stores/mapPathStore.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import AllMapData from '@/stores/allMapData.js';
|
||||
import { INSIGHTS_FIELDS_AND_LABELS } from '@/constants/constants';
|
||||
import { elements } from 'chart.js';
|
||||
|
||||
export default defineStore('useMapPathStore', {
|
||||
state: () => ({
|
||||
clickedPath: [],
|
||||
allMapData: AllMapData(),
|
||||
cytoscape: null,
|
||||
}),
|
||||
actions: {
|
||||
setCytoscape(cytoscape) {
|
||||
this.cytoscape = cytoscape;
|
||||
},
|
||||
createAllPaths() {
|
||||
const { insights } = this.allMapData;
|
||||
for(let i = 0; i < INSIGHTS_FIELDS_AND_LABELS.length; i++) {
|
||||
const curButton = insights[INSIGHTS_FIELDS_AND_LABELS[i][0]];
|
||||
for(let listIndex = 0; listIndex < curButton.length; listIndex++) {
|
||||
for(let nodeIndex = 0; nodeIndex < curButton[listIndex].length; nodeIndex++){
|
||||
if(nodeIndex === 0) {
|
||||
const startNodes = this.cytoscape.nodes().filter(function(elem) {
|
||||
return elem.data('label').toLocaleLowerCase() === 'start';
|
||||
// highlight between start node and first node
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user