|
|
|
@ -35,20 +35,31 @@ 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 \ {
|
|
|
|
pixelWidth = 5,
|
|
|
|
map = v.map,
|
|
|
|
pixelHeight = 7,
|
|
|
|
pixelWidth = 5,
|
|
|
|
cellSize = 30,
|
|
|
|
pixelHeight = 7,
|
|
|
|
selectedRow = 0,
|
|
|
|
cellSize = 30,
|
|
|
|
selectedCol = 0
|
|
|
|
selectedRow = 0,
|
|
|
|
},
|
|
|
|
selectedCol = 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
| _ \ {
|
|
|
|
|
|
|
|
map = [],
|
|
|
|
|
|
|
|
pixelWidth = 5,
|
|
|
|
|
|
|
|
pixelHeight = 7,
|
|
|
|
|
|
|
|
cellSize = 30,
|
|
|
|
|
|
|
|
selectedRow = 0,
|
|
|
|
|
|
|
|
selectedCol = 0
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
update = state event \ event
|
|
|
|
update = state event \ event
|
|
|
|
| ClickCell { x = x, y = y } \ toggleFocused state.{ selectedRow = y, selectedCol = x }
|
|
|
|
| ClickCell { x = x, y = y } \ toggleFocused state.{ selectedRow = y, selectedCol = x }
|
|
|
|
@ -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)
|
|
|
|
|