API Docs for: 2.7.3
Show:

wnp.Symbols2D Class

Module: Helpers
Parent Module: Wanaplan

Draw methods for standard 2D symbols

Constructor

wnp.Symbols2D

(
  • core
)

Parameters:

  • core Core

    The main engine.

Methods

_drawAllSymbols

(
  • ctx
)
private

Debug function to draw all symbols

Parameters:

drawAngle

(
  • ctx
  • pos
  • [zoom=1]
  • radius
  • angle0
  • angle1
  • clockwise
)

Draws an angle.

Parameters:

  • ctx CanvasRenderingContext2D

    The context.

  • pos Object

    Position {x: ?, y: ?}.

  • [zoom=1] Number optional

    The zoom level. Not taken into account for now.

  • radius Number

    Radius of the arc symbol.

  • angle0 Number

    Angle 0, based on the x-axis.

  • angle1 Number

    Angle 1, based on the x-axis.

  • clockwise Boolean

    Direction of the arc.

drawArc

(
  • ctx
  • point1
  • cp
  • point2
)

Draws an arc set by a control point.

Parameters:

  • ctx CanvasRenderingContext2D

    The context.

  • point1 Object

    Position of the first point {x: ?, y: ?}.

  • cp Object

    Position of the control point {x: ?, y: ?}.

  • point2 Object

    Position of the second point {x: ?, y: ?}.

drawArrows

(
  • ctx
  • pos
  • arrows
  • distance
  • angle
)
private

Draws arrows.

Parameters:

  • ctx CanvasRenderingContext2D

    The canvas' context.

  • pos Object

    Position {x: ?, y: ?}.

  • arrows Array

    List of arrows to draw [up, left, down, right]`.

  • distance Number

    Distance des flèches par rapport au centre définit par pos.

  • angle Number

    (optionnel) Rotation angle.

drawCancelGrip

(
  • ctx
  • pos
  • arrows
  • [angle=0]
)

Draws a grip with a cancel icon at the end.

Parameters:

drawCheckGrip

(
  • ctx
  • pos
  • arrows
  • [angle=0]
)

Draws a grip with a check icon at the end.

Parameters:

drawCursorCheck

(
  • ctx
  • pos
)

Draws a check icon.

Parameters:

drawGrip

(
  • ctx
  • pos
  • arrows
  • [angle=0]
)

Draws a grip.

Parameters:

drawGripSegment

(
  • ctx
  • point1
  • point2
  • arrows
  • arrows
  • [angle=0]
)

Draws a segment with grips.

Parameters:

  • ctx CanvasRenderingContext2D

    The context.

  • point1 Object

    Position of the first point {x: ?, y: ?}.

  • point2 Object

    Position of the second point {x: ?, y: ?}.

  • arrows Array

    List of arrows to draw for the first grip [up, left, down, right]`.

  • arrows Array

    List of arrows to draw for the second grip [up, left, down, right]`.

  • [angle=0] Number optional

    Rotation.

drawMeasure

(
  • ctx
  • point1
  • point2
  • text
  • [color=wnp.Symbols2D.COLOR_ANNOTATION]
)

Draws a measure.

Parameters:

  • ctx CanvasRenderingContext2D

    The context.

  • point1 Object

    Position of the first point {x: ?, y: ?}.

  • point2 Object

    Position of the second point {x: ?, y: ?}.

  • text String

    Text displayed at the center of the measure.

  • [color=wnp.Symbols2D.COLOR_ANNOTATION] String optional

    Color.

drawPoint

(
  • ctx
  • pos
)

Draws a simple point.

Parameters:

drawPointHover

(
  • ctx
  • pos
  • [zoom=1]
)

Draws a point when it is hovered.

Parameters:

drawSegment

(
  • ctx
  • point1
  • point2
)

Draws a segment.

Parameters:

Properties

COLOR_ACTIVE_FILL

String

COLOR_ACTIVE_FILL

Default: "rgba(137, 184, 8, 0.2)"

COLOR_ACTIVE_LARGEZONE_FILL

String

COLOR_ACTIVE_LARGEZONE_FILL

Default: "rgba(137, 137, 137, 0.5)"

COLOR_ACTIVE_STROKE

String

COLOR_ACTIVE_STROKE

Default: "#89B808"

COLOR_ACTIVE_STROKE_DARKER

String

COLOR_ACTIVE_STROKE_DARKER

Default: "#6C9104"

COLOR_ANNOTATION

String

COLOR_ANNOTATION

Default: "#888"

COLOR_BACKGROUND

String

COLOR_BACKGROUND

Default: "#FAFAFA"

COLOR_INACTIVE_FILL

String

COLOR_INACTIVE_FILL

Default: "rgba(90, 119, 119, 0.1)"

COLOR_INACTIVE_STROKE

String

COLOR_INACTIVE_STROKE

Default: "#777777"