fixed bodies scaling
This commit is contained in:
parent
2d7f7e5499
commit
4727333dd6
@ -201,6 +201,10 @@ export default {
|
|||||||
this.scale = this.concernement.opened ? 5 : 1;
|
this.scale = this.concernement.opened ? 5 : 1;
|
||||||
|
|
||||||
if (this.scale !== this.oldScale) {
|
if (this.scale !== this.oldScale) {
|
||||||
|
// https://github.com/liabru/matter-js/issues/986#issuecomment-812488873
|
||||||
|
// revert to the original size (by reverting the previous scale)
|
||||||
|
Matter.Body.scale(this.body, 1 / this.oldScale, 1 / this.oldScale)
|
||||||
|
// then scale again
|
||||||
Matter.Body.scale(this.body, this.scale, this.scale)
|
Matter.Body.scale(this.body, this.scale, this.scale)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,11 +108,14 @@ export default {
|
|||||||
const query = Matter.Query.point(Matter.Composite.allBodies(this.world), this.mouse.position)
|
const query = Matter.Query.point(Matter.Composite.allBodies(this.world), this.mouse.position)
|
||||||
// console.log(this.mouse.position);
|
// console.log(this.mouse.position);
|
||||||
// console.log(query);
|
// console.log(query);
|
||||||
|
let clickedIDs = [];
|
||||||
query.forEach(elmt => {
|
query.forEach(elmt => {
|
||||||
// console.log('body id:', elmt.id);
|
// console.log('body id:', elmt.id);
|
||||||
this.concernements.forEach((concernement, index) => {
|
clickedIDs.push(elmt.id);
|
||||||
this.openCloseConcernement(concernement.id, elmt.id === concernement.id)
|
});
|
||||||
});
|
let opend
|
||||||
|
this.concernements.forEach((concernement, index) => {
|
||||||
|
this.openCloseConcernement(concernement.id, clickedIDs.indexOf(concernement.id) !== -1)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user