This script is included in all of the tooltip components from Relume Library's UI Elements. It adds 2 features:
- Flip the tooltip to the opposite direction, to keep it within the viewport:
Screencast.from.2023-04-06.10-14-10.webm
- Slide the tooltip along the perpendicular axis, to keep it within the viewport: