Skip to content

The Rectangle Ex(tended) tool

1.0.0 · Output

The RectEx tool is based on the SVG basic <path>element shape.

The RectEx tool lets you define the radius for each corner, where the Rectangle tool lets you specify a single radius for all corners.

The rectex might replace the rectangle tool in the future...

Basic usage

The RectEx tool needs a center position, height, and width. You can specify a corner radius for each corner, or pair of corners.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
- type: 'rectex'            # tooltype is 'rectex'
  position:                 # Position on (100x100) canvas
    cx: 50                  # cx=50 is center position
    cy: 50                  # cy=50 is center position
    height: 75              # height of 75
    width: 100              # width of 100
    radius:
      all: 0                # corner radius: square
    # per side options:
      top: 2
      left: 2
      right: 2
      bottom: 2
    # per corner options:
      top_left: 2
      top_right: 2
      bottom_left: 2
      bottom_right: 2
  styles:
    rectex:
      stroke-width: 2       # width of stroke. 0 = no stroke.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
- type: 'rectex'            # tooltype is 'rectex'
  position:                 # Position on (100x100) canvas
    cx: 50                  # cx=50 is center position
    cy: 50                  # cy=50 is center position
    height: 75              # height of 75
    width: 100              # width of 100
    radius:
      all: 0                # corner radius: square
  entity_index: 0           # connect to state of entity 0
  styles:
    rectex:
      stroke-width: 2       # width of stroke. 0 = no stroke.

Styling

The RectEx tool has support for the following forms of styling:

Method Support Description
classes Using SAK or User defined class definitions
styles Using inline SVG and CSS styles

The RectEx tool is composed of a single object: "rectex" and this is the selector for styling:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
- type: 'rectex'
  position:
    cx: 50
    cy: 50
    height: 75              # height of 75
    width: 100              # width of 100
    radius:
      all: 0                # corner radius: square
  classes:
    rectex:                 # RectEx selector
      <...>
  styles:
    rectex:                 # RectEx selector
      <...>
Populair properties:

Property Does what? Example
fill Fill color fill: red sets fill to color red
stroke-width Stroke width stroke-width: 2em sets width to relative width of 2em
stroke Stroke color stroke: blue sets stroke to blue
opacity Opacity (stroke/fill) opacity: 0.7 sets the opacity of rect to 70%
fill-opacity Opacity for fill fill-opacity: 0.5 sets the fill opacity to 50%
stroke-opacity Opacity for stroke stroke-opacity: 0.5 sets the stroke opacity to 50%

Haptics

The tool supports haptic feedback through user_actions/ tap_action definition

Action Haptic Description
Click haptic Uses the haptic property defined in the user_actions definition of the tool. If not specified, a default of medium is used
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  tools:
    - type: icon
      position:
        cx: 10
        cy: 10
        align: center
        icon_size: 15
      entity_index: 0
      user_actions:
        tap_action:
          haptic: success
          actions:
            - action: more-info

Possible values for haptic feedback:

Haptic Description
success Indicates that a task or action has completed.
warning Indicates that a task or action has produced a warning of some kind.
failure Indicates that a task or action has failed.
light Provides a physical metaphor that complements the visual experience.
medium Provides a physical metaphor that complements the visual experience.
heavy Provides a physical metaphor that complements the visual experience.
selection Indicates that the selection is actively changing.

Animations

The RectEx tool has support for the following forms of animations:

Method Support Description
colorstops List of state values to set the color
colorlists Using a colorlist definition
animations Operator state based animations with class/style styling

The use of animations require the tool to be connected to an entity