Loading glyphs

master
Dustin Swan 5 days ago
parent f426573f96
commit d58c39a1ac
Signed by: dustinswan
GPG Key ID: 30D46587E2100467

@ -35,14 +35,25 @@ pixelEditor = config \
newState = state.{ map = newMap }; newState = state.{ map = newMap };
{ state = newState, emit = saveGlyph newState }); { state = newState, emit = saveGlyph newState });
existing = eval! (c.path);
size \ ui.stateful { size \ ui.stateful {
focusable = True, focusable = True,
autoFocus = True, autoFocus = True,
key = "pixelEditor-" & config.path, key = "pixelEditor-" & c.path,
init = { init = existing
map = [], # loadMap from store | Value v \ {
map = v.map,
pixelWidth = 5,
pixelHeight = 7,
cellSize = 30,
selectedRow = 0,
selectedCol = 0
}
| _ \ {
map = [],
pixelWidth = 5, pixelWidth = 5,
pixelHeight = 7, pixelHeight = 7,
cellSize = 30, cellSize = 30,
@ -87,7 +98,7 @@ pixelEditor = config \
strokeColor = (selected | True \ "#f00" | False \ "rgba(0,0,0,0.2)"); strokeColor = (selected | True \ "#f00" | False \ "rgba(0,0,0,0.2)");
ui.clickable { ui.clickable {
onClick = \ _ = debug! "here" [rIdx, cIdx]; emit (ClickCell { x = cIdx, y = rIdx }), onClick = \ emit (ClickCell { x = cIdx, y = rIdx }),
child = ui.rect { w = state.cellSize, h = state.cellSize, color = color, strokeWidth = 1, strokeColor = strokeColor } child = ui.rect { w = state.cellSize, h = state.cellSize, color = color, strokeWidth = 1, strokeColor = strokeColor }
} }
) (range 0 state.pixelWidth) ) (range 0 state.pixelWidth)

Loading…
Cancel
Save