Slight changes to UI
This commit is contained in:
parent
4774f1ee94
commit
a533494b3a
12 changed files with 129 additions and 21 deletions
|
|
@ -31,7 +31,7 @@ void CheckBox::layout(const Clay_ElementId& id, const std::function<bool()>& isT
|
|||
this->isTicked = isTicked;
|
||||
this->onClick = onClick;
|
||||
|
||||
float size = gui.io.isTouchDevice ? 25 : 15;
|
||||
float size = 20;
|
||||
CLAY(id, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(size), .height = CLAY_SIZING_FIXED(size)}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ void RadioButton::layout(const Clay_ElementId& id, const std::function<bool()>&
|
|||
this->onClick = onClick;
|
||||
this->isTicked = isTicked;
|
||||
|
||||
float size = gui.io.isTouchDevice ? 25 : 20;
|
||||
float size = 20;
|
||||
CLAY(id, {
|
||||
.layout = {
|
||||
.sizing = {.width = CLAY_SIZING_FIXED(size), .height = CLAY_SIZING_FIXED(size)}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace GUIStuff {
|
|||
SVGIcon::SVGIcon(GUIManager& gui):
|
||||
Element(gui) {}
|
||||
|
||||
void SVGIcon::layout(const Clay_ElementId& id, const std::string& newSvgPath, bool newIsHighlighted) {
|
||||
void SVGIcon::layout(const Clay_ElementId& id, const std::string& newSvgPath, bool newIsHighlighted, bool newInverse) {
|
||||
bool redraw = false;
|
||||
|
||||
auto& io = gui.io;
|
||||
|
|
@ -42,7 +42,9 @@ void SVGIcon::layout(const Clay_ElementId& id, const std::string& newSvgPath, bo
|
|||
}
|
||||
|
||||
redraw |= highlighted != newIsHighlighted;
|
||||
redraw |= inverse != newInverse;
|
||||
highlighted = newIsHighlighted;
|
||||
inverse = newInverse;
|
||||
|
||||
if(redraw)
|
||||
gui.invalidate_draw_element(this);
|
||||
|
|
@ -66,7 +68,10 @@ void SVGIcon::clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderComman
|
|||
SkRect r = SkRect::MakeXYWH(0.0f, 0.0f, bb.width(), bb.height());
|
||||
canvas->clipRect(r);
|
||||
SkPaint blendingPaint;
|
||||
blendingPaint.setColorFilter(SkColorFilters::Blend(highlighted ? io.theme->frontColor1 : io.theme->frontColor2, SkColorSpace::MakeSRGB(), SkBlendMode::kSrcIn));
|
||||
if(inverse)
|
||||
blendingPaint.setColorFilter(SkColorFilters::Blend(highlighted ? io.theme->backColor1 : io.theme->backColor2, SkColorSpace::MakeSRGB(), SkBlendMode::kSrcIn));
|
||||
else
|
||||
blendingPaint.setColorFilter(SkColorFilters::Blend(highlighted ? io.theme->frontColor1 : io.theme->frontColor2, SkColorSpace::MakeSRGB(), SkBlendMode::kSrcIn));
|
||||
canvas->saveLayer(r, &blendingPaint);
|
||||
canvas->scale(bb.width() / svgDom->containerSize().width(), bb.height() / svgDom->containerSize().height());
|
||||
svgDom->render(canvas);
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@ namespace GUIStuff {
|
|||
class SVGIcon : public Element {
|
||||
public:
|
||||
SVGIcon(GUIManager& gui);
|
||||
void layout(const Clay_ElementId& id, const std::string& newSvgPath, bool newIsHighlighted = false);
|
||||
void layout(const Clay_ElementId& id, const std::string& newSvgPath, bool newIsHighlighted = false, bool newInverse = false);
|
||||
virtual void clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderCommand* command, bool skiaAA) override;
|
||||
private:
|
||||
bool inverse;
|
||||
bool highlighted;
|
||||
sk_sp<SkSVGDOM> svgDom;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -152,6 +152,10 @@ void TreeListing::layout(const Clay_ElementId& id, const Data& newDisplayData) {
|
|||
}
|
||||
}
|
||||
d.drawObjGUI(objInfo.objIndex);
|
||||
// Gap for scroll bar
|
||||
CLAY_AUTO_ID({
|
||||
.layout = {.sizing = {.width = CLAY_SIZING_FIT(15), .height = CLAY_SIZING_GROW(0)}}
|
||||
}) {}
|
||||
}
|
||||
}
|
||||
}, LayoutElement::Callbacks {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue