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,
    cartouch_width: 450,
    paper_symbol_definitions: {}
  }),
  getters: {
    
  },
  actions: {
    setHoverElmt(elmt) {
      // 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);
    }

  }
})