Skip to content

4.4 LegendBox

amaliejvik edited this page Jul 3, 2024 · 7 revisions

LegendBox

A sticky box located in the upper left corner that displays an overview of which components are present in the scene in Latex. Can be collapsed into a small square, and then extended again by clicking the arrow icons.

When hovering over elements of type Plot, Point and Circle in the LegendBox, the corresponding Components in the scene are highlighted. Specific hover-functionality and which information is displayed for specific components can easily be modified further.

The following information is currently configured to be displayed for the given element types:

  • Plots: <Plot name> : <Plot expression>
  • Points: <Point name> : (x,y)
  • Stat variables: <State name> : <State value>
  • String: <String with state variables> : <String where state variables are replaced with actual current state values>
  • Remaining components: <Component ClassName>
Skjermbilde 2024-07-03 kl  15 05 11

Extends:

  • none

Implements:

Parameters:

Required:

  • none

Optional:

  • elements?: (Component | String | State<number>)[] A list of elements linked to the LegendBox. These are the elements that will be displayed in the LegendBox itself.

Default Parameters:

elements: []

Implemented Methods:

  • none

Methods

  • addElement(element: Component | String | State<number>) Adds an element to the LegendBox elements list

Usage:

Example #1 - Initialize with a list of elements

Skjermbilde 2024-07-03 kl  14 37 38

Example #2 - Initialize without elements

Skjermbilde 2024-07-03 kl  14 36 17

Example #3 - A complete usage example

Skjermbilde 2024-07-03 kl  14 50 51
Clone this wiki locally