Skip to content

Commit e54bf15

Browse files
committed
Add in-progress description of simpler and correct upward cascade, and of disappearance prevention, for safekeeping
Signed-off-by: Jim Hawkins <[email protected]>
1 parent b8b36f4 commit e54bf15

File tree

1 file changed

+219
-38
lines changed

1 file changed

+219
-38
lines changed

documents/Specification/07ZoomBoxMovement/ZoomBoxMovement.md

+219-38
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,25 @@ Processing steps are as follows.
7171
zooming solver isn't discussed here but moving in the reverse sequential
7272
direction will increase lateral size.
7373

74-
3. Taking the target as a reference, cascade updates to its siblings and
75-
parent. Processing is described under **Zoom Box Movement Upward Cascade**,
76-
below.
74+
3. Taking the target as a reference, cascade updates to its parents. Processing
75+
is described under **Zoom Box Movement Upward Cascade**, below.
7776

7877
Note that there are no updates to the target during the upward cascade.
7978

80-
4. Check for necessary adjustments to any child boxes that weren't updated in
79+
The upward cascade finishes after the size and position of every parent up
80+
to the root box has been updated.
81+
82+
4. Enforce the root disappearance restrictions. The restrictions prevent the
83+
root box from disappearing out of the zooming area user interface, in either
84+
dimension. Processing is described under
85+
**Zoom Box Movement Root Disappearance Prevention**, below.
86+
87+
The outcome of this step is that the updated root box size and position
88+
values may have been overridden.
89+
90+
91+
92+
5. Check for necessary adjustments to any child boxes that weren't updated in
8193
the upward cascade. Processing is described under
8294
**Zoom Box Movement Downward Cascade**, below.
8395

@@ -123,36 +135,45 @@ An upward cascade is processed in relation to a reference box, referred to in
123135
this description as the target. The target's size and position will have been
124136
updated prior to cascade processing.
125137

126-
1. If the target is a direct child of the root of the zoom box hierarchy then
127-
check if the root descent conditions are met. If they are then process root
128-
descent now and skip the remaining steps.
138+
1. Check if the target meets the root descent conditions.
129139

130140
Root descent is described elsewhere in the specification TBD but it could be
131141
[Zoom Box Spawning](../06ZoomBoxSpawning/ZoomBoxSpawning.md). For
132142
convenience, the conditions are that the zooming area limits are entirely
133143
within the target. These are some outcomes of root descent.
134144

145+
- The current root box, and any intermediate parent boxes between it and
146+
the target, are stored outside the hierarchy. The child boxes of any
147+
stored root boxes, other than the new root box, may be deleted or
148+
cached.
135149
- The target box becomes the root of the hierarchy.
136-
- The previous root is stored outside the hierarchy.
150+
151+
If the root descent conditions were met then the upward cascade is finished
152+
and remaining steps are skipped.
137153

138154
2. If the target is the root of the zoom box hierarchy then check if the root
139-
ascent conditions are met. If they are then process root ascent now, then
140-
continue the cascade processing.
155+
ascent conditions are met.
141156

142157
Root ascent is described elsewhere in the specification TBD but it could be
143158
[Zoom Box Spawning](../06ZoomBoxSpawning/ZoomBoxSpawning.md). For
144-
convenience, the conditions are that the zooming area limits aren't entirely
145-
within the root box, and that there is a stored root box from a previous
146-
descent.
159+
convenience, the conditions are these.
160+
161+
- The zooming area limits aren't entirely within the root box.
162+
- There is at least one stored box from a previous root descent.
163+
164+
(There won't be a stored box if the target is the original root with empty
165+
box text.)
147166

148167
These are some outcomes of root ascent.
149168

150-
- The previously stored root becomes the root again.
151-
- The target box becomes a child of the new root.
152-
- Siblings of the target box have been weight spawned.
169+
- The previously stored parent of the target will be the root.
170+
- The target box will be a child of the new root.
171+
- Siblings of the target box will have been weight spawned.
172+
173+
After root ascent is processed, the upward cascade continues.
153174

154175
3. If the target is the root of the zoom box hierarchy, skip the remaining
155-
steps.
176+
steps. The upward cascade is finished.
156177

