|  | @@ -32,8 +32,9 @@ export default {
 | 
											
												
													
														|  |    inject: ['canvasMap', 'matterEngine'],
 |  |    inject: ['canvasMap', 'matterEngine'],
 | 
											
												
													
														|  |    data() {
 |  |    data() {
 | 
											
												
													
														|  |      return {
 |  |      return {
 | 
											
												
													
														|  | 
 |  | +      id: null,
 | 
											
												
													
														|  |        entities: null,
 |  |        entities: null,
 | 
											
												
													
														|  | -      // concernement: null,
 |  | 
 | 
											
												
													
														|  | 
 |  | +      opened_entite_id: null,
 | 
											
												
													
														|  |        canvas: null,
 |  |        canvas: null,
 | 
											
												
													
														|  |        ctx: null,
 |  |        ctx: null,
 | 
											
												
													
														|  |        pos : {
 |  |        pos : {
 | 
											
										
											
												
													
														|  | @@ -45,9 +46,7 @@ export default {
 | 
											
												
													
														|  |        salientPoints: [],
 |  |        salientPoints: [],
 | 
											
												
													
														|  |        scale: 1,
 |  |        scale: 1,
 | 
											
												
													
														|  |        opacity: 0,
 |  |        opacity: 0,
 | 
											
												
													
														|  | -      // anim: null,
 |  | 
 | 
											
												
													
														|  |        tween: null,
 |  |        tween: null,
 | 
											
												
													
														|  | -      // matter
 |  | 
 | 
											
												
													
														|  |        body: null,
 |  |        body: null,
 | 
											
												
													
														|  |        constraint: null
 |  |        constraint: null
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
										
											
												
													
														|  | @@ -57,18 +56,30 @@ export default {
 | 
											
												
													
														|  |      ...mapState(ConcernementsStore,['concernementsByID'])
 |  |      ...mapState(ConcernementsStore,['concernementsByID'])
 | 
											
												
													
														|  |    },
 |  |    },
 | 
											
												
													
														|  |    created () {
 |  |    created () {
 | 
											
												
													
														|  | -    // console.log("ConcernementsMapItem concernement", this.canvasMap, this.matterEngine);
 |  | 
 | 
											
												
													
														|  | 
 |  | +    // console.log(`ConcernementsMapItem ${this.concernement.id} created`, this.canvasMap, this.matterEngine);
 | 
											
												
													
														|  | 
 |  | +    this.id = this.concernement.id
 | 
											
												
													
														|  |      this.entites = this.concernement.entites
 |  |      this.entites = this.concernement.entites
 | 
											
												
													
														|  |      this.entites_byid = this.concernement.entites_byid
 |  |      this.entites_byid = this.concernement.entites_byid
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    console.log(`ConcernementsMapItem ${this.concernement.id} $route`, this.id, this.$route);
 | 
											
												
													
														|  | 
 |  | +    if (this.$route.name === 'concernement'
 | 
											
												
													
														|  | 
 |  | +      && parseInt(this.$route.params.id) === this.id
 | 
											
												
													
														|  | 
 |  | +      && typeof this.$route.params.eid !== "undefined") {
 | 
											
												
													
														|  | 
 |  | +        console.log("we have an entity");
 | 
											
												
													
														|  | 
 |  | +        this.opened_entite_id = parseInt(this.$route.params.eid);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  |      this.parsePoints()
 |  |      this.parsePoints()
 | 
											
												
													
														|  |      this.getSalientPoints()
 |  |      this.getSalientPoints()
 | 
											
												
													
														|  | -  },
 |  | 
 | 
											
												
													
														|  | -  mounted() {
 |  | 
 | 
											
												
													
														|  | -    console.log('concernementItem mounted', typeof this.canvasMap.canvas);
 |  | 
 | 
											
												
													
														|  |      if (this.canvasMap) {
 |  |      if (this.canvasMap) {
 | 
											
												
													
														|  |        this.initCanvasMap()
 |  |        this.initCanvasMap()
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |    },
 |  |    },
 | 
											
												
													
														|  | 
 |  | +  // mounted() {
 | 
											
												
													
														|  | 
 |  | +  //   console.log(`ConcernementsMapItem ${this.concernement.id} mounted`, this.canvasMap.canvas);
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +  // },
 | 
											
												
													
														|  |    watch: {
 |  |    watch: {
 | 
											
												
													
														|  |      // canvasMap (n, o) {
 |  |      // canvasMap (n, o) {
 | 
											
												
													
														|  |      //   console.log("concernementItem watch canvasMap", o, n);
 |  |      //   console.log("concernementItem watch canvasMap", o, n);
 | 
											
										
											
												
													
														|  | @@ -84,6 +95,7 @@ export default {
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  |      opened: {
 |  |      opened: {
 | 
											
												
													
														|  |        handler (n, o) {
 |  |        handler (n, o) {
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          if(n){ // opened
 |  |          if(n){ // opened
 | 
											
												
													
														|  |            this.openClose(true);
 |  |            this.openClose(true);
 | 
											
												
													
														|  |          }else{ // closed
 |  |          }else{ // closed
 | 
											
										
											
												
													
														|  | @@ -95,7 +107,7 @@ export default {
 | 
											
												
													
														|  |    },
 |  |    },
 | 
											
												
													
														|  |    methods: {
 |  |    methods: {
 | 
											
												
													
														|  |      initCanvasMap (){
 |  |      initCanvasMap (){
 | 
											
												
													
														|  | -      // console.log('initCanvasMap');
 |  | 
 | 
											
												
													
														|  | 
 |  | +      // console.log(`ConcernementsMapItem ${this.concernement.id} initCanvasMap`);
 | 
											
												
													
														|  |        // record canvas and ctx for rendering (drawing)
 |  |        // record canvas and ctx for rendering (drawing)
 | 
											
												
													
														|  |        this.canvas = this.canvasMap.canvas
 |  |        this.canvas = this.canvasMap.canvas
 | 
											
												
													
														|  |        this.ctx = this.canvasMap.ctx
 |  |        this.ctx = this.canvasMap.ctx
 | 
											
										
											
												
													
														|  | @@ -258,6 +270,7 @@ export default {
 | 
											
												
													
														|  |      //   }
 |  |      //   }
 | 
											
												
													
														|  |      // },
 |  |      // },
 | 
											
												
													
														|  |      openClose(open) {
 |  |      openClose(open) {
 | 
											
												
													
														|  | 
 |  | +      // console.log(`ConcernementsMapItem ${this.concernement.id} openClose: ${open}`);
 | 
											
												
													
														|  |        if (this.tween) {
 |  |        if (this.tween) {
 | 
											
												
													
														|  |          this.tween.stop();
 |  |          this.tween.stop();
 | 
											
												
													
														|  |        }
 |  |        }
 | 
											
										
											
												
													
														|  | @@ -427,8 +440,13 @@ export default {
 | 
											
												
													
														|  |            if (this.body.parts[i].item_type === 'entite') {
 |  |            if (this.body.parts[i].item_type === 'entite') {
 | 
											
												
													
														|  |              let part = this.body.parts[i];
 |  |              let part = this.body.parts[i];
 | 
											
												
													
														|  |              this.ctx.beginPath();
 |  |              this.ctx.beginPath();
 | 
											
												
													
														|  | -            this.ctx.arc(this.body.parts[i].position.x, this.body.parts[i].position.y, 0.3*this.scale, 0, 2 * Math.PI, false);
 |  | 
 | 
											
												
													
														|  | -            this.ctx.fillStyle = "#000";
 |  | 
 | 
											
												
													
														|  | 
 |  | +            this.ctx.arc(part.position.x, part.position.y, 0.3*this.scale, 0, 2 * Math.PI, false);
 | 
											
												
													
														|  | 
 |  | +            // console.log(part.id, this.opened_entite_id);
 | 
											
												
													
														|  | 
 |  | +            if (part.id === this.opened_entite_id) {
 | 
											
												
													
														|  | 
 |  | +              this.ctx.fillStyle = "#F00";
 | 
											
												
													
														|  | 
 |  | +            } else {
 | 
											
												
													
														|  | 
 |  | +              this.ctx.fillStyle = "#000";
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |              this.ctx.fill();
 |  |              this.ctx.fill();
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  |          }
 |  |          }
 |