refactoring: converting all static commun paper objects (like backgrounds) into symbols for perf optimization

This commit is contained in:
2023-06-28 12:17:06 +02:00
parent b0bfd5cd1f
commit 344b07c93b
3 changed files with 182 additions and 271 deletions

View File

@@ -1,10 +1,13 @@
import { defineStore } from 'pinia'
import paper from 'paper';
export const CommonStore = defineStore({
id: 'common',
state: () => ({
hover_elmt: null,
cartouch_width: 450
cartouch_width: 450,
paper_symbol_definitions: {}
}),
getters: {
@@ -14,6 +17,12 @@ export const CommonStore = defineStore({
// console.log(`setHoverElmt`, elmt);
// mode can be : terraindevie, proximite, superposition, puissancedagir, action, doleancer
this.hover_elmt = elmt;
},
addPaperSymbolDefinition(name, path) {
console.log(`addPaperSymbolDefinition ${name}`, path);
// mode can be : terraindevie, proximite, superposition, puissancedagir, action, doleancer
this.paper_symbol_definitions[name] = new paper.SymbolDefinition(path);
}
}
})