The goal of dragging is to set the position of a dragged component or components. Rules-based behaviors around that movement is what distinguishes drag and drop in kBridge from its far less intelligent operations in most other user interfaces.
A Connector is a collection of data for handling one side of Connection. A connector has a name (a string), a localTransform, and a set of key-polarity pairs (array of {string, enum}).
A Connection is created when two connectors are matched. The pair is said to be mated.
A Connector is consumed when it is mated. Once a connector is consumed, it cannot match any other connector until it is no longer mated.
A component is a rigid body and may contain any number of Connectors.
The name of a connector is arbitrary, but must be unique per component, and is case-insensitive.
The localTransform of a connector is the transform relative to the component’s positioning Frame.
The mate is created when the moving component’s position is determined by the mating pair of transforms.
A Drag Session is the period of time from the start of a drag to the end of the drag.
A Key pair is a name and a polarity. Keys match when their names are the same, and their polarities are compatible. There are two ways for polarities to be compatible, though there may be other types in the future.
1.When their polarities are opposite
2.When both sides are neutral.
Using plug/socket terminology, a compatible pair is a plug that can be mated to a socket, a socket that can be mated to a plug, or a neutral that can be mated to a neutral.
Consider the pair of similar, but different sections of the Brio® child"s toy* track shown above. Each has 4 connectors. The upper left has 3 sockets and one plug, and the lower right has 3 plugs and one socket. A socket can only mate to a plug, and vice versa. This concept is common in many mating parts, where one fits the other in one way only.
When A is dragged, its single plug at the bottom matches the single socket at the top of B. In addition, A"s 3 sockets all match B"s 3 plugs. There are thus 1 + 3 x 3 = 10 possible matches. If B is dragged and A fixed, the same combinations are possible.
_______________
*Brio is a registered trademark of BRIO AB (Malmĝ, Sweden), a brand of Ravensburger AG (Ravensburg, Germany)