started to code superpositions

This commit is contained in:
2023-08-31 15:34:02 +02:00
parent e080c4ac5e
commit 764ec8ad18
3 changed files with 102 additions and 1 deletions

View File

@@ -463,6 +463,10 @@ export default {
// the sub items for one concernement
this.paper_main_object.addChild(this.setPaperContour());
if (this.concernement.has_superpositions) {
this.paper_main_object.addChild(this.setPaperSuperpositions());
}
if (this.concernement.has_puissancedagir) {
this.addNewPaperSymbolInstance('puissanceagir_icon', false, 0.7);
}
@@ -635,6 +639,31 @@ export default {
}
return g;
},
setPaperSuperpositions(){
console.log('setPaperSuperpositions');
let g = new paper.Group({
pivot: new paper.Point(this.pos),
name: 'entites_superposes'
});
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];
if (entite.entite && entite.entite.superposition.length) {
// console.log(`entite ${entite.entite.id}`, entite, entite.entite.superposition);
// use paper symbol
let instance = new paper.SymbolItem(this.paper_symbol_definitions['entite']);
instance.name = 'entite';
instance.position = new paper.Point([this.pos.x + entite.display.pos.x * this.scale, this.pos.y + entite.display.pos.y * this.scale]);
// instance.scale(this.scale);
instance.scale(3);
instance.fillColor = '#000';
instance.item_id = entite.entite.id;
instance.item_type = 'entite_superpose';
instance.is_symbol_instance = true;
g.addChild(instance)
}
}
return g;
},
setPaperAgissantes(){
console.log('setPaperAgissantes');
let g = new paper.Group({
@@ -1086,6 +1115,20 @@ export default {
this.paper_main_object.children['contours'].visible = false;
}
// proximite
// superposition
if (this.concernement.has_superpositions) {
if (this.map_mode === "superposition") {
if (!this.is_opened) {
this.paper_main_object.children.entites_superposes.visible = true; // if not opened and has_superpositions draw the entites_superposes points
} else {
this.paper_main_object.children.entites_superposes.visible = false;
}
} else {
this.paper_main_object.children.entites_superposes.visible = false;
}
}
// puissance d'agir
if (this.concernement.has_puissancedagir) {
@@ -1436,7 +1479,9 @@ export default {
if (this.opened_concernement.id !== this.id) {
this.pushAside()
}
} else if (this.map_mode === 'puissancedagir'
} else if (this.map_mode === 'proximite'
|| this.map_mode === 'superposition'
|| this.map_mode === 'puissancedagir'
|| this.map_mode === 'action'
|| this.map_mode === 'doleancer'){ // apply focus forces : move unfocused on the sides and focused on the center
this.applyFocusForces(); //
@@ -1457,6 +1502,8 @@ export default {
},
isFocused(){
return this.map_mode === 'terraindevie'
|| (this.map_mode === 'proximite' && this.concernement.has_proximites)
|| (this.map_mode === 'superposition' && this.concernement.has_superpositions)
|| (this.map_mode === 'action' && this.concernement.has_agissantes)
|| (this.map_mode === 'puissancedagir' && this.concernement.has_puissancedagir)
|| (this.map_mode === 'doleancer' && this.concernement.has_doleance);