|
|
|
@ -24,14 +24,21 @@ enum Error {
|
|
|
|
|
Template(askama::Error),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn positions(size: SVGMeasure, padding: SVGMeasure, dimensions: &DocumentDimensions, count: u32) -> Vec<(SVGMeasure, SVGMeasure)> {
|
|
|
|
|
fn positions(
|
|
|
|
|
size: SVGMeasure,
|
|
|
|
|
padding: SVGMeasure,
|
|
|
|
|
dimensions: &DocumentDimensions,
|
|
|
|
|
count: u32,
|
|
|
|
|
) -> Vec<(SVGMeasure, SVGMeasure)> {
|
|
|
|
|
let grid = size + padding;
|
|
|
|
|
let row_count = ((dimensions.width - padding * 2.0) / grid) as u32;
|
|
|
|
|
(0..count)
|
|
|
|
|
.map(|i| (
|
|
|
|
|
grid * (i % row_count).into() + padding,
|
|
|
|
|
grid * (i / row_count).into() + padding,
|
|
|
|
|
))
|
|
|
|
|
.map(|i| {
|
|
|
|
|
(
|
|
|
|
|
grid * (i % row_count).into() + padding,
|
|
|
|
|
grid * (i / row_count).into() + padding,
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
.collect()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|