#1347·matter-js

How to release dragged element if mouse goes beyond bounding box?

Author: joaopedrocoelhoCreated Oct 30, 2025Updated Jan 19, 2026

I have made a codesandbox to illustrate my issue : https://codesandbox.io/p/sandbox/hvmg69

when dragging a ball outside of the blue box, it will start to spin fast and if I release the mouse while outside of the bounding box the element will continue to be dragged. I would like to release the ball if the mouse touches the bounding box.