|
|
|
@ -34,7 +34,7 @@ button = config \
|
|
|
|
ui.rect { w = c.w, h = c.h, strokeColor = c.strokeColor, strokeWidth = c.strokeWidth },
|
|
|
|
ui.rect { w = c.w, h = c.h, strokeColor = c.strokeColor, strokeWidth = c.strokeWidth },
|
|
|
|
ui.positioned {
|
|
|
|
ui.positioned {
|
|
|
|
x = 10, y = 8,
|
|
|
|
x = 10, y = 8,
|
|
|
|
child = ui.text { content = config.label, color = c.textColor }
|
|
|
|
child = renderText { content = config.label, color = c.textColor }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -42,11 +42,13 @@ button = config \
|
|
|
|
|
|
|
|
|
|
|
|
# inputButton (button that turns into an input)
|
|
|
|
# inputButton (button that turns into an input)
|
|
|
|
inputButton = config \
|
|
|
|
inputButton = config \
|
|
|
|
textSize = ui.measureText config.label;
|
|
|
|
label = renderText { content = config.label };
|
|
|
|
|
|
|
|
labelSize = ui.measure label;
|
|
|
|
|
|
|
|
labelWidth = labelSize.width;
|
|
|
|
|
|
|
|
|
|
|
|
defaults = {
|
|
|
|
defaults = {
|
|
|
|
h = 30,
|
|
|
|
h = 30,
|
|
|
|
w = textSize + 16,
|
|
|
|
w = labelWidth + 16,
|
|
|
|
strokeWidth = 1,
|
|
|
|
strokeWidth = 1,
|
|
|
|
strokeColor = "#fff",
|
|
|
|
strokeColor = "#fff",
|
|
|
|
textColor = "#fff",
|
|
|
|
textColor = "#fff",
|
|
|
|
@ -86,8 +88,8 @@ inputButton = config \
|
|
|
|
children = [
|
|
|
|
children = [
|
|
|
|
ui.rect { w = c.w, h = c.h, strokeColor = c.strokeColor, strokeWidth = c.strokeWidth },
|
|
|
|
ui.rect { w = c.w, h = c.h, strokeColor = c.strokeColor, strokeWidth = c.strokeWidth },
|
|
|
|
ui.positioned {
|
|
|
|
ui.positioned {
|
|
|
|
x = 8, y = 8,
|
|
|
|
x = 8, y = 4,
|
|
|
|
child = ui.text { content = config.label, color = c.textColor }
|
|
|
|
child = label
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -324,11 +326,39 @@ glyphView = config \
|
|
|
|
defaults = { scale = 1, color = "#fff" };
|
|
|
|
defaults = { scale = 1, color = "#fff" };
|
|
|
|
c = { ...defaults, ...config };
|
|
|
|
c = { ...defaults, ...config };
|
|
|
|
ui.stack {
|
|
|
|
ui.stack {
|
|
|
|
children = map (pixel \
|
|
|
|
children = [
|
|
|
|
ui.positioned {
|
|
|
|
ui.rect { w = c.glyph.w * c.scale, h = c.glyph.h * c.scale, color = "transparent" },
|
|
|
|
x = pixel.x * c.scale,
|
|
|
|
...map (pixel \
|
|
|
|
y = pixel.y * c.scale,
|
|
|
|
ui.positioned {
|
|
|
|
child = ui.rect { w = c.scale, h = c.scale, color = c.color }
|
|
|
|
x = pixel.x * c.scale,
|
|
|
|
}
|
|
|
|
y = pixel.y * c.scale,
|
|
|
|
) c.glyph.map
|
|
|
|
child = ui.rect { w = c.scale, h = c.scale, color = c.color }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
) c.glyph.map
|
|
|
|
|
|
|
|
]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# renderText : TextConfig \ UI
|
|
|
|
|
|
|
|
renderText = config \
|
|
|
|
|
|
|
|
# get these from system theme at some point
|
|
|
|
|
|
|
|
defaults = { content = "", scale = 2, color = "#fff" };
|
|
|
|
|
|
|
|
c = { ...defaults, ...config };
|
|
|
|
|
|
|
|
chars = split "" c.content;
|
|
|
|
|
|
|
|
_ = debug! "chars" chars;
|
|
|
|
|
|
|
|
ui.row {
|
|
|
|
|
|
|
|
children = map (char \
|
|
|
|
|
|
|
|
# _ = debug! "here. char" char;
|
|
|
|
|
|
|
|
getAt ["myFontBackup", "glyphs", char]
|
|
|
|
|
|
|
|
| Some g \ glyphView { glyph = g, scale = c.scale }
|
|
|
|
|
|
|
|
| None \ ui.rect { w = 0, h = 0 }
|
|
|
|
|
|
|
|
) chars,
|
|
|
|
|
|
|
|
gap = 4
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# fold (acc c \
|
|
|
|
|
|
|
|
# { pos = acc.pos + 8,
|
|
|
|
|
|
|
|
# ui = [...ui, ui.positioned { x }]
|
|
|
|
|
|
|
|
# }) { pos = 0, ui = [] } chars;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# text : String \ UI
|
|
|
|
|
|
|
|
text = content \ renderText { content = content };
|
|
|
|
|