Header menu logo issie

DrawHelpers Module

Types

Type Description

Circle

Record to help draw SVG circles

Line

Record tonhelp draw SVG lines

MouseOp

MouseT

Path

Record to help create SVG paths (for wire segment jumps ONLY)

Polygon

Record to help create SVG polygons

PortLocation

Text

Record to help create SVG text

Functions and values

Function or value Description

boxesIntersect box1 box2

Full Usage: boxesIntersect box1 box2

Parameters:
Returns: bool

Calculates if two bounding boxes intersect by comparing corner coordinates of each box

box1 : BoundingBox
box2 : BoundingBox
Returns: bool

canvasWidthContext

Full Usage: canvasWidthContext

Returns: CanvasRenderingContext2D
Returns: CanvasRenderingContext2D

cornerCircle

Full Usage: cornerCircle

Returns: Circle

HLP23 AUTHOR: BRYAN TAN Custom component corner circle

Returns: Circle

defaultCircle

Full Usage: defaultCircle

Returns: Circle

Default circle, change this one to create new circles

Returns: Circle

defaultLine

Full Usage: defaultLine

Returns: Line

Default line, change this one to create new lines

Returns: Line

defaultPath

Full Usage: defaultPath

Returns: Path

Default path, change this one to create new paths

Returns: Path

defaultPolygon

Full Usage: defaultPolygon

Returns: Polygon

Default polygon, change this one to create new polygons

Returns: Polygon

defaultText

Full Usage: defaultText

Returns: Text

Default text, change this to create new text types

Returns: Text

getColorString col

Full Usage: getColorString col

Parameters:
Returns: string

deliver string suitable for HTML color from a HighlightColor type value

col : HighLightColor
Returns: string

getTextWidthInPixels font txt

Full Usage: getTextWidthInPixels font txt

Parameters:
    font : Text
    txt : string

Returns: float

To get this to work, note the fonts in the playground.fs test which work well. Add fonts there to test if you like.

font : Text
txt : string
Returns: float

makeAnyPath startingPoint pathAttr pathParameters

Full Usage: makeAnyPath startingPoint pathAttr pathParameters

Parameters:
    startingPoint : XYPos
    pathAttr : string
    pathParameters : Path

Returns: ReactElement
 Makes a path ReactElement, points are to be given as an XYPos record element.
 Please note that this function is designed to create ONLY "Move to - Bézier Curve"
paths (this is what the "M" and "C" attributes stand for) and NOT a generalized SVG path element.
startingPoint : XYPos
pathAttr : string
pathParameters : Path
Returns: ReactElement

makeArcAttr r

Full Usage: makeArcAttr r

Parameters:
    r : float

Returns: string

Makes path attributes for a horizontal upwards-pointing arc radius r

r : float
Returns: string

makeCircle centreX centreY circleParameters

Full Usage: makeCircle centreX centreY circleParameters

Parameters:
    centreX : float
    centreY : float
    circleParameters : Circle

Returns: ReactElement

Makes a circle ReactElement

centreX : float
centreY : float
circleParameters : Circle
Returns: ReactElement

makeLine x1 y1 x2 y2 lineParameters

Full Usage: makeLine x1 y1 x2 y2 lineParameters

Parameters:
    x1 : 'a
    y1 : 'b
    x2 : 'c
    y2 : 'd
    lineParameters : Line

Returns: ReactElement

Makes a line ReactElement, wildcard inputs as position can be a number or a string

x1 : 'a
y1 : 'b
x2 : 'c
y2 : 'd
lineParameters : Line
Returns: ReactElement

makeLineAttr dx dy

Full Usage: makeLineAttr dx dy

Parameters:
    dx : float
    dy : float

Returns: string

makes a line segment offset dx,dy

dx : float
dy : float
Returns: string

makePartArcAttr r h1 d1 h2 d2

Full Usage: makePartArcAttr r h1 d1 h2 d2

Parameters:
    r : float
    h1 : float
    d1 : float
    h2 : float
    d2 : float

Returns: string

Makes a partial arc radius d, heights h1,h2 at ends, distance d1,d2 to centre from ends horizontally

r : float
h1 : float
d1 : float
h2 : float
d2 : float
Returns: string

makePath startingPoint startingControlPoint endingControlPoint endingPoint pathParameters

Full Usage: makePath startingPoint startingControlPoint endingControlPoint endingPoint pathParameters

Parameters:
    startingPoint : XYPos
    startingControlPoint : XYPos
    endingControlPoint : XYPos
    endingPoint : XYPos
    pathParameters : Path

Returns: ReactElement
 Makes a path ReactElement, points are to be given as an XYPos record element.
 Please note that this function is designed to create ONLY "Move to - Bézier Curve"
paths (this is what the "M" and "C" attributes stand for) and NOT a generalized SVG path element.
startingPoint : XYPos
startingControlPoint : XYPos
endingControlPoint : XYPos
endingPoint : XYPos
pathParameters : Path
Returns: ReactElement

makePathAttr startingControlPoint endingControlPoint endingPoint

Full Usage: makePathAttr startingControlPoint endingControlPoint endingPoint

Parameters:
    startingControlPoint : XYPos
    endingControlPoint : XYPos
    endingPoint : XYPos

Returns: string
startingControlPoint : XYPos
endingControlPoint : XYPos
endingPoint : XYPos
Returns: string

makePathFromAttr attr pathParameters

Full Usage: makePathFromAttr attr pathParameters

Parameters:
    attr : string
    pathParameters : Path

Returns: ReactElement
attr : string
pathParameters : Path
Returns: ReactElement

makePolygon points polygonParameters

Full Usage: makePolygon points polygonParameters

Parameters:
    points : string
    polygonParameters : Polygon

Returns: ReactElement

Makes a polygon ReactElement, points are to be given as a correctly formatted SVGAttr.Points string

points : string
polygonParameters : Polygon
Returns: ReactElement

makeText posX posY displayedText textParameters

Full Usage: makeText posX posY displayedText textParameters

Parameters:
    posX : float
    posY : float
    displayedText : string
    textParameters : Text

Returns: ReactElement

Makes a text ReactElement

posX : float
posY : float
displayedText : string
textParameters : Text
Returns: ReactElement

makeTwoLinesOfText posX posY line1 line2 textParameters

Full Usage: makeTwoLinesOfText posX posY line1 line2 textParameters

Parameters:
    posX : float
    posY : float
    line1 : string
    line2 : string
    textParameters : Text

Returns: ReactElement

makes a two-line text ReactElement Dy parameter determines line spacing

posX : float
posY : float
line1 : string
line2 : string
textParameters : Text
Returns: ReactElement

portCircle

Full Usage: portCircle

Returns: Circle

Port circle, used by both Sheet and Symbol to create ports

Returns: Circle

portCircleTarget

Full Usage: portCircleTarget

Returns: Circle
Returns: Circle

testCanvas

Full Usage: testCanvas

Returns: HTMLCanvasElement
Returns: HTMLCanvasElement

uuid ()

Full Usage: uuid ()

Parameters:
    () : unit

Returns: string

return a v4 (random) universally unique identifier (UUID) works under .NET and FABLE

() : unit
Returns: string

Type something to start searching.