better mouseover mapitem mvt stop
This commit is contained in:
@@ -1256,15 +1256,18 @@ export default {
|
||||
// hightlight superposed entites on focus
|
||||
let entites_superposes = this.paper_main_object.children['entites_superposes'];
|
||||
// console.log('entites_superposes.children', entites_superposes.children);
|
||||
for(let paper_item of entites_superposes.children) {
|
||||
if (this.is_hover) {
|
||||
paper_item.definition = this.paper_symbol_definitions.entite_hover;
|
||||
paper_item.scale(2)
|
||||
} else {
|
||||
paper_item.definition = this.paper_symbol_definitions.entite;
|
||||
paper_item.scale(0.5)
|
||||
if(entites_superposes){
|
||||
for(let paper_item of entites_superposes.children) {
|
||||
if (this.is_hover) {
|
||||
paper_item.definition = this.paper_symbol_definitions.entite_hover;
|
||||
paper_item.scale(2)
|
||||
} else {
|
||||
paper_item.definition = this.paper_symbol_definitions.entite;
|
||||
paper_item.scale(0.5)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
// PAPER EVENTS
|
||||
initPaperEvents(){
|
||||
@@ -1625,14 +1628,19 @@ export default {
|
||||
) {
|
||||
this.pushAside()
|
||||
}
|
||||
} 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(); //
|
||||
} else if (!this.is_hover){
|
||||
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(); //
|
||||
} else {
|
||||
this.applyNormalForces(); // if terrain de vie apply force to gently reject items from the sides and so create a continuasly mvmt
|
||||
}
|
||||
} 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
|
||||
@@ -1951,18 +1959,8 @@ export default {
|
||||
onAfterEngineUpdate (event) {
|
||||
this.respawn();
|
||||
|
||||
// stop item on mouse hover
|
||||
// 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.paper_main_object.position = this.pos = this.body.position;
|
||||
|
||||
this.handlePaperVisibilityOnAfterEnginUpdate()
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user