From ec75d98fc0e496f2131fd5dc5ca1f19cd7534b4b Mon Sep 17 00:00:00 2001 From: William Billingsley <wbilling@une.edu.au> Date: Mon, 16 Sep 2019 14:50:29 +1000 Subject: [PATCH] Update updateChildren for newer version --- veautiful.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/veautiful.md b/veautiful.md index 012a32f..6d3a0c2 100644 --- a/veautiful.md +++ b/veautiful.md @@ -216,14 +216,18 @@ trait DiffNode extends DNode with MakeItSo { def updateChildren(to:Seq[VNode]):Unit = { // Use a diff algorithm to work out changes to make to children - val diffOps = Differ.seqDiff(children, to) + val diffReport = Differ.diffs(children, to) // implement changes + Differ.processDiffs(this, diffReport.ops) + children = diffReport.update // Recurse down the DiffNode's (new) children, getting them to "make it so" - updating.zip(to).collect({ case (x:MakeItSo, y:MakeItSo) => - x.makeItSo(y) - }) + children.iterator.zip(to.iterator) foreach { + case (uu:MakeItSo, tt:MakeItSo) => uu.makeItSo(tt) + case (u:Update, _) => u.update() + case _ => // nothing to do + } } ``` -- GitLab