superposition: mapitem openeing and entite clickable
This commit is contained in:
parent
43290d3c5d
commit
36b76a9ba6
@ -544,6 +544,9 @@ export default {
|
||||
this.addNewPaperSymbolInstance('boussole_bg', true);
|
||||
this.paper_main_object.addChild(this.setPaperEntites());
|
||||
break;
|
||||
case 'superposition':
|
||||
this.addNewPaperSymbolInstance('boussole_bg', true);
|
||||
break;
|
||||
case 'puissancedagir':
|
||||
this.addNewPaperSymbolInstance('puissanceagir_bg', true);
|
||||
this.paper_main_object.addChild(this.setPaperPuissanceagirBesoins());
|
||||
@ -1129,13 +1132,30 @@ export default {
|
||||
this.paper_main_object.children.agissantes_icons.visible = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
handlePaperVisibilityOnOpened(){
|
||||
|
||||
|
||||
// superposition
|
||||
// scale down superposed entites on open
|
||||
let entites_superposes = this.paper_main_object.children['entites_superposes'];
|
||||
// console.log('entites_superposes.children', entites_superposes.children);
|
||||
if(entites_superposes){
|
||||
for(let paper_item of entites_superposes.children) {
|
||||
// paper_item.definition = this.paper_symbol_definitions.entite_hover;
|
||||
paper_item.scale(0.25)
|
||||
}
|
||||
}
|
||||
},
|
||||
handlePaperVisibilityOnOpened(){},
|
||||
handlePaperVisibilityOnBeforeClose(){
|
||||
|
||||
// superposition
|
||||
// scale up superposed entites on open
|
||||
let entites_superposes = this.paper_main_object.children['entites_superposes'];
|
||||
// console.log('entites_superposes.children', entites_superposes.children);
|
||||
if(entites_superposes){
|
||||
for(let paper_item of entites_superposes.children) {
|
||||
// paper_item.definition = this.paper_symbol_definitions.entite_hover;
|
||||
paper_item.scale(4)
|
||||
}
|
||||
}
|
||||
},
|
||||
handlePaperVisibilityOnClosed(){
|
||||
// agissantes
|
||||
@ -1147,9 +1167,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
handlePaperVisibilityOnMapMode(){
|
||||
|
||||
},
|
||||
handlePaperVisibilityOnMapMode(){},
|
||||
handlePaperVisibilityOnAfterEnginUpdate(){
|
||||
// contours focused
|
||||
if (!this.isFocused()){
|
||||
@ -1283,9 +1301,7 @@ export default {
|
||||
// console.log(`onmousemove ${this.id}`);
|
||||
|
||||
// prevent hover map item mouse event if cartouch is opened
|
||||
if (this.cartouch_is_open) {
|
||||
return;
|
||||
}
|
||||
if (this.cartouch_is_open) return;
|
||||
|
||||
if (!this.is_open) {
|
||||
if (!this.opened_concernement && this.isFocused()) { // only if no concernement is opened and is this focused
|
||||
@ -1316,6 +1332,9 @@ export default {
|
||||
case "terraindevie":
|
||||
paper_group_tohit = this.paper_main_object.children['entites'];
|
||||
break;
|
||||
case "superposition":
|
||||
paper_group_tohit = this.paper_main_object.children['entites_superposes'];
|
||||
break;
|
||||
case "action":
|
||||
paper_group_tohit = this.paper_main_object.children['agissantes'];
|
||||
break;
|
||||
@ -1368,6 +1387,7 @@ export default {
|
||||
if (this.cartouch_is_open) return;
|
||||
|
||||
if (!this.is_open) { // si ce concernement n'est pas ouvet
|
||||
console.log('mapitem is NOT opened');
|
||||
if (!this.opened_concernement) { // si aucun concernement n'est ouvert
|
||||
console.log(`Open me ${this.id}`);
|
||||
// open/close all concernements
|
||||
@ -1382,12 +1402,16 @@ export default {
|
||||
this.resetHoverElmt();
|
||||
}
|
||||
} else { // si ce concernement est ouvert
|
||||
console.log('mapitem is opened');
|
||||
// lets define some options regarding the map_mode
|
||||
let group_to_hit = null;
|
||||
switch (this.map_mode) {
|
||||
case "terraindevie":
|
||||
group_to_hit = this.paper_main_object.children['entites'];
|
||||
break;
|
||||
case "superposition":
|
||||
group_to_hit = this.paper_main_object.children['entites_superposes'];
|
||||
break;
|
||||
case "action":
|
||||
group_to_hit = this.paper_main_object.children['agissantes'];
|
||||
break;
|
||||
@ -1401,6 +1425,7 @@ export default {
|
||||
if (result) {
|
||||
switch (this.map_mode) {
|
||||
case "terraindevie":
|
||||
case "superposition":
|
||||
case "action":
|
||||
// we have clicked on an entite
|
||||
this.$router.push({
|
||||
@ -1443,8 +1468,6 @@ export default {
|
||||
}
|
||||
if (open) {
|
||||
this.is_opening = true;
|
||||
// paper bring to front
|
||||
this.paper_main_object.bringToFront();
|
||||
// create the paper objects to display (like entite, besoin, etc)
|
||||
this.setPaperContents();
|
||||
this.handlePaperVisibilityOnBeforeOpen();
|
||||
@ -1454,8 +1477,7 @@ export default {
|
||||
// let s = this.canvas.height / (this.ray*2.8)
|
||||
let s = Math.min(this.canvas.height, this.canvas.width - this.cartouch_width) / (this.ray*2.8)
|
||||
|
||||
|
||||
// opening tweening
|
||||
// create once the opening tweening
|
||||
this.tween = new Tween.Tween({s: this.scale, x: this.pos.x, y: this.pos.y, o: 0})
|
||||
.to({
|
||||
s: s,
|
||||
@ -1472,7 +1494,7 @@ export default {
|
||||
Matter.Body.scale(this.body, obj.s, obj.s)
|
||||
this.paper_main_object.scale(obj.s);
|
||||
|
||||
// update superposition constraints points
|
||||
// update superposition constraints points poisitions
|
||||
if (this.concernement.superposition_constraints_id
|
||||
&& this.concernement.superposition_constraints_id[this.id]
|
||||
&& this.concernement.superposition_constraints_id[this.id].length)
|
||||
@ -1531,7 +1553,8 @@ export default {
|
||||
});
|
||||
Matter.Composite.add(this.matterEngine.world, [this.body, this.constraint]);
|
||||
|
||||
|
||||
// paper bring to front
|
||||
this.paper_main_object.bringToFront();
|
||||
|
||||
this.is_opening = false;
|
||||
});
|
||||
@ -1552,6 +1575,7 @@ export default {
|
||||
|
||||
// this.setOpenedRecit(null);
|
||||
|
||||
// create once the closing tween
|
||||
this.tween = new Tween.Tween({s: this.scale, o: 1})
|
||||
.to({s: 1, o: 0}, 500)
|
||||
.onUpdate((obj) => {
|
||||
@ -1563,7 +1587,7 @@ export default {
|
||||
Matter.Body.scale(this.body, obj.s, obj.s)
|
||||
this.paper_main_object.scale(obj.s);
|
||||
|
||||
// update superposition constraints points
|
||||
// update superposition constraints points positions
|
||||
if (this.concernement.superposition_constraints_id
|
||||
&& this.concernement.superposition_constraints_id[this.id]
|
||||
&& this.concernement.superposition_constraints_id[this.id].length)
|
||||
@ -1623,7 +1647,8 @@ export default {
|
||||
// this.opened_concernement.id !== this.cid &&
|
||||
this.opened_concernement.opened_mapitem_id !== this.id
|
||||
// && (!this.opened_concernement.all_superposed_concernements_id || this.opened_concernement.all_superposed_concernements_id.indexOf(this.id) < 0)
|
||||
&& (!this.opened_concernement.superposed_mapitem_id_by_mapitem_id[this.opened_concernement.opened_mapitem_id] // when we are not in superposition mode
|
||||
&& (!this.opened_concernement.superposed_mapitem_id_by_mapitem_id
|
||||
|| !this.opened_concernement.superposed_mapitem_id_by_mapitem_id[this.opened_concernement.opened_mapitem_id] // when we are not in superposition mode
|
||||
|| this.opened_concernement.superposed_mapitem_id_by_mapitem_id[this.opened_concernement.opened_mapitem_id].indexOf(this.id) < 0) // this mapitem is not superposed to the opened mapitem
|
||||
) {
|
||||
this.pushAside()
|
||||
@ -1952,7 +1977,8 @@ export default {
|
||||
|| this.pos.y >= this.canvas.height){
|
||||
this.pos = this.getRandomPos()
|
||||
Matter.Body.setPosition(this.body, {x:this.pos.x, y:this.pos.y});
|
||||
this.setInitBodyVelocity();
|
||||
// this.setInitBodyVelocity();
|
||||
Matter.Body.setVelocity(this.body, {x:0,y:0});
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -56,6 +56,7 @@ export default {
|
||||
this.concernement = this.concernementsByID[this.infos.cid];
|
||||
break;
|
||||
case 'entite':
|
||||
case 'entite_superpose':
|
||||
case 'entite_action':
|
||||
this.entites = [this.allEntitesById[this.infos.id]];
|
||||
break;
|
||||
@ -148,7 +149,7 @@ export default {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="infos.type === 'entite' || infos.type === 'entite_action' || infos.type === 'superposition'" class="entite-map-popup">
|
||||
<section v-if="infos.type === 'entite' || infos.type === 'entite_action' || infos.type === 'superposition' || infos.type === 'entite_superpose'" class="entite-map-popup">
|
||||
<template
|
||||
v-for="(entite, index) of entites"
|
||||
:key="index"
|
||||
|
@ -108,7 +108,7 @@ export default {
|
||||
|
||||
// use the paper.view click to get back if no items is clicked
|
||||
this.paper.view.onClick = function(event) {
|
||||
console.log("view onClick", this, event.target);
|
||||
// console.log("view onClick", this, event.target);
|
||||
if(event.target._id === "paper-view-0") {
|
||||
this.resetConcernementOpened();
|
||||
this.$router.push({
|
||||
|
@ -16,7 +16,7 @@ export const CommonStore = defineStore({
|
||||
},
|
||||
actions: {
|
||||
setHoverElmt(elmt) {
|
||||
// console.log(`setHoverElmt`, elmt);
|
||||
console.log(`setHoverElmt`, elmt);
|
||||
// mode can be : terraindevie, proximite, superposition, puissancedagir, action, doleancer
|
||||
this.hover_elmt = elmt;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user