157178
Note that if the target was the root at the start of cascade processing then
158179
it could only be the root now if the root ascent conditions weren't met in
@@ -190,6 +211,80 @@ updated prior to cascade processing.
190211
> weight buy also total weights of siblings before it and siblings after
191212
> it. Weights don't change after spawning.
192213
214+
215+
5. Update the target's parent's lateral centre
216+
217+
1. Sum the weights of the target's siblings that are before it in the
218+
parent to generate a result W1. Note that W1 would be zero if the target
219+
is the first child.
220+
2. Sum the weights of the target and all its siblings to generate a result
221+
W2.
222+
3. Calculate an updated parent lateral offset (PLO) by multiplying the
223+
parent's updated lateral size (ULS) by W1, then dividing the result by
224+
W2.
225+
226+
As a formula `PLO = (ULS × W1) ÷ W2`.
227+
228+
4. Calculate an updated parent lateral edge (PLE) the sum of these factors.
229+
230+
- The target's lateral centre (TLC).
231+
- The target's lateral size (TLS) divided by two.
232+
- PLO.
233+
234+
As a formula `PLE = TLC + (TLS ÷ 2) + PLO`
235+
236+
5. Deduct half the parent's updated lateral size from PLE.
237+
238+
The result is the parent's updated lateral centre.
239+
240+
Object or objects | Attribute |Original|Updated
241+
------------------------------------|----------------------|--------|-------
242+
Target | Lateral centre | | 180
243+
Target | Lateral size | | 180
244+
Parent | Lateral size | | 1800
245+
Siblings that are before the target | Sum of child weights | 0.2 |
246+
Parent | Lateral centre | -175 | -270
247+
248+
The sum of child weights is an example for the purposes of illustration. For
249+
ease of reading, child weight has been normalised here. In the terms used in
250+
the calculation, above, W2 is one.
251+
252+
The parent lateral centre calculation in full is as follows.
253+
`180 + (180 ÷ 2) + (1800 × 0.2) - (1800 ÷ 2) = -270`
254+
255+
(Note that child weights don't change after spawning. That means the sum of
256+
the weights of the siblings before each child need only be calculated once,
257+
at weight spawning time. That and use of normalised weights are possible
258+
optimisations for implementation.)
259+
260+
6. Update the parent's front position by invoking the solve front position
261+
function passing in its updated lateral size.
262+
263+
Note that this processing step is similar to step 2. The lateral size of a
264+
zoom box that has moved is updated to a value returned by a solver function.
265+
266+
Object | Attribute |Original|Updated
267+
------------|----------------|--------|-------
268+
Parent | Lateral size | | 1800
269+
Parent | Front position | -1250 | -1550
270+
271+
As before, the mapped size has been assumed for the purposes of
272+
illustration. The value is consistent with a square solver type of
273+
algorithm; the change in front position is the same as the change in the
274+
lateral size.
275+
276+
7. Taking the parent box as the reference instead of the target repeat the
277+
upward cascade steps above.
278+
279+
In effect, upward cascade processing ascends the hierarchy until the root
280+
box's size and position has been updated.
281+
282+
That concludes processing of the upward cascade.
283+
284+
285+
286+
287+
193288
5. Update the target's siblings' lateral sizes based on their child weights and
194289
the parent's updated lateral size.
195290

@@ -206,6 +301,9 @@ updated prior to cascade processing.
206301
siblings have been shown. In a typical zoom box there would be up to 25 in a
207302
hierarchical palette, or around 70 in a flat palette.
208303

304+
305+
306+
209307
6. Update the target's siblings' lateral centres so that they fill the parent's
210308
updated lateral size with no gaps and no overlapping, as they would have
211309
been before move processing started. The calculations can be like this.
@@ -280,29 +378,8 @@ updated prior to cascade processing.
280378
Parent lateral centre = PLE - ( Parent lateral size / 2 )
281379
= 630 - 900
282380

283-
9. Update the parent's front position by invoking the solve front position
284-
function passing in its updated lateral size. This step is the end of the
285-
upward cascade.
286-
287-
Note that this processing step is similar to step 2. The lateral size of a
288-
zoom box that has moved is updated to a value returned by a solver function.
289381

290-
Object | Attribute |Original|Updated
291-
------------|----------------|--------|-------
292-
Parent | Lateral size | | 1800
293-
Parent | Front position | -1250 | -1550
294382

295-
As before, the mapped size has been assumed for the purposes of
296-
illustration. The value is consistent with a square solver type of
297-
algorithm; the change in front position is the same as the change in the
298-
lateral size.
299-
300-
10. Taking the parent box as the reference instead of the target repeat the
301-
upward cascade steps above. Continue repeating until one of the conditions
302-
in the initial processing steps isn't met. In other words, ascend the
303-
hierarchy and apply the upward cascade to update at each level.
304-
305-
That concludes processing of the upward cascade.
306383

