Most likely an application would use JsDiagram to let users interactively create diagrams, flowcharts and other kinds of presentation documents. A user composes or edits a diagram by drawing its elements on the JsDiagram canvas area. With the help of a mouse or another pointing device users draw shapes, tables and links, possibly connecting them in complex hierarchies, graphs, trees or other structures they might need.
New items can be created by drawing them with the mouse. While a user drags the mouse, the view of the control is updated to show what the new item would look like at the pointer location. If the operation cannot be completed at the current mouse position, the cursor changes to a crossed out circle. When the user releases the button, the item is created. By default links can be drawn only between nodes, unless the allowUnconnectedLinks property is enabled. Users can cancel item creation by pressing the right mouse button while drawing.
An alternative method for users to create new nodes is drag-and-drop from the NodeListView control. Nodes in the NodeListView are used as prototypes and are cloned when dropped on the diagram canvas.
A user modifies an item by dragging its adjustment handles. The modificationStart property specifies when these handles appear. The first option, AutoHandles, makes the handles appear when the mouse hovers over an item; modification of the item can start immediately by pointing it and dragging a handle. The second option is SelectedOnly: in order to be modified, an item should first be selected. Adjustment handles appear around the item to indicate that now it can be moved or resized. Number and functionality of those handles depend on the item type and the value of the corresponding handlesStyle property.
By default nodes display nine adjustment handles. The one at the center can be used to move the node. When dragged, each corner handle resizes the node by moving the two edges adjacent to the corresponding corner. The edge handles placed at the center of each side can be used to resize a node either horizontally or vertically. Shape nodes can be rotated using an additional round handle drawn above them. Each handle can be enabled or disabled by setting or clearing the respective bit in enabledHandles.
Variety and behavior of link adjustment handles depend on the link's shape and segmentCount. Control-points stay at both ends of each segment that constitutes a link. MindFusion.Diagramming for JavaScript offers several link styles. Following sections discuss how to modify links of each style.
Multiple items are selected by dragging while CTRL key is down. Selection can also be toggled with CTRL + clicking an item. A rectangle appears around selected items, allowing a user to move all of them at once.
Mouse operations can be interpreted in different ways depending on the value of the behavior property. It defines whether for example dragging the mouse creates a node or selects existing items. Check the property description for more information.