Rotatable pieces
Pieces can be rotated a) by mouse wheel/two-finger touchpad and b) on the touchscreen (by touching to points on a piece and rotate the two fingers clockwise or anti-clockwise). This is an optional feature which can be (de-)activated by configuration.
While a) should be quite simple to implement (see https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event for information on the event), b) is more tricky and requires some up-front work (ie implementing a suitable library). A starting point can be found here: https://developer.mozilla.org/en-US/docs/Web/API/Touch_events/Multi-touch_interaction.
Requirements:
- Two adjacent pieces connect when the angle is less than n (configurable) degrees.
- 360° / rotation step must equal an integer, so that a piece can always be rotated into a horizontal position.
Other resources
- https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin: Rotation center for compounds
- https://danburzo.ro/dom-gestures/
Edited by Sebastian Schüpbach