Centering edges over composites
by Hernán Morales Durand
Hi,
When connecting two composite shapes with RTEdgeBuilder, the connector
position loose its center over the connecting shapes.
It's easier to explain with two scripts:
This one looks good, the connector (RTArrowedLine) is centered:
| view shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shapes := (RTSVGPath new
path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C 22.489583,23.8125
17.197917,34.395833 3.96875,27.78125 Z';
fillColor: Color red;
borderColor: Color black;
borderWidth: 1.2;
scale: 1.4) elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
view: view;
shape: (RTArrowedLine new
color: Color white;
yourself);
elements: shapes;
connectFrom: 1 to: 2.
RTTreeLayout new
verticalGap: 30;
horizontalGap: 30;
applyOn: shapes.
view inspect.
However when adding a label in a composite, both label and arrow looks shifted:
| view shape shapes myElems |
view := RTView new.
myElems := 1 to: 2.
shape := RTCompositeShape new
add: (RTLabel new text: 'Test');
add: (RTSVGPath new
path: 'm 3.96875,9.2604167 h 31.75 V 25.135417 C
22.489583,23.8125 17.197917,34.395833 3.96875,27.78125 Z';
fillColor: Color red;
borderColor: Color black;
borderWidth: 1.2;
scale: 1.4);
vertical;
yourself.
shapes := shape elementsOn: myElems.
view addAll: shapes.
RTEdgeBuilder new
view: view;
shape: (RTArrowedLine new
color: Color white;
yourself);
elements: shapes;
connectFrom: 1 to: 2.
RTTreeLayout new
verticalGap: 30;
horizontalGap: 30;
applyOn: shapes.
view inspect.
Any idea how to align these shapes?
Cheers,
Hernán
4 years, 9 months