STRETCH ​
Stretch the positions and sizes when the object's size changes.
Syntax ​
STRETCH [ on | off ] .
Parameters ​
<main-parameter>
(modifier, optional) - Turns the stretching of all positions and sizeson
oroff
. The default ison
.
Details ​
If an object's size is changed (see resizing), all graphical elements of the object are stretched or compressed geometrically. With the STRETCH
command geometric stretching can be switched off (STRETCH off
) and back on again (STRETCH on
).
Stretching is on by default in a GraphRep.
When stretching is on then all positions and sizes are changed indiscriminately, which can lead to increasing gaps between shapes that should stay the same. It is recommended to also use a TABLE
command and base positions / lengths of other commands on its values. This allows for better control over which parts actually change position or size while others can stay fixed, like the size of rounded corners of a ROUNDRECT
.
See Also ​
Examples ​
Draw a rectangle with two vertical lines inside of it. The object should be asymmetrically resizable. The left vertical line's position and size should be independent of the object's size. The right vertical line should be stretched and compressed as the object's size changes.
GRAPHREP sizing:asymmetrical
# Note: SHADOW is on by default.
FILL color:"white"
RECTANGLE x:0cm y:0cm w:3cm h:2cm
LINE x1:2.25cm y1:0cm x2:2.25cm y2:1cm
STRETCH off
LINE x1:0.75cm y1:0cm x2:0.75cm y2:1cm
Draw a rectangle with a vertical and a horizontal line inside of it. The object should be asymmetrically resizable. The vertical line should be at the fixed distance of 1.3cm from the left. The horizontal line should split the rectangle with an 4 to 6 ratio (40% above and 60% below).
GRAPHREP sizing:asymmetrical
SHADOW off
TABLE w:3cm h:1.6cm cols:2 rows:2
w1:1.3cm w2:100%
h1:40% h2:0.6
STRETCH off
RECTANGLE x:(tabx0) y:(taby0) w:(tabw1 + tabw2) h:(tabh1 + tabh2)
LINE x1:(tabx0) y1:(taby1) x2:(tabx2) y2:(taby1)
LINE x1:(tabx1) y1:(taby0) x2:(tabx1) y2:(taby2)
Versions and Changes ​
Available since ADOxx 1.3