28 std::array<double, Core::TabletFrame::SLOT_COUNT> frame {};
31 [[nodiscard]]
double slot(
size_t index)
const
33 return index < frame.size() ? frame[index] : 0.0;
39 return Core::TabletFrame::in_state(frame, Core::TabletState::IN_PROXIMITY);
45 return Core::TabletFrame::in_state(frame, Core::TabletState::IN_CONTACT);
49 [[nodiscard]]
bool button(uint32_t bit)
const
51 const auto mask =
static_cast<uint32_t
>(frame[Core::TabletFrame::BUTTONS]);
52 return (mask & (1U << bit)) != 0U;
231 m_frame_callbacks.push_back(std::move(callback));
239 m_proximity_enter_callbacks.push_back(std::move(callback));
247 m_proximity_exit_callbacks.push_back(std::move(callback));
255 m_contact_begin_callbacks.push_back(std::move(callback));
263 m_contact_end_callbacks.push_back(std::move(callback));
269 [[nodiscard]] std::array<double, Core::TabletFrame::SLOT_COUNT>
get_frame()
const
271 return m_tablet_context.frame;
277 void update_context(
double value)
override;
279 void notify_tick(
double value)
override;
285 std::array<double, Core::TabletFrame::SLOT_COUNT> m_frame {};
286 uint32_t m_previous_state {};
287 std::atomic<bool> m_frame_pending {
false };
296 void fire(
const std::vector<FrameCallback>& callbacks);
Context for InputNode callbacks - provides input event access.
bool in_proximity() const
Whether the tool is within sensing range.
bool button(uint32_t bit) const
Test a tool button by bit index.
TabletContext(double value, double raw_value, Core::InputType source, uint32_t device_id)
double slot(size_t index) const
Read one slot of the frame.
bool in_contact() const
Whether the tool is touching the surface.
Node context carrying a full tablet frame alongside the scalar.
Base context class for node callbacks.
InputType
Input backend type enumeration.
std::function< void(ContextT &)> TypedHook
Callback function type for node processing events, parameterised on context type.
@ DISTANCE
0.0 to 1.0, hover height
@ ROTATION
-180.0 to 180.0 degrees
@ X
0.0 to 1.0 across the active area
@ STATE
TabletState bitmask.
@ TILT_Y
-90.0 to 90.0 degrees
@ WHEEL
Degrees of wheel rotation this sample.
@ SLIDER
-1.0 to 1.0, barrel pressure or finger wheel
@ Y
0.0 to 1.0 across the active area
@ TILT_X
-90.0 to 90.0 degrees
@ BUTTONS
Bit 0 barrel, bit 1 secondary barrel, bit 2 eraser.