Week 8
Minor Corrections to By Copy-Restore
7-31-2018
Dr. Naps pointed out a mistake I made for the text on one of the slides, so I took care of that right away. He also suggested moving the pointer labels next to their respective labels in the foo box. Here’s what that looks like:
It looks better, since it doesn’t cover as much content and also does a better job illustrating where values are coming from. But pulling this off with the current version of JSAV is a total mess. Unlike most objects in JSAV, pointers can’t be positioned relative to arbitrary JSAV objects. Instead, they’re positioned relative to the target they’re pointing at.
However, there is a trick
to position the label relative to something else. By setting fixed
to true
,
the pointer can first target an array to position the label relative to, then
re-target the pointer to the actual target. Since fixed
is set to true
,
the pointer label isn’t repositioned after pointing back to the correct target.
This is what my code basically looks like right now:
cprPointers[fooVarNames[i]] = av.pointer(fooVarNames[i],fooVars[fooVarNames[i]],{
targetIndex: 0,
fixed: true,
left: (leftMargin * -1.75),
top: 8,
anchor: 'left center'
})
cprPointers[fooVarNames[i]].target(cprVars[fooVarNames[i]],{
targetIndex: destIndex
})
Not ideal, but that’s just the way it goes sometimes. JSAV pls fix.
Here’s my commit.