getCanvas(id).settings.add( x, y, element )
getCanvas(id).settings.add( "left at x", "top at y", element ) (since PennController 1.1)
getCanvas(id).settings.add( "center at x", "middle at y", element ) (since PennController 1.1)
getCanvas(id).settings.add( "right at x", "bottom at y", element ) (since PennController 1.1)
element onto the canvas at the coordinates (
Note that you do not need to call print on the added element: it will be printed along with the canvas.
Note also that if you pass an element that was already added to the page before, the element will be moved from its original location on the page to the specified coordinates on the canvas, leaving no blank space at the original location. In the particular case where the element was on the canvas before, the result appears as a simple update of its coordinates on the surface.
newImage("square", "square.png") .settings.size(50, 50) , newCanvas("shape", 200, 200) .settings.center() .settings.add( 0, 0, newText("description","This is a square") ) .settings.add( "center at 50%", "middle at 50%", getImage("square") ) .print()
<div> surface of size 200x200px to the horizontal center of the page and places a description This is a square at its top-left corner and a 50x50px image of
square.png centered horizontally and vertically onto the surface.