grzesta05 / Optics

Optics task created for Motorola Science Cup 2023
4 stars 0 forks source link

Handle selecting elements from toolbar #19

Open grzesta05 opened 9 months ago

grzesta05 commented 9 months ago

Right now, in ToolbarTab, new objects are created on position (0,0) on the canvas.

function addObject<Temp extends SimulationObject>(object: new (...args: any) => Temp): void {
        setObjectsToRender((prev) => [...prev, new object(0, 0, 0)]);
    }

We want them to be created on user's mouse click somewhere on the canvas, with position on this click.