Calligra/Libs/Flake/Connectors

From KDE Community Wiki
< Calligra‎ | Libs‎ | Flake

The goal of connectors is to show a connection of a shape to something else.

Terminology

  • shape
    A shape is a visual representation of some user-data. Be it a text or a spreadsheet or even a vector shape.
  • connector
    is a (curved) line with zero, one or two arrowheads which can be connected to predefined positions on a shape. You can connect a maximum of 2 shapes with a connector.

Note; all KOffice applications will use connections.

Workflow

The following have been designed with the input of the kde-usability people (ellen).

Creating a connection

User selects the curved connector from the connection tool and can draw a connection by clicking or dragging on any shapes connectors.  All shapes can have zero or more connectors and moving over a shape will show them.

Moving connected objects around

The 'pointer' tool (default tool) allows you to move any type of shape around. The basic shape has position and rotation etc which is what the default tool will alter to do its job.

Moving a connected shape should not sever the connection. So the connection would stretch but never break. Only when you remove a shape from the canvas will the connection break.

Removing a connection

Using either the default tool or the connection tool, the user clicks a connection and deletes it.

Technical Restraints

Constraint: A connector can't be transformed (rotated etc)
Solution: Don't make it a shape as users can then select them and we need exceptions in a lot of places in flake.

Constraint: A connector has a start and end point that is relative to the connector point of another shape.
Solution: Make sure a connection is not a shape as that would require the ugly effect of altering multiple shapes whenever a connected shape is moved/rotated etc. Instead, make it a special object that the shapeManager or a ShapeConnectionManager can update and re-layout. Additional advantage of using a ShapeConnectionManager is that we can take multiple connetions into account when rerouting the connection-lines so they will not interfer to much with each other.

Constraint: A connector can be a direct line, something build from line-segments, and a curve.
Solution: Have a connector object with a the vector curves from flake that can be drawn according to spec. Maybe we can just wrap a KoPathShape as as is?