Make a a dizmo stickz and lock it

As described in the chapter Hierarchies, the user can arrange dizmos in hierarchies by placing dizmos on top of each other. The user can also arrange dizmos vertically and horizontally in a spatial order.

To not move a dizmo by accident, the user can make a dizmo sticky in the dizmo settings. Additionally, to not modify a dizmo by accident, the user can lock a dizmo in the dizmo settings.

Make a dizmo sticky

To make a dizmo sticky in the UI, press the cogwheel that signifies dizmo settings. The cogwheel is found in the upper right corner of a dizmo. After, press "Sticky".

Sticky
Sticky

Once a dizmo is sticky, it always keeps its position relative to the four corners of dizmoViewer. Even if the user zooms out of dizmoViewer, drags it around or resizes it, the sticky dizmo always remains in the same spot.

You can specify that your dizmo is set with a sticky flag so that it always remains on the spot:

dizmo.setAttribute('state/sticky', true);

Remember that when a dizmo is set to be sticky, arguments have to be passed on for the geometry:

dizmo.setAttribute("stickyGeometry/angle", value);
dizmo.setAttribute("stickyGeometry/x", value);
dizmo.setAttribute("stickyGeometry/y", value);
dizmo.setAttribute("stickyGeometry/zoom", value);

Sticky geometry and UI controls

The UI controls are the cogwheel, keyboard, creator, and zoom buttons a user may use in the dizmo workspace. The location of the UI controls can be addressed in sticky geometry using the pixel information from the following sub-sections (pseudocode):

Cogwheel button

x = width - ((zoom=1.0)*(center-x=19px) + (margin-right=11px)) y = height - ((zoom=1.0)*(center-y=19px) + (margin-bottom=11px)) radius = (zoom=1.0)*(radius=19px)

Keyboard button

x = width/2.0 + ((zoom=1.0)*(center-x=66.5) + (margin-right=0)) y = height - ((zoom=1.0)*(center-y=19px) + (margin-bottom=11px)) radius = (zoom=1.0)*(radius=19px)

Creator button

x = width/2.0 - ((zoom=1.0)*(center-x=66.5) + (margin-right=0)) y = height - ((zoom=1.0)*(center-y=19px) + (margin-bottom=11px)) radius = (zoom=1.0)*(radius=19px)

Width, height, and zoom

The value width is by default the width of the dizmoViewer window. The value of height is by default the height of it. The value of zoom=1.0 is also the default. However, the value of zoom can be made adaptive with:

var scale = parseFloat(
    ViewerCore.getProperty('/viewer/attributes/settings/uiscaling'));
var dpi = parseFloat(
    ViewerCore.getProperty('/viewer/attributes/system/logicaldpi'));

var zoom = scale * dpi / 96.0;

Lock a dizmo

To lock dizmo in the UI, press the cogwheel that signifies dizmo settings. The cogwheel is found in the upper right corner of a dizmo. After, press "Lock".

Lock a dizmo
Lock a dizmo

When a dizmo is locked, it can not be dragged around and it can not be modified by the user. As illustrated in the picture below, the settings then show that the dizmo is locked. A dizmo can be unlocked by the user clicking on "Lock". In this state, it is the only available item in settings. After, the user can access the other items in settings and modify the dizmo again.

Locked dizmo
Locked dizmo

You can set your dizmo to locked:

dizmo.setAttribute('state/locked', true);