|
Krotos Modules 3
|
An XY Button UI component with a puck following the mouse position. More...
#include <XYButton.h>
Classes | |
| struct | Layout |
Public Member Functions | |
| XYButton (String xLabel="X", String yLabel="Y") | |
| void | setNormalisedPuckPosition (Point< float > pos) |
| void | setPuckPosition (Point< int > pos) |
| void | setToggleValue (float x) |
| bool | getToggleValue () |
| Point< float > | getPuckPosition () |
| void | createMask (const void *data, const size_t numBytes) |
| void | setPaintBackground (bool val) |
| bool | getPaintBackground () |
| void | setMaskNotStreched () |
Public Attributes | |
| std::function< void(Point< float >)> | puckPositionChanged {nullptr} |
| std::function< void()> | dragStarted {nullptr} |
| std::function< void()> | dragEnded {nullptr} |
Static Public Attributes | |
| static const std::string | analyticsEventMouseDown {"analyticsEventMouseDown"} |
Private Member Functions | |
| void | resized () override |
| void | paintButton (Graphics &, bool, bool) override |
| void | paintOverChildren (Graphics &g) override |
| void | mouseDrag (const MouseEvent &) override |
| void | mouseDown (const MouseEvent &) override |
| void | mouseUp (const MouseEvent &) override |
| void | mouseMove (const MouseEvent &) override |
| void | drawGradientLine (Graphics &g, float startX, float startY, float endX, float endY, float lineWidth, float minOpacity, float maxOpacity) |
Private Attributes | |
| struct krotos::XYButton::Layout | m_layout |
| bool | m_maskStreched {true} |
| std::unique_ptr< Drawable > | m_background |
| std::unique_ptr< Drawable > | m_twoZoneMask |
| Point< float > | m_puckPosition |
| Point< float > | m_scaledPuckPosition |
| bool | m_mouseIsDown = false |
| bool | m_mouseOverPuck = false |
| Rectangle< int > | m_bounds |
| Rectangle< float > | m_puckBounds |
| Rectangle< int > | m_puckBoundary |
| Rectangle< int > | m_maskBounds |
| Rectangle< int > | m_wholeBounds |
| bool | m_paintBackground {true} |
| bool | m_toggleValue |
An XY Button UI component with a puck following the mouse position.
This class implements a grahBackground box with a mouse moving inside of it and a puck following the position of the mouse. If the mouse is clicked, the puck becomes larger and filled with colour to indicate the mouseDown action and the beggining of sending data to the attached parameters.
| krotos::XYButton::XYButton | ( | String | xLabel = "X", |
| String | yLabel = "Y" ) |
| void krotos::XYButton::createMask | ( | const void * | data, |
| const size_t | numBytes ) |
Set the binary data destination and create mask on the background image.
|
private |
|
inline |
Get whether the XY should draw for reformer or standard
|
inline |
Gets the position of the XY puck dot as a Point<float>
| bool krotos::XYButton::getToggleValue | ( | ) |
|
overrideprivate |
|
overrideprivate |
|
overrideprivate |
|
overrideprivate |
|
inlineoverrideprivate |
|
overrideprivate |
|
overrideprivate |
|
inline |
| void krotos::XYButton::setNormalisedPuckPosition | ( | Point< float > | pos | ) |
Sets the position of the XY puck dot
| pos | The new puck position as floats normalised to 0.f -> 1.f |
|
inline |
Set whether the XY should draw for reformer or standard
| void krotos::XYButton::setPuckPosition | ( | Point< int > | pos | ) |
Sets the position of the XY puck from screen position
| pos | The new puck position in pixels relative to bounds |
| void krotos::XYButton::setToggleValue | ( | float | x | ) |
|
static |
| std::function<void()> krotos::XYButton::dragEnded {nullptr} |
Gets called from mouseUp. Ends gesture on both parameters
| std::function<void()> krotos::XYButton::dragStarted {nullptr} |
Gets called from mouseDown. Begins gestures on both parameters
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| std::function<void(Point<float>)> krotos::XYButton::puckPositionChanged {nullptr} |
Gets called from setPuckPosition(Point<float> pos). Updated both parameter values as part of gesture