Header menu logo issie

SheetSnap Module

Functions and values

Function or value Description

emptySnap

Full Usage: emptySnap

Returns: SnapXY

initial empty snap data which disables snapping

Returns: SnapXY

getNewSegmentSnapInfo model movingSegmentL

Full Usage: getNewSegmentSnapInfo model movingSegmentL

Parameters:
Returns: SnapXY

Extracts static snap data used to control a segment snapping when being dragged. Called at start of a segment drag. xOrY: which coordinate is processed. model: segment positions are extracted from here. movingSegment: the segment which moved. See SnapXY definition for output.

model : Model
movingSegmentL : ASegment list
Returns: SnapXY

getNewSymbolSnapInfo model movingSymbol

Full Usage: getNewSymbolSnapInfo model movingSymbol

Parameters:
Returns: SnapXY

Extracts static snap data used to control a symbol snapping when being moved. Called at start of a symbol drag. model: schematic positions are extracted from here. movingSymbol: the symbol which moved.

model : Model
movingSymbol : Symbol
Returns: SnapXY

makeSnapBounds limit points

Full Usage: makeSnapBounds limit points

Parameters:
    limit : float
    points : (type) array

Returns: SnapData array

Helper function to create 1D static data for use by snapping functions based on a single coordinate array of snap points. points: array of points to snap to. limit: max distance from a snap point at which snap will happen.

limit : float
points : (type) array
Returns: SnapData array

posToX p

Full Usage: posToX p

Parameters:
Returns: float

select X coordinate

p : XYPos
Returns: float

posToY p

Full Usage: posToY p

Parameters:
Returns: float

select Y coordinate

p : XYPos
Returns: float

snap1D autoScrolling pos snapI

Full Usage: snap1D autoScrolling pos snapI

Parameters:
    autoScrolling : bool
    pos : (type)
    snapI : SnapInfo

Returns: SnapInfo * float

The main snap function which is called every update that drags a symbol or segment. This function porocesses one coordinate (X or Y) and therefore is called twice. autoscrolling: if true switch off snapping (and unsnap if needed). pos.ActualPosition: input the actual position on schematic of the thing being dragged. pos.MouseDelta: mouse position change between this update and the last one. snapI: static (where can it snap) and dynamic (if it is snapped) info controlling the snapping process.

autoScrolling : bool
pos : (type)
snapI : SnapInfo
Returns: SnapInfo * float

snap2DSegment autoScrolling mousePos aSegment model

Full Usage: snap2DSegment autoScrolling mousePos aSegment model

Parameters:
Returns: SnapXY * XYPos

Determine how a dragged segment snaps. Returns updated snap info and offset to add to ssegment position. Segment position is not updated here, the offset is given to a MoveSegment message. NB every segment can only be dragged in one cordinate - perpendicular to its orientation. Called every mouse movement update in a segment drag.

autoScrolling : bool
mousePos : XYPos
aSegment : ASegment
model : Model
Returns: SnapXY * XYPos

snap2DSymbol autoScrolling mousePos symbol model

Full Usage: snap2DSymbol autoScrolling mousePos symbol model

Parameters:
Returns: SnapXY * XYPos

Determine how a dragged symbol snaps. Returns updated snap info and offset to add to symbol position. Symbol position is not updated here, the offset is given to a MoveSymbol message. Called every mouse movement update in a symbol drag.

autoScrolling : bool
mousePos : XYPos
symbol : Symbol
model : Model
Returns: SnapXY * XYPos

snapIndicatorLine

Full Usage: snapIndicatorLine

Returns: Line
Returns: Line

snapIndicatorLineX model wholeCanvas

Full Usage: snapIndicatorLineX model wholeCanvas

Parameters:
    model : Model
    wholeCanvas : 'a

Returns: ReactElement list

a vertical line marking the position of the current symbol or segment snap, if one exists

model : Model
wholeCanvas : 'a
Returns: ReactElement list

snapIndicatorLineY model wholeCanvas

Full Usage: snapIndicatorLineY model wholeCanvas

Parameters:
    model : Model
    wholeCanvas : 'a

Returns: ReactElement list

a horizontal line marking the position of the current symbol or segment snap, if one exists

model : Model
wholeCanvas : 'a
Returns: ReactElement list

snapLineHorizontal wholeCanvas y

Full Usage: snapLineHorizontal wholeCanvas y

Parameters:
    wholeCanvas : 'a
    y : 'b

Returns: ReactElement
wholeCanvas : 'a
y : 'b
Returns: ReactElement

snapLineVertical wholeCanvas x

Full Usage: snapLineVertical wholeCanvas x

Parameters:
    wholeCanvas : 'a
    x : 'b

Returns: ReactElement
wholeCanvas : 'a
x : 'b
Returns: ReactElement

symbolMatch symbol

Full Usage: symbolMatch symbol

Parameters:
Returns: ComponentType

Map Component types to values which partition them into sets of components which should be treated as same type in snap operations. e.g. Input, Output, IOLabel are all treated as same. Usage: symbolMatch s1 = symbolMatch s2 // true if s1 and s2 snap to each other.

symbol : Symbol
Returns: ComponentType

Type something to start searching.