|
@@ -27,7 +27,8 @@ export default {
|
|
concernement: null,
|
|
concernement: null,
|
|
active_revision: null,
|
|
active_revision: null,
|
|
entities: null,
|
|
entities: null,
|
|
- superposedEntitesIDsList: [],
|
|
|
|
|
|
+ superposedEntiteID: null,
|
|
|
|
+ // superposedEntitesIDsList: [],
|
|
canvas: null,
|
|
canvas: null,
|
|
ctx: null,
|
|
ctx: null,
|
|
pos : {
|
|
pos : {
|
|
@@ -60,6 +61,7 @@ export default {
|
|
'concernementsByID',
|
|
'concernementsByID',
|
|
'allEntitesById',
|
|
'allEntitesById',
|
|
'allSuperpositions_bycids',
|
|
'allSuperpositions_bycids',
|
|
|
|
+ 'allSuperpositions_clustered',
|
|
'allMapItems_byid',
|
|
'allMapItems_byid',
|
|
'opened_concernement',
|
|
'opened_concernement',
|
|
'opened_entite_id']),
|
|
'opened_entite_id']),
|
|
@@ -72,6 +74,7 @@ export default {
|
|
created () {
|
|
created () {
|
|
// console.log('ConcernementMapItem created', this.mapitem);
|
|
// console.log('ConcernementMapItem created', this.mapitem);
|
|
// this.id = this.superposition_id ? `${this.cid}___${this.superposition_id}` : this.cid;
|
|
// this.id = this.superposition_id ? `${this.cid}___${this.superposition_id}` : this.cid;
|
|
|
|
+ // console.log(`this.mapitem.id`, this.mapitem.id);
|
|
this.id = this.mapitem.id;
|
|
this.id = this.mapitem.id;
|
|
this.concernement = this.mapitem.concernement;
|
|
this.concernement = this.mapitem.concernement;
|
|
this.cid = this.concernement.id;
|
|
this.cid = this.concernement.id;
|
|
@@ -102,7 +105,7 @@ export default {
|
|
// define init position of the item
|
|
// define init position of the item
|
|
this.pos = this.getRandomPos();
|
|
this.pos = this.getRandomPos();
|
|
//
|
|
//
|
|
- this.getSuperposedEntitesIDsList();
|
|
|
|
|
|
+ this.getSuperposedEntiteID();
|
|
//
|
|
//
|
|
this.initMatterBody()
|
|
this.initMatterBody()
|
|
//
|
|
//
|
|
@@ -383,27 +386,20 @@ export default {
|
|
if (num > 1 || num < 0) return this.getGaussianRandom() // resample between 0 and 1
|
|
if (num > 1 || num < 0) return this.getGaussianRandom() // resample between 0 and 1
|
|
return num
|
|
return num
|
|
},
|
|
},
|
|
- getSuperposedEntitesIDsList(){
|
|
|
|
- if (this.concernement.superpositions) {
|
|
|
|
- // loop through all concernement superpositions couples of this concernement
|
|
|
|
- for(let [couple_id, superpositions] of Object.entries(this.concernement.superpositions)){
|
|
|
|
- // loop through all superpositions of each couple
|
|
|
|
- for(let [superposition_id, superposition] of Object.entries(superpositions)){
|
|
|
|
- if (this.mapitem.superposition_ids.indexOf(superposition_id) >= 0) {
|
|
|
|
- switch (this.cid) { // get the right eid regarding the cid
|
|
|
|
- case superposition[0].cid:
|
|
|
|
- this.superposedEntitesIDsList.push(superposition[0].eid);
|
|
|
|
- break;
|
|
|
|
- case superposition[1].cid:
|
|
|
|
- this.superposedEntitesIDsList.push(superposition[1].eid);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ getSuperposedEntiteID(){
|
|
|
|
+ if (this.concernement.has_superpositions) {
|
|
|
|
+ let ids = this.id.match(/(\d+)___(\d+)/i);
|
|
|
|
+ if (ids) {
|
|
|
|
+ let cluster_index = ids[2];
|
|
|
|
+ // console.log(ids, cluster_index);
|
|
|
|
+ for(let cid_eid of this.allSuperpositions_clustered[cluster_index] ){
|
|
|
|
+ if(this.cid === cid_eid.cid){
|
|
|
|
+ this.superposedEntiteID = cid_eid.eid;
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // console.log('superposedEntitesIDsList', this.superposedEntitesIDsList);
|
|
|
|
-
|
|
|
|
},
|
|
},
|
|
// MATTER BODY
|
|
// MATTER BODY
|
|
initMatterBody (){
|
|
initMatterBody (){
|
|
@@ -509,7 +505,7 @@ export default {
|
|
pivot: new paper.Point(this.pos),
|
|
pivot: new paper.Point(this.pos),
|
|
name: `main_${this.id}`,
|
|
name: `main_${this.id}`,
|
|
cid: this.cid,
|
|
cid: this.cid,
|
|
- superposition_id: this.mapitem.superposition_ids[0]
|
|
|
|
|
|
+ // superposition_id: this.mapitem.superposition_ids[0]
|
|
});
|
|
});
|
|
|
|
|
|
// fadein intro
|
|
// fadein intro
|
|
@@ -765,7 +761,7 @@ export default {
|
|
for (let i = 0; i < this.concernement.revisions_byid[this.concernement.active_revision].entites.length; i++) {
|
|
for (let i = 0; i < this.concernement.revisions_byid[this.concernement.active_revision].entites.length; i++) {
|
|
let entite = this.concernement.revisions_byid[this.concernement.active_revision].entites[i];
|
|
let entite = this.concernement.revisions_byid[this.concernement.active_revision].entites[i];
|
|
if (entite.entite // check if we have an entite object with all the contents
|
|
if (entite.entite // check if we have an entite object with all the contents
|
|
- && this.superposedEntitesIDsList.indexOf(entite.entite.id) >= 0) // check if entite id is in the list builded above
|
|
|
|
|
|
+ && this.superposedEntiteID === entite.entite.id) // check if entite id
|
|
{
|
|
{
|
|
// console.log(`entite ${entite.entite.id}`, entite, entite.entite.superposition);
|
|
// console.log(`entite ${entite.entite.id}`, entite, entite.entite.superposition);
|
|
// use paper symbol
|
|
// use paper symbol
|
|
@@ -779,6 +775,7 @@ export default {
|
|
instance.item_type = 'entite_superpose';
|
|
instance.item_type = 'entite_superpose';
|
|
instance.is_symbol_instance = true;
|
|
instance.is_symbol_instance = true;
|
|
g.addChild(instance)
|
|
g.addChild(instance)
|
|
|
|
+ break; // there is only one superposed entite by mapitem
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return g;
|
|
return g;
|
|
@@ -1513,23 +1510,23 @@ export default {
|
|
if (this.$route.query.superposition_id) {
|
|
if (this.$route.query.superposition_id) {
|
|
let superposition_id = this.$route.query.superposition_id;
|
|
let superposition_id = this.$route.query.superposition_id;
|
|
if(superposition_id){
|
|
if(superposition_id){
|
|
- let ids = superposition_id.match(/(\d+)_(\d+)__(\d+)_(\d+)/i)
|
|
|
|
- group.children.forEach((item) => {
|
|
|
|
- if ( (this.cid === parseInt(ids[1]) && item.item_id === parseInt(ids[2]))
|
|
|
|
- || (this.cid === parseInt(ids[3]) && item.item_id === parseInt(ids[4])) ) {
|
|
|
|
- item.definition = this.paper_symbol_definitions.entite_hover;
|
|
|
|
- if(!item.focused){
|
|
|
|
- item.scale(2)
|
|
|
|
- item.focused = true;
|
|
|
|
- }
|
|
|
|
- } else if(!this.is_hover) {
|
|
|
|
- item.definition = this.paper_symbol_definitions.entite;
|
|
|
|
- if (item.focused) {
|
|
|
|
- item.scale(0.5)
|
|
|
|
- item.focused = false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ // let ids = superposition_id.match(/(\d+)_(\d+)__(\d+)_(\d+)/i)
|
|
|
|
+ // group.children.forEach((item) => {
|
|
|
|
+ // if ( (this.cid === parseInt(ids[1]) && item.item_id === parseInt(ids[2]))
|
|
|
|
+ // || (this.cid === parseInt(ids[3]) && item.item_id === parseInt(ids[4])) ) {
|
|
|
|
+ // item.definition = this.paper_symbol_definitions.entite_hover;
|
|
|
|
+ // if(!item.focused){
|
|
|
|
+ // item.scale(2)
|
|
|
|
+ // item.focused = true;
|
|
|
|
+ // }
|
|
|
|
+ // } else if(!this.is_hover) {
|
|
|
|
+ // item.definition = this.paper_symbol_definitions.entite;
|
|
|
|
+ // if (item.focused) {
|
|
|
|
+ // item.scale(0.5)
|
|
|
|
+ // item.focused = false;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
group.children.forEach((item) => {
|
|
group.children.forEach((item) => {
|
|
@@ -1659,7 +1656,7 @@ export default {
|
|
type: 'superposition',
|
|
type: 'superposition',
|
|
id: this.id,
|
|
id: this.id,
|
|
cid: this.cid,
|
|
cid: this.cid,
|
|
- eids: this.superposedEntitesIDsList
|
|
|
|
|
|
+ eid: this.superposedEntiteID
|
|
});
|
|
});
|
|
} else{
|
|
} else{
|
|
this.setHoverElmt({
|
|
this.setHoverElmt({
|
|
@@ -1678,7 +1675,7 @@ export default {
|
|
type: 'superposition',
|
|
type: 'superposition',
|
|
id: this.id,
|
|
id: this.id,
|
|
cid: this.cid,
|
|
cid: this.cid,
|
|
- eids: this.superposedEntitesIDsList
|
|
|
|
|
|
+ eid: this.superposedEntiteID
|
|
});
|
|
});
|
|
document.body.style.cursor = "pointer";
|
|
document.body.style.cursor = "pointer";
|
|
}
|
|
}
|
|
@@ -1759,13 +1756,16 @@ export default {
|
|
console.log(`Open me ${this.id}`);
|
|
console.log(`Open me ${this.id}`);
|
|
// push route (keep the hash for map_mode)
|
|
// push route (keep the hash for map_mode)
|
|
// wait for routing to be finished before opening the mapItem
|
|
// wait for routing to be finished before opening the mapItem
|
|
|
|
+ let params = {cid: parseInt(this.cid)}
|
|
|
|
+
|
|
let query = {mapitemid: this.id};
|
|
let query = {mapitemid: this.id};
|
|
if (this.map_mode === "superposition") {
|
|
if (this.map_mode === "superposition") {
|
|
- query.superposition_id = this.mapitem.superposition_ids[0];
|
|
|
|
|
|
+ params.eid = this.superposedEntiteID
|
|
|
|
+ query.superposition_cluster_index = this.mapitem.superposition_cluster_index;
|
|
}
|
|
}
|
|
await this.$router.push({
|
|
await this.$router.push({
|
|
name: 'concernement',
|
|
name: 'concernement',
|
|
- params: {cid: parseInt(this.cid)},
|
|
|
|
|
|
+ params: params,
|
|
query: query,
|
|
query: query,
|
|
hash: `#${this.map_mode}`
|
|
hash: `#${this.map_mode}`
|
|
});
|
|
});
|
|
@@ -1773,18 +1773,19 @@ export default {
|
|
this.openCloseConcernements(this.cid, this.id)
|
|
this.openCloseConcernements(this.cid, this.id)
|
|
// reset the mousehover
|
|
// reset the mousehover
|
|
this.resetHoverElmt();
|
|
this.resetHoverElmt();
|
|
- } else if (this.map_mode === 'superposition'){
|
|
|
|
|
|
+ } else if (this.map_mode === 'superposition'){ // si un concernement est ouvert et qu'on est en mode superposition
|
|
// if this mapitem is superposed to the opened mapitem
|
|
// if this mapitem is superposed to the opened mapitem
|
|
if(this.opened_concernement.all_superposed_concernements_id.indexOf(this.cid) >= 0){
|
|
if(this.opened_concernement.all_superposed_concernements_id.indexOf(this.cid) >= 0){
|
|
// push route (keep the hash for map_mode)
|
|
// push route (keep the hash for map_mode)
|
|
// wait for routing to be finished before opening the mapItem
|
|
// wait for routing to be finished before opening the mapItem
|
|
- console.log('click on superposed this.mapitem.superposition_ids', this.mapitem.superposition_ids);
|
|
|
|
|
|
+ console.log('click on superposed this.mapitem.superposition_cluster_index', this.mapitem.superposition_cluster_index);
|
|
await this.$router.push({
|
|
await this.$router.push({
|
|
name: 'concernement',
|
|
name: 'concernement',
|
|
- params: {cid: this.opened_concernement.cid},
|
|
|
|
|
|
+ params: {cid: this.opened_concernement.cid, eid: this.$route.params.eid},
|
|
query: {
|
|
query: {
|
|
mapitemid: this.opened_concernement.opened_mapitem_id,
|
|
mapitemid: this.opened_concernement.opened_mapitem_id,
|
|
- superposition_id: this.mapitem.superposition_ids[0]
|
|
|
|
|
|
+ superposition_cluster_index: this.mapitem.superposition_cluster_index,
|
|
|
|
+ superposed_cid: this.cid
|
|
},
|
|
},
|
|
hash: `#${this.map_mode}`
|
|
hash: `#${this.map_mode}`
|
|
});
|
|
});
|
|
@@ -1825,7 +1826,7 @@ export default {
|
|
params: {cid: this.cid, eid: result.item.item_id},
|
|
params: {cid: this.cid, eid: result.item.item_id},
|
|
query: {
|
|
query: {
|
|
mapitemid: this.id,
|
|
mapitemid: this.id,
|
|
- superposition_id: this.mapitem.superposition_ids[0]
|
|
|
|
|
|
+ // superposition_id: this.mapitem.superposition_ids[0]
|
|
},
|
|
},
|
|
hash: `#${this.map_mode}`,
|
|
hash: `#${this.map_mode}`,
|
|
});
|
|
});
|
|
@@ -2078,23 +2079,14 @@ export default {
|
|
// push all aside mapitems not superposed the the opened mapitem
|
|
// push all aside mapitems not superposed the the opened mapitem
|
|
let pushaside = true;
|
|
let pushaside = true;
|
|
|
|
|
|
- // BUT NOT push aside mapitems superposed to superposed mapitems
|
|
|
|
- // opened_mapitem <-- superposed_mapitems <-- superposed_mapitem
|
|
|
|
|
|
+ // BUT NOT push aside mapitems superposed to this item
|
|
|
|
+ // opened_mapitem <-- superposed_mapitems
|
|
if (this.opened_concernement.superposed_mapitem_id_by_mapitem_id
|
|
if (this.opened_concernement.superposed_mapitem_id_by_mapitem_id
|
|
&& this.opened_concernement.superposed_mapitem_id_by_mapitem_id[this.opened_concernement.opened_mapitem_id])
|
|
&& this.opened_concernement.superposed_mapitem_id_by_mapitem_id[this.opened_concernement.opened_mapitem_id])
|
|
{ // if opened mapitem has superposed mapitems
|
|
{ // if opened mapitem has superposed mapitems
|
|
let superposed_ids = this.opened_concernement.superposed_mapitem_id_by_mapitem_id[this.opened_concernement.opened_mapitem_id]
|
|
let superposed_ids = this.opened_concernement.superposed_mapitem_id_by_mapitem_id[this.opened_concernement.opened_mapitem_id]
|
|
if (superposed_ids.indexOf(this.id) >= 0) { //this mapitem is directly superposed to the opened mapitem
|
|
if (superposed_ids.indexOf(this.id) >= 0) { //this mapitem is directly superposed to the opened mapitem
|
|
pushaside = false;
|
|
pushaside = false;
|
|
- } else { // else we look for second stage of the rockette ... superposed to superposed to opened
|
|
|
|
- superposed_ids.forEach(mapitem_id => { // for each superposed map_item, check if this mapitem is in their superposed
|
|
|
|
- let mapitem = this.allMapItems_byid[mapitem_id]; // get the superposed (stage 1) mapitem
|
|
|
|
- mapitem.superposition_ids.forEach(sup_id => { // for each superposed (stage 2) of the superposed (stage 1)
|
|
|
|
- if (this.mapitem.superposition_ids.indexOf(sup_id) >= 0) {
|
|
|
|
- pushaside = false;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|