Hey,
I’ve been slowly working on some UI drag changes and am getting closer to pull-request, but wouldn’t mind some tips with how to set up the scripting.
[quote]- Multi-touch drag support
- Combo press touch support – you get id mask of pressed buttons + number of buttons + the average of their positions
- Improved drag canceling support
Line edit now has a numeric mode:
- Supports setting a precision for # of decimal points formatting.
- Supports drag editing; can set increment amount, increment smoothing, button mask to activate the drag.
- E_TEXTFINISHED is sent when LineEdit is defocused (press enter, escape, press away from it / finishing a drag).[/quote]
Branch:https://github.com/hdunderscore/Urho3D/tree/drag_clean
Commit with all differences: github.com/hdunderscore/Urho3D/ … 2dd36a7636
An earlier pull-request I closed: github.com/urho3d/Urho3D/pull/473
A summary of changed function signatures:
UI.cpp:
[color=#FF8080]-UIElement* UI::GetDragElement() const[/color]
[color=#008040]+const HashMap<UIElement*, int> UI::GetDragElements()[/color]
UIElement.cpp (and derivatives):
[color=#FF8080]-void Slider::OnDragEnd(const IntVector2& position, const IntVector2& screenPosition, Cursor* cursor)[/color]
[color=#008040]+void Slider::OnDragEnd(const IntVector2& position, const IntVector2& screenPosition, int dragButtons, int buttons, Cursor* cursor)[/color]
A summary of new functions:
UIElement.cpp
[color=#008040]+virtual void OnDragCancel(const IntVector2& position, const IntVector2& screenPosition, int dragButtons, int buttons, Cursor* cursor);[/color]
New event related:
UIEvents.h - E_TEXTFINISHED:
[color=#008040]+ PARAM(P_VALUE, Value); // Float[/color]
UIEvents.h - E_DRAG*:
[color=#008040]+ PARAM(P_BUTTONS, Buttons); // int[/color]
[color=#008040]+ PARAM(P_NUMBUTTONS, NumButtons); // int[/color]
New Exposed attribute accessors:
[code]+ ENUM_ACCESSOR_ATTRIBUTE(LineEdit, “Line Edit Mode”, GetMode, SetMode, LineEditMode, lineEditModes, LEM_ALL, AM_FILE);
- ACCESSOR_ATTRIBUTE(LineEdit, VAR_INT, “Numeric Precision”, GetNumericPrecision, SetNumericPrecision, unsigned, 4, AM_FILE);
- ACCESSOR_ATTRIBUTE(LineEdit, VAR_FLOAT, “Value”, GetValue, SetValue, float, 0.0f, AM_FILE);
- ACCESSOR_ATTRIBUTE(LineEdit, VAR_INT, “Drag Edit Combo”, GetDragEditCombo, SetDragEditCombo, int, MOUSEB_RIGHT, AM_FILE);
- ACCESSOR_ATTRIBUTE(LineEdit, VAR_FLOAT, “Drag Edit Increment”, GetDragEditIncrement, SetDragEditIncrement, float, 0.1f, AM_FILE);
- ACCESSOR_ATTRIBUTE(LineEdit, VAR_FLOAT, “Drag Edit Smooth”, GetDragEditSmooth, SetDragEditSmooth, float, 0.1f, AM_FILE);[/code]
There may be other functions that need to be exposed to scripting/attributes, I’ll need to comb over the commit.
Thanks