Allow for fitting paths into a given bounding rectangle

... by applying a transformation. This allows designing a path in some
other path design tool and then make it fit using bindings.
This commit is contained in:
Simon Hausmann 2020-07-13 15:38:56 +02:00
parent 79ba943882
commit 992f990fa8
12 changed files with 162 additions and 36 deletions

50
tests/cases/path_fit.60 Normal file
View file

@ -0,0 +1,50 @@
TestCase := Rectangle {
Text {
text: "The path and the items below should both fit into the red rectangle";
color: black;
}
fit_rect := Rectangle {
x: 0;
y: 100;
color: red;
width: 700;
height: 500;
Path {
x: 0;
y: 0;
width: fit_rect.width;
height: fit_rect.height;
commands: "M 100 300 Q 150 50 1100 400 Q 1450 500 750 500 Q 1000 600 950 600 C 325 575 350 450 150 550 Q 0 600 100 800 C 250 850 300 600 550 850 C 800 850 850 650 2000 700 ";
stroke_color: black;
stroke_width: 2;
}
PathLayout {
x: 0;
y: 0;
width: fit_rect.width;
height: fit_rect.height;
commands: "M 100 300 Q 150 50 1100 400 Q 1450 500 750 500 Q 1000 600 950 600 C 325 575 350 450 150 550 Q 0 600 100 800 C 250 850 300 600 550 850 C 800 850 850 650 2000 700 ";
Text {
text: "First item";
color: black;
}
Text {
text: "Second item";
color: black;
}
Text {
text: "Third item";
color: black;
}
}
}
}