MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ bounded_interaction()

template<typename T>
InteractionProvider< T > MayaFlux::Portal::Forma::bounded_interaction ( std::function< InteractionFn< T >(const Kinesis::AABB2D &)> make)
nodiscard

Provider for an interaction made from the placement bounds.

The provider reports an error when the placement has no bounds, so the callable never has to check.

Parameters
makeCallable taking the bounds and returning the interaction.

Definition at line 121 of file Interaction.hpp.

123{
124 return [make = std::move(make)](const InteractionSource& source, std::string& error)
125 -> std::optional<InteractionFn<T>> {
126 if (!source.placement) {
127 error = "interaction needs placement bounds";
128 return std::nullopt;
129 }
130 return make(*source.placement);
131 };
132}
typename Geometry::Form< T >::Wire InteractionFn
The interaction registration of a Form, run once after its element exists.
What an interaction provider may use: the placement bounds, when there are any.