307384
# Zoom Box Movement Processing Diagrams
308385
These diagrams illustrate the examples in the processing steps, above.
@@ -393,6 +470,110 @@ The first diagram illustrates the starting positions and some sizes.
393470
<img src="MoveProcessing08.svg">
394471
</picture>
395472

473+
474+
475+
# Zoom Box Movement Root Disappearance Prevention
476+
Prevention of disappearance of the root box is a step in zoom box movement
477+
processing, see above.
478+
479+
Disappearance of the root box is prevented by restricting its size and position.
480+
These restrictions are applied.
481+
482+
- The root box has a minimum lateral size (MLS).
483+
- One or more of these conditions must be true, based on the root box's formal
484+
representation.
485+
- The root box is entirely within the zooming area, laterally.
486+
- The zooming area is entirely within the root box, laterally
487+
- A minimum margin amount (MMA) of the root box is laterally within the
488+
zooming area.
489+
490+
Minimum values could be expressed as absolute values, or as formulas based on
491+
the size of the zooming area, or both. MMA could be the same as MLS.
492+
493+
Root disappearance prevention takes place after the root box's size and position
494+
have been updated.
495+
496+
These terms are used with these meanings here.
497+
498+
- There are two zooming area limits in the lateral dimension, the
499+
*positive lateral limit* and the *negative lateral limit*. The positive
500+
lateral limit has a higher value in the lateral dimension than the negative
501+
lateral limit.
502+
503+
In the Dasher Version Six proof-of-concept, for example, the positive
504+
lateral limit is the top of the zooming area and the negative lateral limit
505+
is the bottom.
506+
507+
- There are two zooming area margins in the lateral dimension. Each margin has
508+
a value in the lateral dimension only.
509+
510+
The value of one margin, the *positive lateral margin*, is calculated by
511+
deducting MMA from the positive lateral limit.
512+
513+
The value of the other margin, the *negative lateral margin*, is calculated
514+
by adding MMA to the negative lateral limit.
515+
516+
- Each zoom box has two sides in the lateral dimension. Each side has a
517+
value in the lateral dimension only.
518+
519+
The value of one side, the *positive lateral side*, is calculated by adding
520+
half the box's lateral size to its lateral centre.
521+
522+
The value of the other side, the *negative lateral side*, is calculated by
523+
deducting the box's lateral size from the positive lateral side.
524+
525+
All those defined values are signed numbers.
526+
527+
The distances of the limits and sides from the zooming area origin isn't
528+
relevant to the processing here.
529+
530+
Processing is as follows.
531+
532+
1. Check if the root box's updated lateral size is below MLS. If it is then
533+
override the size to MLS instead.
534+
535+
2. If the root box's lateral size was overridden in the previous step then
536+
override its front position too. Generate the override value by invoking the
537+
solve front position function passing in the new lateral size.
538+
539+
The zooming solver is described elsewhere in the specification, see
540+
[Zooming Solver](../04ZoomingSolver/ZoomingSolver.md).
541+
542+
3. If the positive lateral side has a lower value than the positive lateral
543+
limit, and the negative lateral side has a higher value than the negative
544+
lateral limit, then root disappearance prevention processing is complete and
545+
the remaining steps are skipped.
546+
547+
4. If the positive lateral side has a higher value than the positive lateral
548+
limit, and the negative lateral side has a lower value than the negative
549+
lateral limit, then root disappearance prevention processing is complete and
550+
the remaining steps are skipped.
551+
552+
5. Calculate the root box's positive marginal visibility (PMV) by deducting its
553+
positive lateral side value from the negative lateral margin value. If PMV
554+
is more than zero then the MMA restriction has been broken.
555+
556+
Adjust the root box's position by adding PMV to its lateral centre. That
557+
adjustment will enforce the MMA restriction and the remaining steps are
558+
skipped.
559+
560+
Otherwise, if PMV is less than or equal to zero, continue to the next step.
561+
562+
6. Calculate the root box's negative marginal visibility (NMV) by deducting its
563+
negative lateral side value from the positive lateral margin value. If NMV
564+
is less than zero then the MMA restriction has been broken.
565+
566+
Adjust the root box's position by adding NMV to its lateral centre. That
567+
adjustment will enforce the MMA restriction and the remaining steps are
568+
skipped.
569+
570+
Otherwise, if NMV is greater than or equal to zero, the MMA restriction
571+
hasn't been broken.
572+
573+
574+
575+
576+
396577
# Zoom Box Movement Downward Cascade
397578
Downward cascades are a step in zoom box movement processing, see above.
398579

0 commit comments

Comments
 (0)