# Changes 0.3.1

- Add Layout API and let Menu use it
- Add DragData (for float, double, int, etc)
- Add IO Delta calculation to not require a users delta value
- Add Config Var for SLider drag min size
- Remove Hid::Ref input of Containers as IO DragApi is used
- Containers that accept input will require an ID to function
This commit is contained in:
2025-03-14 15:14:45 +01:00
parent ba77dc9b42
commit 35272687f6
21 changed files with 688 additions and 469 deletions

View File

@ -22,10 +22,11 @@ SOFTWARE.
*/
#include <pd/ui7/container/coloredit.hpp>
#include <pd/ui7/container/label.hpp>
namespace PD {
namespace UI7 {
void ColorEdit::HandleInput(Hid::Ref inp) {
void ColorEdit::HandleInput() {
/// Ensure to only check input once
if (inp_done) {
return;
@ -34,6 +35,7 @@ void ColorEdit::HandleInput(Hid::Ref inp) {
if (screen->ScreenType() == Screen::Bottom) {
if (io->DragObject(this->GetID(), vec4(FinalPos(), size))) {
if (io->DragReleased) {
is_shown = !is_shown;
}
}
}
@ -45,6 +47,14 @@ void ColorEdit::Draw() {
list->AddRectangle(FinalPos(), vec2(20, 20), *color_ref);
list->AddText(FinalPos() + vec2(io->ItemSpace.x() + 20, 0), label,
io->Theme->Get(UI7Color_Text));
if (is_shown) {
if (!layout) {
layout = Layout::New(GetID(), io);
}
layout->AddObject(PD::New<Label>("Hello World!", io->Ren));
layout->Update();
io->RegisterDrawList(GetID(), layout->GetDrawList());
}
}
void ColorEdit::Update() {