The coordinate system of the dizmoViewer has an x
and y
range from -3000 to 3000
with 0/0
being in the center of the workspace. The position of a dizmo is relative to the upper left corner of the workspace. Rotation is applied clockwise around the upper left corner.
When dizmos are placed on top of each other, the child dizmo's geometry becomes relative to its parent. This means that the child’s attributes geometry/x
and geometry/y
are relative to the parent dizmo. A dizmo placed on the top-left of its parent will have the geometry/x
and geometrx/y
attribute set to 0.
A dizmo's absolute position in the workplace is revealed by the attributes absolutegeometry/x
and absolutegeometrx/y
.
The original width and height values of a dizmo are set with the geometry/width
and geometry/height
attributes. They do not take into account any zoom and/or rotation or if the dizmo is placed on the workspace or another dizmo.
A dizmo's absolute width, height, zoom and angle can be accessed using the absolutegeometry/width
, absolutegeometry/height
, absolutegeometry/angle
and absolutegeometry/zoom
attributes. These attributes take into account the zoom and rotation of parent dizmos.
A dizmo can have a height between 50 and 4000 pixels. It can have a width between 65 and 4000 pixels. The height of the dizmo does not include the title bar.
The front and back of a dizmo can have different sizes. The settings side of a dizmo is used to display settings, short explanations, and secondary features.
You have a choice of several dizmo objects methods for changing the size and position of the dizmo.
// move the dizmo to x = 200 and y = 300
dizmo.setPosition(200,300);
// resize the dizmo to width = 400 and height= 500
dizmo.setSize(400,500);
// do both of the above in one step
dizmo.setPositionAndSize(200,300,400,500);
Changing both x and y geometry parameters of a dizmo should be done using the beginAttributeUpdate
and endAttributeUpdate
functions. This is to make sure the changes are handled as one transaction. This is because if the x coordinate of a dizmo is changed first, the dizmo might be given a new parent that imposes a new geometry onto the dizmo. This means that setting the y coordinate in a second setAttribute call will have an unexpected effect based on the new (temporary) coordinate system coming form the new parent.
For dizmoViewer, this means endAttributeUpdate
must fire subscriptions held back during the transaction and update the parent after a transaction.
dizmo.beginAttributeUpdate("geometry");
dizmo.setAttribute("geometry/x",400);
dizmo.setAttribute("geometry/y",600);
dizmo.endAttributeUpdate("geometry");
You can allow size changes with the attribute: dizmo.setAttribute("settings/usercontrols/allowResize", true);
. If resizing is set to true, you will see a triangle in the lower right hand corner of your dizmo.