How to remove multiple same copy of an object/shape/circle

I tried this example from
but added a trash, it seems several instances can not be removed,
only the first one, because the others are copy/clones of the objecs/how to slove?
my file

Thanks to help

Can anyone see what @karelrosseel82 needs to do?

1 Like

If you add the copies to a container then add the press up to the container that way when you select an item from the container and do the hit test, it will be deleted. Here is the part of the code that makes it work.

let current;
circle.on("mousedown", e => {
	current =;
	current.copy = current.clone()
	// 4. set the current back to the top;

//const circle = new Circle(50, red).center().drag();

// 5. on a pressup, swap the two objects
circle.on("pressup", e => {
	current = e.currentTarget;
	// swap positions
	swapProperties("x", current, current.copy);
	swapProperties("y", current, current.copy);


dragholder.on("pressmove", (e)=> {
	const s =;
	if (s.hitTestBounds(rect)) {
1 Like

super.. I get it working! thanks a lot

my new file

1 Like