Displace Action

The displace action is used to handle the displace of items

This action takes as input a DisplaceActionData instance that has the following properties:

Property Description
elementsToDisplace it is an array in which we specify the items to displace: by default the user can use the visualizer selection property that lists the selected items in the Visualizer or Diagrammer
changeModeKey it is a uint used to specify the keyboard key used to activate the displace action. By default it is set to KeyBoard.SHIFT
changeScopeMode controlling changing mode of the displaced items scope. According to the value, items can be moved from a container (group, table or the visualizer) to another one or not. This property has three possible values
  • DisplaceActionData.NONE_MODE: No scope change is allowed;
  • DisplaceActionData.DEFAULT_MODE: Scope will be changed (unless the changeModeKey is pressed and useMonoMode is true);
  • DisplaceActionData.ON_KEY_MODE: Scope will not be changed (unless the changeModeKey is pressed and useMonoMode is true).
useMonoMode used to modify the scope change behavior when the changeModeKey is pressed
strictBoundingBoxUpdate used to specify if the items should be fit to their container (group or table)
snapParam It Holds parameters controlling snap directives when displacing the nodes (snap options for node according to its neighbours position)
routingParam It Holds parameters controlling routing directives when displacing the nodes (routing options and links overlapping-avoid directives).
borderParam It Holds parameters controlling border directives when displacing the nodes (displacing options when nodes reach Visualiser borders).
deactivateOnRollOut It controls displace operation status (end or maintain) when a Roll out event is triggered on the Visualizer.

The following code shows how the user can activate the DisplaceAction with its own parameters :

function activateDisplaceAction(changeScopeMode:String):void
{
	var data:DisplaceActionData = new DisplaceActionData();
	var snapParam:SnapParam = new SnapParam();
	snapParam.useSnapLineTool = useSnapLines.selected;
	data.snapParam = snapParam;
	data.useMonoMode = false;
	data.elementsToDisplace = visualizer.selection; //The user can choose his own elements
	switch(changeScopeMode)
	{
		case 'none': 
			data.changeScopeMode = 'none'
			break;
		case 'default': 
			data.changeScopeMode = 'default'
			break;	
		case 'onKey': 0
			data.changeScopeMode = 'onKey'
			break;
	}
	visualizer.activateAction(DisplaceAction.ID,data);
	visualizer.updateAction(DisplaceAction.ID,data);
}