Dizmo coordinate system
Dizmo coordinate system
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 it. Rotation is applied clockwise around the upper left corner.
Absolute and relative geometry
When dizmos are placed on top of each other, the child dizmos geometry becomes relative to its parent. This means that the child’s attributes
geometry/y are relative to the parent dizmo. A dizmo placed on the top-left of its parent will have the
geometrx/y attribute set to 0.
If you want to find out the dizmos absolute position in relation to the workspace, use the attributes
geometry/height attributes are the original values, regardless of any zoom and/or rotation or if the dizmo is placed on the workspace or on another dizmo.
If you want to find out the absolute size of a dizmo, with zoom and rotation taken into account, use the
absolutegeometry/zoom attributes are the same.
Size and position
A dizmo can have a size between 50 (height) or 65 (width) 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);
Note: When changing the x coordinate first, this might give the dizmo a new parent that imposes a new geometry on the dizmo moved. 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. This is why changing multiple parameters of the geometry of a dizmo should be done using the
endAttributeUpdate functions to make sure the changes are handled as one transaction. For dizmoViewer this means
endAttributeUpdate must not only fire any subscriptions held back during the transaction but it must also 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.