Font picker works on touchscreen, tab list scrollable
This commit is contained in:
parent
8d78dc2f3c
commit
1d134e5d39
2 changed files with 78 additions and 63 deletions
|
|
@ -209,7 +209,7 @@ void FontPicker::layout(const Clay_ElementId& id, std::string* newFontName, cons
|
|||
});
|
||||
}
|
||||
}, LayoutElement::Callbacks{
|
||||
.mouseButton = [&, textboxElement, dropdownButton] (LayoutElement* l, const InputManager::MouseButtonCallbackArgs& button) {
|
||||
.onClick = [&, textboxElement, dropdownButton] (LayoutElement* l, const InputManager::MouseButtonCallbackArgs& button) {
|
||||
if(!textboxElement->mouseHovering && !dropdownButton->mouseHovering && !l->mouseHovering && !l->childMouseHovering) {
|
||||
dropdownOpen = false;
|
||||
gui.set_to_layout();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "../ElementHelpers/ButtonHelpers.hpp"
|
||||
#include "../ElementHelpers/TextLabelHelpers.hpp"
|
||||
#include "SVGIcon.hpp"
|
||||
#include "ScrollArea.hpp"
|
||||
|
||||
namespace GUIStuff {
|
||||
|
||||
|
|
@ -33,14 +34,25 @@ MovableTabList::MovableTabList(GUIManager& gui): Element(gui) {}
|
|||
|
||||
void MovableTabList::layout(const Clay_ElementId& id, const MovableTabListData& newData) {
|
||||
d = newData;
|
||||
CLAY(id, {.layout = {
|
||||
|
||||
CLAY(id, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(BIG_BUTTON_SIZE)},
|
||||
}
|
||||
}) {
|
||||
gui.clipping_element<ScrollArea>("scroll area", ScrollArea::Options{
|
||||
.scrollHorizontal = true,
|
||||
.clipHorizontal = true,
|
||||
.scrollbarX = ScrollArea::ScrollbarType::NORMAL,
|
||||
.innerContent = [&](const ScrollArea::InnerContentParameters&) {
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIXED(BIG_BUTTON_SIZE)},
|
||||
.padding = CLAY_PADDING_ALL(0),
|
||||
.childGap = 4,
|
||||
.childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER },
|
||||
.layoutDirection = CLAY_LEFT_TO_RIGHT
|
||||
},
|
||||
.clip = {.horizontal = true, .childOffset = Clay_GetScrollOffset()}
|
||||
}
|
||||
}) {
|
||||
for(size_t i = 0; i < d.tabNames.size(); i++) {
|
||||
CLAY_AUTO_ID({.layout = {
|
||||
|
|
@ -99,5 +111,8 @@ void MovableTabList::layout(const Clay_ElementId& id, const MovableTabListData&
|
|||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue