| Did you know ... | Search Documentation: |
| Graphical relation |
Using spatials
The example below opens a picture object with two box objects that are related though a spatial object. Both boxes may be resized and moved. The spatial object ensures B1 is twice as large as B2, centered in X-direction and 10 pixels above B2.
spatial_demo :-
new(G, handler_group(resize_gesture(left),
move_gesture(left))),
new(P, picture('Spatial Demo')),
send(P, display, new(B1, box(100,100))),
send(P, display, new(B2, box(50,50))),
send_list([B1, B2], recogniser, G),
new(_, constraint(B1, B2,
spatial(xref = x+w/2, yref = y+h,
xref = x+w/2, yref = y-10,
w = w2*2, h = h2*2))),
send(P, open).
% Start the demo
:- spatial_demo.