123456789101112131415161718192021222324252627282930313233343536373839 |
- import { defineStore } from 'pinia'
- import paper from 'paper';
- export const CommonStore = defineStore({
- id: 'common',
- state: () => ({
- hover_elmt: null,
- map_item_ray: Math.min(window.innerWidth, window.innerHeight) * 0.08,
- original_cartouch_width: 450,
- cartouch_width: 450,
- cartouch_is_opened: false,
- paper_symbol_definitions: {}
- }),
- getters: {
-
- },
- actions: {
- setHoverElmt(elmt) {
- // console.log(`setHoverElmt`, elmt);
- // mode can be : terraindevie, proximite, superposition, puissancedagir, action, doleancer
- this.hover_elmt = elmt;
- },
- setCartoucheWidth (delta) {
- console.log('CommonStore setCartoucheWidth', delta);
- this.cartouch_width = this.original_cartouch_width * delta;
- },
- setCartoucheOpened (v) {
- console.log('setCartoucheOpened', v);
- this.cartouch_is_opened = v;
- },
- 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);
- }
- }
- })
|