highlighting opened entite on canvas
This commit is contained in:
parent
45e8f31bd8
commit
fb8903a9ce
@ -34,7 +34,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
id: null,
|
id: null,
|
||||||
entities: null,
|
entities: null,
|
||||||
opened_entite_id: null,
|
// opened_entite_id: null,
|
||||||
canvas: null,
|
canvas: null,
|
||||||
ctx: null,
|
ctx: null,
|
||||||
pos : {
|
pos : {
|
||||||
@ -53,7 +53,8 @@ export default {
|
|||||||
},
|
},
|
||||||
props: ['concernement', 'opened'],
|
props: ['concernement', 'opened'],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(ConcernementsStore,['concernementsByID'])
|
...mapState(ConcernementsStore,['concernementsByID']),
|
||||||
|
...mapState(ConcernementsStore,['opened_entite_id'])
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
// console.log(`ConcernementsMapItem ${this.concernement.id} created`, this.canvasMap, this.matterEngine);
|
// console.log(`ConcernementsMapItem ${this.concernement.id} created`, this.canvasMap, this.matterEngine);
|
||||||
@ -61,13 +62,13 @@ export default {
|
|||||||
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);
|
// console.log(`ConcernementsMapItem ${this.concernement.id} $route`, this.id, this.$route);
|
||||||
if (this.$route.name === 'concernement'
|
// if (this.$route.name === 'concernement'
|
||||||
&& parseInt(this.$route.params.id) === this.id
|
// && parseInt(this.$route.params.id) === this.id
|
||||||
&& typeof this.$route.params.eid !== "undefined") {
|
// && typeof this.$route.params.eid !== "undefined") {
|
||||||
console.log("we have an entity");
|
// // console.log("we have an entity");
|
||||||
this.opened_entite_id = parseInt(this.$route.params.eid);
|
// this.opened_entite_id = parseInt(this.$route.params.eid);
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.parsePoints()
|
this.parsePoints()
|
||||||
this.getSalientPoints()
|
this.getSalientPoints()
|
||||||
|
@ -20,6 +20,7 @@ export const ConcernementsStore = defineStore({
|
|||||||
concernementsByID: {},
|
concernementsByID: {},
|
||||||
allEntitesById: {},
|
allEntitesById: {},
|
||||||
opened: false,
|
opened: false,
|
||||||
|
opened_entite_id: null,
|
||||||
ct_concernement: {},
|
ct_concernement: {},
|
||||||
concernements_loaded: false
|
concernements_loaded: false
|
||||||
}),
|
}),
|
||||||
@ -101,6 +102,9 @@ export const ConcernementsStore = defineStore({
|
|||||||
resetConcernementOpened () {
|
resetConcernementOpened () {
|
||||||
this.opened = null;
|
this.opened = null;
|
||||||
this.openCloseConcernements();
|
this.openCloseConcernements();
|
||||||
|
},
|
||||||
|
setOpenedEntityId(id){
|
||||||
|
this.opened_entite_id = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
@ -17,15 +17,17 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(ConcernementsStore,['opened']),
|
...mapState(ConcernementsStore,['opened']),
|
||||||
|
// ...mapState(ConcernementsStore,['opened_entity_id']),
|
||||||
...mapState(ConcernementsStore,['concernements_loaded']),
|
...mapState(ConcernementsStore,['concernements_loaded']),
|
||||||
...mapState(ConcernementsStore,['ct_concernement'])
|
...mapState(ConcernementsStore,['ct_concernement'])
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
console.log(`Concernement view created, id: ${this.id}, eid: ${this.eid}, opened:${this.opened}`);
|
console.log(`Concernement view created, id: ${this.id}, eid: ${this.eid}, opened:${this.opened}`);
|
||||||
|
|
||||||
// when we arrived directly to the entite, load the entite
|
// when we arrived directly to the url, load the entite
|
||||||
|
// this.eid provided by route params
|
||||||
if (!this.entity && this.eid) {
|
if (!this.entity && this.eid) {
|
||||||
this.loadEntite();
|
this.openEntity();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -43,9 +45,10 @@ export default {
|
|||||||
eid: {
|
eid: {
|
||||||
handler (n, o){
|
handler (n, o){
|
||||||
if(n){
|
if(n){
|
||||||
this.loadEntite()
|
this.openEntity()
|
||||||
}else{
|
}else{
|
||||||
this.entite = false;
|
this.entite = false;
|
||||||
|
this.setOpenedEntityId(null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
@ -53,6 +56,11 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(ConcernementsStore,['openCloseConcernements']),
|
...mapActions(ConcernementsStore,['openCloseConcernements']),
|
||||||
|
...mapActions(ConcernementsStore,['setOpenedEntityId']),
|
||||||
|
openEntity(){
|
||||||
|
this.setOpenedEntityId(parseInt(this.eid))
|
||||||
|
this.loadEntite()
|
||||||
|
},
|
||||||
loadEntite(){
|
loadEntite(){
|
||||||
const ast = gql`{
|
const ast = gql`{
|
||||||
entite (id: ${this.eid}) {
|
entite (id: ${this.eid}) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user