mapitems matter body is not scaling anymore

This commit is contained in:
Bachir Soussi Chiadmi 2023-10-02 16:00:07 +02:00
parent a9812b403a
commit 980ae6e5a1

View File

@ -1573,10 +1573,10 @@ export default {
.onUpdate((obj) => { .onUpdate((obj) => {
// https://github.com/liabru/matter-js/issues/986#issuecomment-812488873 // https://github.com/liabru/matter-js/issues/986#issuecomment-812488873
// revert to the original size (by reverting the previous scale) // revert to the original size (by reverting the previous scale)
Matter.Body.scale(this.body, 1 / this.scale, 1 / this.scale) // Matter.Body.scale(this.body, 1 / this.scale, 1 / this.scale)
this.paper_main_object.scale(1 / this.scale); this.paper_main_object.scale(1 / this.scale);
// then scale again to new scale // then scale again to new scale
Matter.Body.scale(this.body, obj.s, obj.s) // Matter.Body.scale(this.body, obj.s, obj.s)
this.paper_main_object.scale(obj.s); this.paper_main_object.scale(obj.s);
// update superposition constraints points poisitions // update superposition constraints points poisitions
@ -1667,10 +1667,12 @@ export default {
.onUpdate((obj) => { .onUpdate((obj) => {
// https://github.com/liabru/matter-js/issues/986#issuecomment-812488873 // https://github.com/liabru/matter-js/issues/986#issuecomment-812488873
// revert to the original size (by reverting the previous scale) // revert to the original size (by reverting the previous scale)
Matter.Body.scale(this.body, 1 / this.scale, 1 / this.scale) // INFO we dont need to sacle the matter body AND it may fix the montgolfière bug
// TODO find another way to increase the mass
// Matter.Body.scale(this.body, 1 / this.scale, 1 / this.scale)
this.paper_main_object.scale(1 / this.scale); this.paper_main_object.scale(1 / this.scale);
// then scale again to new scale // then scale again to new scale
Matter.Body.scale(this.body, obj.s, obj.s) // Matter.Body.scale(this.body, obj.s, obj.s)
this.paper_main_object.scale(obj.s); this.paper_main_object.scale(obj.s);
// update superposition constraints points positions // update superposition constraints points positions