|
VisuTwin Canvas
C++ 3D Engine — Metal Backend
|
#include <framework/script/annotationManager.h>
Public Member Functions | |
| Annotation * | activeAnnotation () const |
| The currently selected (clicked) annotation, or nullptr. | |
| const Color & | activeColor () const |
| void | handleClick (float screenX, float screenY) |
| Handle mouse click at screen coordinates — selects/deselects the nearest annotation. | |
| const Color & | hotspotColor () const |
| float | hotspotSize () const |
| const Color & | hoverColor () const |
| Annotation * | hoveredAnnotation () const |
| The currently hovered annotation (nearest to mouse within hotspot radius), or nullptr. | |
| void | initialize () override |
| float | opacity () const |
| const std::vector< AnnotationScreenInfo > & | screenInfos () const |
| void | setActiveColor (const Color &value) |
| void | setHotspotColor (const Color &value) |
| void | setHotspotSize (float value) |
| void | setHoverColor (const Color &value) |
| void | setOpacity (float value) |
| void | update (float dt) override |
| void | updateHover (float mouseX, float mouseY) |
| Update hover state based on mouse position (call each frame with current mouse pos). | |
| Public Member Functions inherited from visutwin::canvas::Script | |
| bool | enabled () const |
| virtual void | fixedUpdate (float fixedDt) |
| virtual void | postInitialize () |
| virtual void | postUpdate (float dt) |
| Public Member Functions inherited from visutwin::canvas::EventHandler | |
| template<typename... Args> | |
| EventHandler * | fire (const std::string &name, Args &&... args) |
| bool | hasEvent (const std::string &name) const |
| void | initEventHandler () |
| template<typename Callback> requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>) | |
| EventHandler * | off (const std::string &name, Callback &&callback, void *scope=nullptr) |
| EventHandler * | off (const std::string &name="", const HandleEventCallback &callback=HandleEventCallback(), void *scope=nullptr) |
| EventHandler * | offByHandle (EventHandle *handle) |
| template<typename Callback> requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>) | |
| EventHandle * | on (const std::string &name, Callback &&callback, void *scope=nullptr) |
| EventHandle * | on (const std::string &name, HandleEventCallback callback, void *scope=nullptr) |
| template<typename Callback> requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>) | |
| EventHandle * | once (const std::string &name, Callback &&callback, void *scope=nullptr) |
| EventHandle * | once (const std::string &name, HandleEventCallback callback, void *scope=nullptr) |
| virtual | ~EventHandler ()=default |
Static Public Member Functions | |
| static constexpr const char * | scriptName () |
Additional Inherited Members | |
| Protected Member Functions inherited from visutwin::canvas::Script | |
| Entity * | entity () const |
| Protected Member Functions inherited from visutwin::canvas::EventHandler | |
| EventHandle * | addCallback (const std::string &name, HandleEventCallback callback, void *scope=nullptr, bool once=false) |
A manager script that handles annotation registration, screen-space projection, and click interaction. All rendering is delegated to an external overlay system (e.g., ImGuiOverlay) which reads the projected screen positions each frame.
The manager listens for engine-level events to automatically register annotations:
The manager handles:
All visual rendering (hotspot circles, tooltip panels, connector lines) is done externally by reading annotations(), activeAnnotation(), and hoveredAnnotation().
Definition at line 56 of file annotationManager.h.
|
inline |
The currently selected (clicked) annotation, or nullptr.
Definition at line 81 of file annotationManager.h.
|
inline |
Definition at line 67 of file annotationManager.h.
| void visutwin::canvas::AnnotationManager::handleClick | ( | float | screenX, |
| float | screenY ) |
Handle mouse click at screen coordinates — selects/deselects the nearest annotation.
Definition at line 187 of file annotationManager.cpp.
References visutwin::canvas::Annotation::text(), and visutwin::canvas::Annotation::title().
|
inline |
Definition at line 64 of file annotationManager.h.
|
inline |
Definition at line 61 of file annotationManager.h.
References hotspotSize().
Referenced by hotspotSize().
|
inline |
Definition at line 70 of file annotationManager.h.
|
inline |
The currently hovered annotation (nearest to mouse within hotspot radius), or nullptr.
Definition at line 84 of file annotationManager.h.
|
overridevirtual |
Called when script is about to run for the first time. Override this method in subclasses to implement custom initialization logic.
Reimplemented from visutwin::canvas::Script.
Definition at line 27 of file annotationManager.cpp.
References visutwin::canvas::Entity::engine(), and visutwin::canvas::Script::entity().
|
inline |
Definition at line 73 of file annotationManager.h.
|
inline |
All registered annotations with their current screen positions. Updated each frame in update(). Use this to render annotations externally.
Definition at line 78 of file annotationManager.h.
|
inlinestaticconstexpr |
Definition at line 59 of file annotationManager.h.
|
inline |
Definition at line 68 of file annotationManager.h.
|
inline |
Definition at line 65 of file annotationManager.h.
|
inline |
Definition at line 62 of file annotationManager.h.
|
inline |
Definition at line 71 of file annotationManager.h.
|
inline |
Definition at line 74 of file annotationManager.h.
|
overridevirtual |
Reimplemented from visutwin::canvas::Script.
Definition at line 141 of file annotationManager.cpp.
References visutwin::canvas::AnnotationScreenInfo::annotation, visutwin::canvas::AnnotationScreenInfo::screenX, visutwin::canvas::AnnotationScreenInfo::screenY, and visutwin::canvas::AnnotationScreenInfo::visible.
| void visutwin::canvas::AnnotationManager::updateHover | ( | float | mouseX, |
| float | mouseY ) |
Update hover state based on mouse position (call each frame with current mouse pos).
Definition at line 166 of file annotationManager.cpp.