Fixing tree after making paths lists. more font stuff. fixing rebind from the palette

master
Dustin Swan 3 days ago
parent 414fc5d79c
commit cbab2a3417
Signed by: dustinswan
GPG Key ID: 30D46587E2100467

@ -357,7 +357,7 @@ renderText = config \
ui.row {
children = map (char \
getField char font.glyphs
| Some g \ glyphView { glyph = g, scale = c.scale }
| Some g \ glyphView { glyph = g, scale = c.scale, color = c.color }
| None \ ui.rect { w = charW * c.scale, h = 12 * c.scale }
) chars,
gap = gap

@ -72,7 +72,7 @@ palette = config \
ui.positioned {
x = 6,
y = 12,
child = ui.text { content = config.child, color = "white" }
child = text config.child
}
]
}
@ -150,7 +150,7 @@ palette = config \
color = "transparent",
paddingLeft = 6,
paddingTop = 8,
child = ui.text { content = title, color = "#bbb" },
child = renderText { content = title, color = "#bbb" },
}
| Item data \ paletteRow {
child = data.label,

@ -106,7 +106,7 @@ fontEditor = config \
ui.column { gap = 2, children = [
header,
grid,
text "testing"
text "This is me testing. F() . I donno. #blessed. This - taht = 2 * 4. -> etc, etc.."
]}
}
};

@ -12,7 +12,7 @@ inspector = config \
tree {
value = reflected,
path = config.name,
path = [config.name],
w = ctx.w,
h = ctx.h - textInputHeight
}

@ -14,7 +14,7 @@ treeNodeHeight = value path expanded \
| True \ lineH + (sum (map (entry \
(valueLabel entry.value)
| Some _ \ lineH
| None \ lineH + (treeNodeHeight entry.value (path & "." & entry.key) expanded)
| None \ lineH + (treeNodeHeight entry.value (path & [entry.key]) expanded)
) entries))
| False \ lineH)
| ListValue items \ (
@ -22,7 +22,7 @@ treeNodeHeight = value path expanded \
| True \ lineH + (sum (mapWithIndex (item i \
(valueLabel item)
| Some _ \ lineH
| None \ lineH + (treeNodeHeight item (path & "." & (show i)) expanded)
| None \ lineH + (treeNodeHeight item (path & [show i]) expanded)
) items))
| False \ lineH)
| _ \ lineH;
@ -31,7 +31,7 @@ visiblePaths = value path expanded \ value
| RecordValue entries \ (
[{ path = path, leaf = False }, ...(contains path expanded)
| True \ flatten (map (entry \
entryPath = path & "." & entry.key;
entryPath = path & [entry.key];
(valueLabel entry.value)
| Some _ \ [{ path = entryPath, leaf = True }]
| None \ visiblePaths entry.value entryPath expanded
@ -40,7 +40,7 @@ visiblePaths = value path expanded \ value
| ListValue items \ (
[{ path = path, leaf = False }, ...(contains path expanded)
| True \ flatten (mapWithIndex (item i \
itemPath = path & "." & (show i);
itemPath = path & [show i];
(valueLabel item)
| Some _ \ [{ path = itemPath, leaf = True }]
| None \ visiblePaths item itemPath expanded
@ -55,7 +55,7 @@ treeNode = config \
simple = path content color onClick \
selected = (config.selectedPath | Some p \ p == path | None \ False);
# inner = ui.text { content = content, color = (selected | True \ "white" | False \ color) };
inner = renderText { scale = 1, content = content, color = (selected | True \ "white" | False \ color) };
inner = renderText { content = content, color = (selected | True \ "white" | False \ color) };
wrapped = (onClick
| Some handler \ ui.clickable { onClick = handler, child = inner }
| None \ inner);
@ -71,7 +71,7 @@ treeNode = config \
| _ \ None;
header = isExp label color \
simple config.path (config.prefix & (isExp | True \ "▼ " | False \ "▶ ") & label) color (Some (_ \ config.onToggle config.path));
simple config.path (config.prefix & (isExp | True \ "- " | False \ "+ ") & label) color (Some (_ \ config.onToggle config.path));
isExp = contains config.path config.expanded;
@ -83,7 +83,7 @@ treeNode = config \
config.value
| NumberValue n \ (isEditing
| True \ textInput {
key = "edit-" & config.path,
key = "edit-" & (join "." config.path),
initialValue = show n,
autoFocus = True,
color = "white",
@ -96,7 +96,7 @@ treeNode = config \
| StringValue n \ (isEditing
| True \ textInput {
key = "edit-" & config.path,
key = "edit-" & (join "." config.path),
initialValue = "\"" & n & "\"",
autoFocus = True,
color = "white",
@ -109,7 +109,7 @@ treeNode = config \
| ConstructorValue { tag = tag } \ (isEditing
| True \ textInput {
key = "edit-" & config.path,
key = "edit-" & (join "." config.path),
initialValue = tag,
autoFocus = True,
color = "white",
@ -130,7 +130,7 @@ treeNode = config \
onClick = _ \ noOp,
child = ui.column { gap = 0, children = map (entry \
pfx = (valueLabel entry.value) | Some _ \ " = " | None \ " ";
treeNode { value = entry.value, depth = depth + 1, path = config.path & "." & entry.key, expanded = config.expanded, onToggle = config.onToggle, selectedPath = config.selectedPath, prefix = entry.key & pfx, editing = config.editing, onDoneEditing = config.onDoneEditing, onEditLeaf = config.onEditLeaf }
treeNode { value = entry.value, depth = depth + 1, path = config.path & [entry.key], expanded = config.expanded, onToggle = config.onToggle, selectedPath = config.selectedPath, prefix = entry.key & pfx, editing = config.editing, onDoneEditing = config.onDoneEditing, onEditLeaf = config.onEditLeaf }
) entries }
}]
| False \ [])
@ -142,7 +142,7 @@ treeNode = config \
| True \ [ui.clickable {
onClick = _ \ noOp,
child = ui.column { gap = 0, children = mapWithIndex (item i \
treeNode { value = item, depth = depth + 1, path = config.path & "." & (show i), expanded = config.expanded, onToggle = config.onToggle, selectedPath = config.selectedPath, prefix = (show i) & ": ", editing = config.editing, onDoneEditing = config.onDoneEditing, onEditLeaf = config.onEditLeaf }
treeNode { value = item, depth = depth + 1, path = config.path & [show i], expanded = config.expanded, onToggle = config.onToggle, selectedPath = config.selectedPath, prefix = (show i) & ": ", editing = config.editing, onDoneEditing = config.onDoneEditing, onEditLeaf = config.onEditLeaf }
) items }
}]
| False \ [])
@ -205,7 +205,6 @@ tree = config \
view = state emit \
onToggle = path \ emit (Toggle path);
onEditLeaf = path \
_ = debug! "onEditLeaf" path;
emit (EditLeaf path);
onDoneEditing = _ \ emit DoneEditing;
totalH = treeNodeHeight config.value config.path state.expanded;

@ -190,13 +190,15 @@ os =
app = inspector { name = name };
openOrFocus name app.view (appWidth app))
| Value v \ (hasField "view" v
| Value v \ (hasField "_tag" v
| True \ batch [historyEvent, v]
| False \ (hasField "view" v
| True \ openOrFocus input v.view (appWidth v)
| False \ (getSource input == ""
| True \ openOrFocus input (_ \ renderText { content = show v, color = "white" }) dw
| False \ (
app = inspector { name = input };
openOrFocus input app.view (appWidth app))))
openOrFocus input app.view (appWidth app)))))
| Err msg \ (_ = debug! "OS Error" msg; noOp);
batch [historyEvent, openEvent];

Loading…
Cancel
Save