This commit is contained in:
Andreas Rumpf 2017-05-04 09:45:32 +02:00
commit 9f80fcfc2d
2 changed files with 5 additions and 4 deletions

View file

@ -132,6 +132,9 @@ proc dthunk*(name: cstring; args: varargs[VNode, vn]): VNode =
VNode(kind: VNodeKind.dthunk, text: name, key: -1, kids: @args)
proc eq*(a, b: VNode): bool =
if a.track != 0 and b.track != 0:
# do not recurse here:
return a.track == b.track
if a.kind != b.kind: return false
if a.id != b.id: return false
if a.class != b.class: return false
@ -144,8 +147,6 @@ proc eq*(a, b: VNode): bool =
if a.attrs.len != b.attrs.len: return false
for i in 0..<a.attrs.len:
if a.attrs[i] != b.attrs[i]: return false
if a.track != 0 and b.track != 0:
if a.track != b.track: return false
result = true
proc setAttr*(n: VNode; key: cstring; val: cstring = "") =

View file

@ -36,7 +36,7 @@ proc createTableCell(id: cstring): VNode =
proc createTableRow(item: TableItemState): VNode =
let className = if item.active: cstring"TableRow active" else: cstring"TableRow"
result = buildHtml(tr(class=className, `data-id` = &item.id, key = item.id)):
result = buildHtml(tr(class=className, `data-id` = &item.id, track = item.id)):
createTableCell("#" & &item.id)
for i in 0..<len(item.props):
createTableCell(item.props[i])
@ -53,7 +53,7 @@ proc createAnimBox(item: AnimBoxState): VNode =
let color = float(t10) / 10
let divStyles = cstring"border-radius: " & &t10 &
"px; background: rgba(0,0,0," & cstring($color) & ")"
result = flatHtml(tdiv(class="AnimBox", `data-id` = &item.id, key = item.id,
result = flatHtml(tdiv(class="AnimBox", `data-id` = &item.id, track = item.id,
style=divStyles))
proc animCreateVNode(data: AnimState): VNode =