Pacem2DElement
is the stage element for 2D drawings.
It must be associated with a Pacem2DAdapterElement
in orderr to work, since it is agnostic about the rendering process.
The adapter reference can be seamlessly switched between the two available implementations: one SVG-based and the other one WebGL-based.
The following example shows how the stage emitted events are powered with coordinate transformations:
Drag the square around and see the stage coordinates changing while moving, or just click the empty portions of the stage to pop a toast bringing the relevant stage coordinates.
Experimental/fun applications based on Pacem JS 2D drawings library: