Starting on the pixelEditor. Fixing state reset issue when moving stateful components in the store path. adding hasField host function
parent
080273ac25
commit
eb5618c64e
@ -0,0 +1,46 @@
|
||||
pixelEditor = config \
|
||||
downArrow = state \
|
||||
{ state = state, emit = [] };
|
||||
|
||||
ui.stateful {
|
||||
focusable = True,
|
||||
autoFocus = True,
|
||||
|
||||
key = "pixelEditor-" & config.path,
|
||||
|
||||
init = {
|
||||
expanded = [], # loadMap from store
|
||||
pixelWidth = 5,
|
||||
pixelHeight = 7,
|
||||
zoomMultiplier = 10,
|
||||
selectedCords = { x = 0, y = 0 },
|
||||
editing = None
|
||||
},
|
||||
|
||||
update = state event \ event
|
||||
# | Toggle pixel \ (\ toggleFocused)
|
||||
| Key { key = "Space" } \ (\ toggleFocused)
|
||||
|
||||
| Key { key = "ArrowDown" } \ downArrow state
|
||||
| Key { key = "j" } \ downArrow state
|
||||
| Key { key = "ArrowUp" } \ upArrow state
|
||||
| Key { key = "k" } \ upArrow state
|
||||
| Key { key = "ArrowLeft" } \ leftArrow state
|
||||
| Key { key = "h" } \ leftArrow state
|
||||
| Key { key = "ArrowRight" } \ rightArrow state
|
||||
| Key { key = "l" } \ rightArrow state
|
||||
|
||||
| _ \ { state = state, emit = [] },
|
||||
|
||||
view = state emit \
|
||||
# onToggle = path \ emit (Toggle path);
|
||||
|
||||
cellWidth = state.pixelWidth * zoomMultiplier;
|
||||
cellHeight = state.pixelHeight * zoomMultiplier;
|
||||
rows = range 0 pixelHeight;
|
||||
columns = range 0 pixelWidth;
|
||||
|
||||
center {
|
||||
child = mapWidthIndex (rect) rows
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue