feat: add diagonal arrow from '1' to borrowed 10s box

Draw a diagonal line from the right of the '1' in 'n − 1' down to the
borrowed 10s box below. Arrow shows the flow of the borrowed 1 moving
to become 10 in the next column.

- Line starts at dx: 0.08in (right of '1')
- Line ends at full cell width/height (top of borrowed 10s box)
- Arrowhead (▼) placed at endpoint
- White line/arrow for colored backgrounds, gray for no-color mode
This commit is contained in:
Thomas Hallock
2025-11-08 06:37:45 -06:00
parent 232e1a2221
commit a9319c3bd8

View File

@@ -451,10 +451,25 @@ export function generateSubtractionProblemStackFunction(
box[
#text(size: ${(cellSizePt * 0.25).toFixed(1)}pt, fill: white, stroke: 0.3pt + black, weight: "bold")[#str(original-digit) ]
#text(size: ${(cellSizePt * 0.25).toFixed(1)}pt, fill: white, stroke: 0.3pt + black, weight: "bold")[1]
#h(1pt)
#text(size: ${(cellSizePt * 0.3).toFixed(1)}pt, fill: white, stroke: 0.3pt + black)[→]
]
)
// Draw diagonal arrow from "1" to borrowed 10s box
#place(
top + center,
dx: 0.08in,
dy: 2pt,
line(
start: (0pt, 0pt),
end: (${cellSizeIn}, ${cellSizeIn}),
stroke: (paint: white, thickness: 0.8pt, dash: "solid")
)
)
#place(
top + center,
dx: ${cellSizeIn},
dy: ${cellSizeIn},
text(size: ${(cellSizePt * 0.3).toFixed(1)}pt, fill: white)[▼]
)
]
} else {
box(width: ${cellSizeIn}, height: ${cellSizeIn}, stroke: 0.5pt)[
@@ -464,10 +479,25 @@ export function generateSubtractionProblemStackFunction(
box[
#text(size: ${(cellSizePt * 0.25).toFixed(1)}pt, fill: gray.darken(30%), weight: "bold")[#str(original-digit) ]
#text(size: ${(cellSizePt * 0.25).toFixed(1)}pt, fill: gray.darken(30%), weight: "bold")[1]
#h(1pt)
#text(size: ${(cellSizePt * 0.3).toFixed(1)}pt, fill: gray.darken(30%))[→]
]
)
// Draw diagonal arrow from "1" to borrowed 10s box
#place(
top + center,
dx: 0.08in,
dy: 2pt,
line(
start: (0pt, 0pt),
end: (${cellSizeIn}, ${cellSizeIn}),
stroke: (paint: gray.darken(30%), thickness: 0.8pt, dash: "solid")
)
)
#place(
top + center,
dx: ${cellSizeIn},
dy: ${cellSizeIn},
text(size: ${(cellSizePt * 0.3).toFixed(1)}pt, fill: gray.darken(30%))[▼]
)
]
}
],)