Dominick Allen
Dominick Allen

Reputation: 93

FabricJs how to add a new object to an active selection

I'm working on a project where I will be selecting canvas objects via HTML buttons. I'm able to select individual objects just fine. The issue I'm having is when trying to select multiple buttons which then select the corresponding objects on the canvas. It seems when using canvas.setActiveObject(theCanvasObject) it deselects the current selected object and replaces it with the new one. Is there a way to add new objects to the active objects selection?

Upvotes: 1

Views: 308

Answers (1)

Lonelydatum
Lonelydatum

Reputation: 1236

 var sel = new ActiveSelection(selectMultipleList.current);
canvas.setActiveObject(sel);
canvas.requestRenderAll();

Upvotes: 0

Related Questions