Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
...selectPatty(this.props.burger),
bottomBun
]);
}
} else {
if (this.props.burger.bun) {
bodies = bodies.concat([selectTopBun(this.props.burger), bottomBun]);
}
}
}
Render.stop(this.matterRender);
World.clear(this.matterEngine.world);
Engine.clear(this.matterEngine);
World.add(this.matterEngine.world, bodies);
Engine.run(this.matterEngine);
Render.run(this.matterRender);
};
render() {
const newBlock = Bodies.rectangle(x, y, w, h, {
isStatic: true,
label,
collisionFilter: {
category: categories[2],
},
});
if (isLast) {
this.lastBlockChord = newBlock;
}
objects.push(newBlock);
})
}
World.add(this.engine.world, objects);
this.boxPositions = positions;
this.unit = unit;
this.hUnit = hUnit;
this.progress = 0;
this.resetAvatar();
}
_addPhysicsBodies(physicsEngine, boundingBox, elements) {
const walls = this._createWalls(boundingBox);
const animatableBodies = this._createAnimatableBodies(elements);
PhysicsWorld.add(physicsEngine.world, [...walls, ...animatableBodies]);
}
isStatic: true,
render: transparentOpts,
});
const rightSide = Bodies.rectangle(window.innerWidth - 10, height / 2, 10, height + 10, {
isStatic: true,
render: transparentOpts,
});
window.onresize = () => {
engine.render.canvas.width = window.innerWidth;
Body.set(rightSide, 'position', { x: window.innerWidth, y: height });
Body.set(ground, 'position', { x: window.innerWidth / 2, y: height + 10 });
Body.set(ground, 'width', window.innerWidth);
};
World.add(engine.world, [ground, ceil, leftSide, rightSide, ...loadSvgs(), ...loadSvgs()]);
const mouseConstraint = MouseConstraint.create(engine, {
constraint: {
render: { visible: false },
},
});
mouseConstraint.mouse.element.removeEventListener(
'mousewheel',
mouseConstraint.mouse.mousewheel,
);
mouseConstraint.mouse.element.removeEventListener(
'DOMMouseScroll',
mouseConstraint.mouse.mousewheel,
);
World.add(engine.world, mouseConstraint);
const mouseConstraint = MouseConstraint.create(engine, {
constraint: {
render: { visible: false },
},
});
mouseConstraint.mouse.element.removeEventListener(
'mousewheel',
mouseConstraint.mouse.mousewheel,
);
mouseConstraint.mouse.element.removeEventListener(
'DOMMouseScroll',
mouseConstraint.mouse.mousewheel,
);
World.add(engine.world, mouseConstraint);
Shapes.throwShapes(engine);
}
createBody(){
this.body = Bodies.rectangle(this.x, this.y, this.width, this.height, this.physicsOptions);
this.body['entity_id'] = this.id;
World.add(this.room.engine.world, this.body);
}
addToEngine(world) {
World.add(world, this.body);
}
}