MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
DragGeometry.hpp
Go to the documentation of this file.
1#pragma once
2
4#include "FactoryTable.hpp"
5
7
8/**
9 * @brief A float state Form: an outline scaled along one axis by the state.
10 *
11 * The outline is filled. The hit region is the placement's rect, so a track
12 * stays clickable at zero, and a drag along the scaled axis writes the
13 * fraction of the rect under the pointer.
14 */
15[[nodiscard]] MAYAFLUX_API std::optional<Geometry::Form<float>> scale_form(
16 const ScaleInputs& input, const RectPlacementInputs& placement, std::string& error);
17
18/**
19 * @brief A Form of unit square points that a press grabs and a drag moves.
20 *
21 * The state is the list of points, initially the input's. The hit region is
22 * the placement's rect. See Geometry::handle_path.
23 */
24[[nodiscard]] MAYAFLUX_API std::optional<Geometry::Form<std::vector<glm::vec2>>> handle_path_form(
25 const HandlePathInputs& input, const RectPlacementInputs& placement, std::string& error);
26
27/**
28 * @brief Register scale_form under a name.
29 *
30 * The factory element needs points. The instance needs a rect. The initial
31 * state is the element's value member.
32 */
33template <typename Source, typename Access>
34void expose_scale(FactoryTable<Source, Access>& table, std::string name)
35{
37 input.required("points");
38
39 table.template expose_typed<float>(std::move(name),
42}
43
44/**
45 * @brief Register handle_path_form under a name.
46 *
47 * The factory element needs points. The instance needs a rect. The initial
48 * state is the element's points.
49 */
50template <typename Source, typename Access>
52{
54 input.required("points");
55
56 table.template expose_typed<std::vector<glm::vec2>>(std::move(name),
59}
60
61}
Named factories that turn a template's factory element and an instance into placed Forma elements,...
RecordBinding & required(std::string name)
Bind described attributes and configured child collections of a source element.
void expose_handle_path(FactoryTable< Source, Access > &table, std::string name)
Register handle_path_form under a name.
std::optional< Geometry::Form< std::vector< glm::vec2 > > > handle_path_form(const HandlePathInputs &input, const RectPlacementInputs &placement, std::string &error)
A Form of unit square points that a press grabs and a drag moves.
std::optional< Geometry::Form< float > > scale_form(const ScaleInputs &input, const RectPlacementInputs &placement, std::string &error)
A float state Form: an outline scaled along one axis by the state.
Reflect::RecordBinding< RectPlacementInputs, Source, Access > rect_placement_binding()
A binding for RectPlacementInputs that requires rect.
void expose_scale(FactoryTable< Source, Access > &table, std::string name)
Register scale_form under a name.
Draggable points in the unit square, drawn as a connected stroke.
A placement by origin and size: x, y, width, height.
An outline in unit space that grows along one axis with a float state.