Skip to content

3.2 Point

amaliejvik edited this page Aug 5, 2024 · 7 revisions

Point

Note that point may also be passed as a position to some components as it is considered an InputPosition

Extends:

Implements:

Parameters:

Required:

  • x: number X position of the point
  • y: number Y position of the point

Optional:

  • label?: boolean Whether or not to display the point's current position beside it.
  • decimals?: number Number of decimals to include in the label.
  • color?: string Color of the main part of the point.
  • draggable?: Draggable Whether the point should be draggable.
  • dragListeners?: ((point: Point) => void)[] Initial dragListeners that can be added upon construction of the point.
  • customName?: string Give point a custom name, if none given, defaults to A,B,C...
  • showName?: string Whether or not to display the point's name beside it
  • legendCoordinates?: string Which coordinates of the point that will be displayed in the LegendBox ("x" for only x-coordinates, "y" for only y-coordinates). Defaults to both x and y being shown.

Default Parameters:

  color: "#FAA307",
  draggable: undefined,
  decimals: 1,
  label: false,
  dragListeners: [],
  showName: true,
  legendCoordinates: "", (both x and y coordinates displayed)


Implemented Methods:

  • addDragListener(listener: (point: Point) => void) Adds a draglistener to the point. The parameter of the listenerfunction takes in a reference to the instance of the point the listener is attached to.
  • collidesWith(other: Object3D): boolean
  • distanceTo(other: Object3D<Event>): number
  • getName(): string
  • getDisplayText(): string
  • hover(): void
  • unhover(): void

Methods

  • setPosition(x: number, y: number): Sets position of the point to specified coordinates.
Clone this wiki locally