better mouseover mapitem mvt stop
This commit is contained in:
parent
ef0d8cedf6
commit
43290d3c5d
@ -1256,15 +1256,18 @@ export default {
|
|||||||
// hightlight superposed entites on focus
|
// hightlight superposed entites on focus
|
||||||
let entites_superposes = this.paper_main_object.children['entites_superposes'];
|
let entites_superposes = this.paper_main_object.children['entites_superposes'];
|
||||||
// console.log('entites_superposes.children', entites_superposes.children);
|
// console.log('entites_superposes.children', entites_superposes.children);
|
||||||
for(let paper_item of entites_superposes.children) {
|
if(entites_superposes){
|
||||||
if (this.is_hover) {
|
for(let paper_item of entites_superposes.children) {
|
||||||
paper_item.definition = this.paper_symbol_definitions.entite_hover;
|
if (this.is_hover) {
|
||||||
paper_item.scale(2)
|
paper_item.definition = this.paper_symbol_definitions.entite_hover;
|
||||||
} else {
|
paper_item.scale(2)
|
||||||
paper_item.definition = this.paper_symbol_definitions.entite;
|
} else {
|
||||||
paper_item.scale(0.5)
|
paper_item.definition = this.paper_symbol_definitions.entite;
|
||||||
|
paper_item.scale(0.5)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
// PAPER EVENTS
|
// PAPER EVENTS
|
||||||
initPaperEvents(){
|
initPaperEvents(){
|
||||||
@ -1625,14 +1628,19 @@ export default {
|
|||||||
) {
|
) {
|
||||||
this.pushAside()
|
this.pushAside()
|
||||||
}
|
}
|
||||||
} else if (this.map_mode === 'proximite'
|
} else if (!this.is_hover){
|
||||||
|| this.map_mode === 'superposition'
|
if (this.map_mode === 'proximite'
|
||||||
|| this.map_mode === 'puissancedagir'
|
|| this.map_mode === 'superposition'
|
||||||
|| this.map_mode === 'action'
|
|| this.map_mode === 'puissancedagir'
|
||||||
|| this.map_mode === 'doleancer'){ // apply focus forces : move unfocused on the sides and focused on the center
|
|| this.map_mode === 'action'
|
||||||
this.applyFocusForces(); //
|
|| this.map_mode === 'doleancer'){ // apply focus forces : move unfocused on the sides and focused on the center
|
||||||
|
this.applyFocusForces(); //
|
||||||
|
} else {
|
||||||
|
this.applyNormalForces(); // if terrain de vie apply force to gently reject items from the sides and so create a continuasly mvmt
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.applyNormalForces(); // if terrain de vie apply force to gently reject items from the sides and so create a continuasly mvmt
|
// stop movement if is mouse hover
|
||||||
|
Matter.Body.setVelocity(this.body, {x:0, y:0})
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset all matter rotation forces otherwise items will spin when colide
|
// reset all matter rotation forces otherwise items will spin when colide
|
||||||
@ -1951,18 +1959,8 @@ export default {
|
|||||||
onAfterEngineUpdate (event) {
|
onAfterEngineUpdate (event) {
|
||||||
this.respawn();
|
this.respawn();
|
||||||
|
|
||||||
// stop item on mouse hover
|
this.paper_main_object.position = this.pos = this.body.position;
|
||||||
// if (this.hover_elmt && this.hover_elmt.id === this.id) {
|
|
||||||
// // Matter.Body.setStatic(this.body, true);
|
|
||||||
// } else {
|
|
||||||
// // Matter.Body.setStatic(this.body, false);
|
|
||||||
// }
|
|
||||||
if (this.is_hover) { // if mouse hover reset the matter body position to prev position
|
|
||||||
Matter.Body.setPosition(this.body, {x:this.pos.x, y:this.pos.y}, true);
|
|
||||||
}else{ // else move following the matter body position
|
|
||||||
this.paper_main_object.position = this.pos = this.body.position;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.handlePaperVisibilityOnAfterEnginUpdate()
|
this.handlePaperVisibilityOnAfterEnginUpdate()
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1191,34 +1191,36 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
onAfterEngineUpdate(){
|
onAfterEngineUpdate(){
|
||||||
|
|
||||||
// // START OF DEBUGGING
|
// // START OF DEBUGGING
|
||||||
// // draw lines of constraints for debuging
|
// this.debugDrawConstraints()
|
||||||
// let constraints_lines = this.paper.project.getItem({name: 'constraints_lines', class: paper.Group});
|
|
||||||
// if (constraints_lines) {
|
|
||||||
// constraints_lines.removeChildren();
|
|
||||||
// }else{
|
|
||||||
// constraints_lines = new paper.Group({
|
|
||||||
// pivot: new paper.Point({x:0,y:0}),
|
|
||||||
// name: 'constraints_lines',
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// let all_constrains = Matter.Composite.allConstraints(this.world);
|
|
||||||
// let children = [];
|
|
||||||
// for(let constraint of all_constrains){
|
|
||||||
// // console.log('constrain', constraint);
|
|
||||||
// let pointAWorld = Matter.Constraint.pointAWorld(constraint);
|
|
||||||
// let pointBWorld = Matter.Constraint.pointBWorld(constraint);
|
|
||||||
// // console.log('pointAWorld, pointBWorld', pointAWorld, pointBWorld);
|
|
||||||
// children.push(new paper.Path.Line({
|
|
||||||
// from: [pointAWorld.x, pointAWorld.y],
|
|
||||||
// to: [pointBWorld.x, pointBWorld.y],
|
|
||||||
// strokeColor: '#f00',
|
|
||||||
// strokeWidth: 1
|
|
||||||
// }));
|
|
||||||
// }
|
|
||||||
// constraints_lines.addChildren(children);
|
|
||||||
// // END OF DEBUGGING
|
// // END OF DEBUGGING
|
||||||
|
},
|
||||||
|
debugDrawConstraints(){
|
||||||
|
// draw lines of constraints for debuging
|
||||||
|
let constraints_lines = this.paper.project.getItem({name: 'constraints_lines', class: paper.Group});
|
||||||
|
if (constraints_lines) {
|
||||||
|
constraints_lines.removeChildren();
|
||||||
|
}else{
|
||||||
|
constraints_lines = new paper.Group({
|
||||||
|
pivot: new paper.Point({x:0,y:0}),
|
||||||
|
name: 'constraints_lines',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let all_constrains = Matter.Composite.allConstraints(this.world);
|
||||||
|
let children = [];
|
||||||
|
for(let constraint of all_constrains){
|
||||||
|
// console.log('constrain', constraint);
|
||||||
|
let pointAWorld = Matter.Constraint.pointAWorld(constraint);
|
||||||
|
let pointBWorld = Matter.Constraint.pointBWorld(constraint);
|
||||||
|
// console.log('pointAWorld, pointBWorld', pointAWorld, pointBWorld);
|
||||||
|
children.push(new paper.Path.Line({
|
||||||
|
from: [pointAWorld.x, pointAWorld.y],
|
||||||
|
to: [pointBWorld.x, pointBWorld.y],
|
||||||
|
strokeColor: '#f00',
|
||||||
|
strokeWidth: 1
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
constraints_lines.addChildren(children);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeUpdate () {
|
beforeUpdate () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user