Header menu logo issie

Sheet Module

Types and nested modules

Type/Module Description

Constants

SheetInterface

FitWindow

The window a fit has to work with. Normally the whole drawing area; with the Sheet menu pinned open over the left of it, what the menu leaves - which is what makes a pinned menu something to work beside rather than something in the way. Everything a fit does follows from this, so nothing below has to know the Sheet menu exists. Inset is how far in from the drawing area's left edge the usable part starts. Magnification does not care where the window begins, but the scroll does: it has to put the circuit past the menu and then half way across the rest.

WheelZoom

Functions and values

Function or value Description

addBoxMargin fractionalMargin absoluteMargin box

Full Usage: addBoxMargin fractionalMargin absoluteMargin box

Parameters:
    fractionalMargin : float
    absoluteMargin : float
    box : BoundingBox

Returns: BoundingBox
fractionalMargin : float
absoluteMargin : float
box : BoundingBox
Returns: BoundingBox

alongArray dir box

Full Usage: alongArray dir box

Parameters:
Returns: float

The size of `box` along the direction an array runs.

dir : ArrayDirection
box : BoundingBox
Returns: float

arrayBox dir copies box

Full Usage: arrayBox dir copies box

Parameters:
Returns: BoundingBox

The bounding box `copies` copies of `box` occupy once arrayed.

dir : ArrayDirection
copies : int
box : BoundingBox
Returns: BoundingBox

arrayDirectionFor box

Full Usage: arrayDirectionFor box

Parameters:
Returns: ArrayDirection

The direction a fragment of this shape should be arrayed in: across its short axis, so the copies stack up beside each other. A square fragment goes vertically, which is the way a row of repeated logic is normally built up.

box : BoundingBox
Returns: ArrayDirection

arrayIsAgainstShape dir box

Full Usage: arrayIsAgainstShape dir box

Parameters:
Returns: bool

Whether arraying `box` this way runs it along its long axis, by more than Constants.arrayAspectWarning. Copies then stack end to end into a strip, which is what the dialog warns about rather than refuses: it is occasionally what is wanted.

dir : ArrayDirection
box : BoundingBox
Returns: bool

arrayOffset dir box i

Full Usage: arrayOffset dir box i

Parameters:
Returns: XYPos

Where the `i`th copy of an array goes, relative to the first.

dir : ArrayDirection
box : BoundingBox
i : int
Returns: XYPos

arrayStep dir box

Full Usage: arrayStep dir box

Parameters:
Returns: float

From one copy of `box` to the next: the fragment's own size along the array, plus a gap.

dir : ArrayDirection
box : BoundingBox
Returns: float

boxPointUnion box point

Full Usage: boxPointUnion box point

Parameters:
Returns: BoundingBox

Returns the smallest BB containing box and point. Could be made more efficient

box : BoundingBox
point : XYPos
Returns: BoundingBox

boxUnion box box'

Full Usage: boxUnion box box'

Parameters:
Returns: BoundingBox

calculates the smallest bounding box that contains two BBs, in form with W,H > 0

box : BoundingBox
box' : BoundingBox
Returns: BoundingBox

centreOfCanvas model

Full Usage: centreOfCanvas model

Parameters:
Returns: XYPos
model : Model
Returns: XYPos

centreOfScreen model

Full Usage: centreOfScreen model

Parameters:
Returns: XYPos option
model : Model
Returns: XYPos option

copiedFragmentBox model

Full Usage: copiedFragmentBox model

Parameters:
Returns: BoundingBox option

The bounding box of what is on the clipboard, or None when nothing has been copied. Labels are included, and have to be: a label sits below its symbol, so a fragment measured without them leaves a gap that the label of one copy hangs into the next through. A single copied component is the case that shows it - symbolBBUnion takes the first symbol's box without its label, which for one symbol is the whole answer. Recalculated rather than read off the symbol, as symbolWireBBUnion does: the stored box is only as fresh as whatever last set it, and these symbols were put aside when they were copied.

model : Model
Returns: BoundingBox option

ensureCanvasExtendsBeyondScreen model

Full Usage: ensureCanvasExtendsBeyondScreen model

Parameters:
Returns: Model

Check that canvas is large enough to have space all round the visible area. If not, then change model by moving circuit on canvas and/or extending canvas. Keep components in same visible position during this process. returns new model with all positions updated if need be.

model : Model
Returns: Model

findIntersectingComponents model box1

Full Usage: findIntersectingComponents model box1

Parameters:
Returns: ComponentId list

Finds all components that touch a bounding box (which is usually the drag-to-select box)

model : Model
box1 : BoundingBox
Returns: ComponentId list

findNearbyComponents model pos range

Full Usage: findNearbyComponents model pos range

Parameters:
Returns: ComponentId list

Finds all components (that are stored in the Sheet model) near pos Optimised a little for space

model : Model
pos : XYPos
range : float
Returns: ComponentId list

findNearbyComponentsOld model pos range

Full Usage: findNearbyComponentsOld model pos range

Parameters:
Returns: ComponentId list

Finds all components (that are stored in the Sheet model) near pos

model : Model
pos : XYPos
range : float
Returns: ComponentId list

findNearbyPorts model

Full Usage: findNearbyPorts model

Parameters:
Returns: (InputPortId * XYPos) list * (OutputPortId * XYPos) list

Returns the ports of all model.NearbyComponents

model : Model
Returns: (InputPortId * XYPos) list * (OutputPortId * XYPos) list

fitCircuitToWindowParas win model

Full Usage: fitCircuitToWindowParas win model

Parameters:
Returns: Model * (type)

shift circuit to middle of canvas, resizing canvas to allow enough border if needed. return scroll and zoom paras to display all of circuit in middle of the given window

win : FitWindow
model : Model
Returns: Model * (type)

fitInsetFor menuWidth width height

Full Usage: fitInsetFor menuWidth width height

Parameters:
    menuWidth : float
    width : float
    height : float

Returns: float

How much of the left of a `width` by `height` drawing area a fit should leave to a menu `menuWidth` wide: all of it, unless what is left over is a slot more than Constants.maxFitAspectRatio times as tall as it is wide (or as wide as tall), where going round the menu would shrink the circuit further than the menu ever hides it.

menuWidth : float
width : float
height : float
Returns: float

fitWindowFor issieModel

Full Usage: fitWindowFor issieModel

Parameters:
Returns: FitWindow option

The window a fit should use, for the whole Issie model - which is what says whether the Sheet menu is pinned. The draw block is handed this rather than working it out, because Model.SheetMenuPinned is not draw block state: see SheetUpdate.update, which is given the whole model for exactly this. None when there is no canvas to measure, which is what the fit used to return None for.

issieModel : Model
Returns: FitWindow option

getScreenEdgeCoords model

Full Usage: getScreenEdgeCoords model

Parameters:
Returns: (type) option

return screen edge coords if possible

model : Model
Returns: (type) option

getScrollProps ()

Full Usage: getScrollProps ()

Parameters:
    () : unit

Returns: XYPos option

return X=CanvasDiv.scrollLeft, Y= canvasDiv.scrollTop

() : unit
Returns: XYPos option

getWindowParasToFitBox win box

Full Usage: getWindowParasToFitBox win box

Parameters:
Returns: (type)

get scroll and zoom paras to fit box all on screen centred and occupying as much of screen as possible

win : FitWindow
box : BoundingBox
Returns: (type)

getWireBBox wire

Full Usage: getWireBBox wire

Parameters:
Returns: BoundingBox

could be made more efficient, since segments contain redundant info

wire : Wire
Returns: BoundingBox

insideBox pos boundingBox

Full Usage: insideBox pos boundingBox

Parameters:
Returns: bool

helper used inside Map.tryFind hence the unused parameter returns true if pos is insoie boundingbox

pos : XYPos
boundingBox : BoundingBox
Returns: bool

insideBoxMap boundingBoxes pos

Full Usage: insideBoxMap boundingBoxes pos

Parameters:
Returns: Option<ComponentId>
Modifiers: inline

Checks if pos is inside any of the bounding boxes of the components in boundingBoxes

boundingBoxes : Map<ComponentId, BoundingBox>
pos : XYPos
Returns: Option<ComponentId>

isAllVisible model conns comps

Full Usage: isAllVisible model conns comps

Parameters:
Returns: bool
model : Model
conns : ConnectionId list
comps : ComponentId list
Returns: bool

isAtFittedPosition win model

Full Usage: isAtFittedPosition win model

Parameters:
Returns: bool

Whether the sheet is still exactly where a fit to `win` would put it, and so has not been scrolled, zoomed or edited since one. Undoing a fit - as unpinning the Sheet menu does - is only ever right for a view the fit itself chose: once the user has moved it, it is theirs. A second fit of an already fitted circuit is a no-op, since the circuit is centred on the canvas already and the same box gives the same magnification, so this can ask by computing one. Compared against where the canvas is actually scrolled to, not against the model's record of it: a fit that asks to scroll past a canvas edge gets what the browser allows instead, and it is that the user is looking at.

win : FitWindow
model : Model
Returns: bool

isBBoxAllVisible model bb

Full Usage: isBBoxAllVisible model bb

Parameters:
Returns: bool option
model : Model
bb : BoundingBox
Returns: bool option

magToFitBox win box

Full Usage: magToFitBox win box

Parameters:
Returns: float

The magnification that puts `box` in `win`, as large as the window and the zoom limit allow.

win : FitWindow
box : BoundingBox
Returns: float

maxArrayCopies dir canvasSize box

Full Usage: maxArrayCopies dir canvasSize box

Parameters:
Returns: int

The most copies of `box` that fit on a canvas `canvasSize` square, which is the whole of what a sheet has room for. Can be below 2, which means there is no array to paste at all.

dir : ArrayDirection
canvasSize : float
box : BoundingBox
Returns: int

mouseOn model pos

Full Usage: mouseOn model pos

Parameters:
Returns: MouseOn

Returns what is located at pos. Priority Order: InputPort -> OutputPort -> Label -> Wire -> Component -> Canvas

model : Model
pos : XYPos
Returns: MouseOn

mouseOnPort portList pos margin

Full Usage: mouseOnPort portList pos margin

Parameters:
    portList : ('a * XYPos) list
    pos : XYPos
    margin : float

Returns: ('a * XYPos) option

Checks if pos is inside any of the ports in portList

portList : ('a * XYPos) list
pos : XYPos
margin : float
Returns: ('a * XYPos) option

moveCircuit moveDelta model

Full Usage: moveCircuit moveDelta model

Parameters:
Returns: Model
moveDelta : XYPos
model : Model
Returns: Model

notIntersectingComponents model box1 inputId

Full Usage: notIntersectingComponents model box1 inputId

Parameters:
Returns: bool
model : Model
box1 : BoundingBox
inputId : ComponentId
Returns: bool

notIntersectingSelectedComponents model box1 inputId

Full Usage: notIntersectingSelectedComponents model box1 inputId

Parameters:
Returns: bool
model : Model
box1 : BoundingBox
inputId : ComponentId
Returns: bool

openSheetMenuWidth ()

Full Usage: openSheetMenuWidth ()

Parameters:
    () : unit

Returns: float

Width of the drawing area's left edge the Sheet menu is over, and 0 when the menu is closed - which is display:none, and so has no width. Measured rather than derived because it is a rendered fact: it depends on the design's tree and on how much room the canvas gives it.

() : unit
Returns: float

posAdd pos (a, b)

Full Usage: posAdd pos (a, b)

Parameters:
    pos : XYPos
    a : float
    b : float

Returns: XYPos
pos : XYPos
a : float
b : float
Returns: XYPos

putScrollProps props

Full Usage: putScrollProps props

Parameters:
Returns: HTMLElement option
props : XYPos
Returns: HTMLElement option

recentProgrammaticScrollPos

Full Usage: recentProgrammaticScrollPos

Returns: XYPos list

Used to filter OnScroll messages caused by recent scroll updates. These could reset scroll back to some previous value.

Returns: XYPos list

scrollSequence

Full Usage: scrollSequence

Returns: int

Used to filter out-of-sequence OnScroll messages. These could reset scroll to some previous value. Incremented by program UpdateScroll and OnScroll.

Returns: int

sheetCmd msg

Full Usage: sheetCmd msg

Parameters:
Returns: Cmd<Msg>
msg : Msg
Returns: Cmd<Msg>

standardiseBox box

Full Usage: standardiseBox box

Parameters:
Returns: BoundingBox

return a BB equivalent to input but with (X,Y) = LH Top coord, (X+W,Y+H) = RH bottom coord note that LH Top is lower end of the two screen coordinates

box : BoundingBox
Returns: BoundingBox

symDiff lst1 lst2

Full Usage: symDiff lst1 lst2

Parameters:
    lst1 : 'a list
    lst2 : 'a list

Returns: 'a list
lst1 : 'a list
lst2 : 'a list
Returns: 'a list

symbolBBUnion centresOnly symbols

Full Usage: symbolBBUnion centresOnly symbols

Parameters:
    centresOnly : bool
    symbols : Symbol list

Returns: BoundingBox option
centresOnly : bool
symbols : Symbol list
Returns: BoundingBox option

symbolCmd msg

Full Usage: symbolCmd msg

Parameters:
Returns: Cmd<Msg>

Creates a command to Symbol

msg : Msg
Returns: Cmd<Msg>

symbolToBB centresOnly symbol

Full Usage: symbolToBB centresOnly symbol

Parameters:
    centresOnly : bool
    symbol : Symbol

Returns: BoundingBox
centresOnly : bool
symbol : Symbol
Returns: BoundingBox

symbolToCentre symbol

Full Usage: symbolToCentre symbol

Parameters:
Returns: BoundingBox
symbol : Symbol
Returns: BoundingBox

symbolWireBBUnion model

Full Usage: symbolWireBBUnion model

Parameters:
Returns: BoundingBox

Returns the smallest BB that contains all symbols, labels, and wire segments. For empty circuit a BB is returned in middle of viewable screen.

model : Model
Returns: BoundingBox

transformScreenToPos screenPos scrollPos mag

Full Usage: transformScreenToPos screenPos scrollPos mag

Parameters:
Returns: XYPos
screenPos : XYPos
scrollPos : XYPos
mag : float
Returns: XYPos

tryInsideLabelBox model pos

Full Usage: tryInsideLabelBox model pos

Parameters:
Returns: Symbol option
Modifiers: inline

returns the symbol if pos is inside any symbol's LabelBoundingBox

model : Model
pos : XYPos
Returns: Symbol option

tryInsideSymCorner model pos

Full Usage: tryInsideSymCorner model pos

Parameters:
Returns: (Symbol * XYPos * int) option
Modifiers: inline

HLP23 AUTHOR: BRYAN TAN if pos is inside any one of the custom symbol's corners, return the diagonally opposite corner (its position is fixed during resizing), and the index of the corner being held

model : Model
pos : XYPos
Returns: (Symbol * XYPos * int) option

viewIsAfterUpdateScroll

Full Usage: viewIsAfterUpdateScroll

Returns: bool

True for the first view function evaluation after scroll has been programmatically updated. In that case OnScroll messages are never sent.

Returns: bool

wheelZoom deltaMode deltaY isZoomGesture physicalModifierHeld

Full Usage: wheelZoom deltaMode deltaY isZoomGesture physicalModifierHeld

Parameters:
    deltaMode : float
    deltaY : float
    isZoomGesture : bool
    physicalModifierHeld : bool

Returns: WheelZoom option

Classify a modified wheel event and calculate its zoom factor without touching the DOM.

deltaMode : float
deltaY : float
isZoomGesture : bool
physicalModifierHeld : bool
Returns: WheelZoom option

wireCmd msg

Full Usage: wireCmd msg

Parameters:
Returns: Cmd<Msg>

Creates a command to BusWire

msg : Msg
Returns: Cmd<Msg>

wireToBB wire

Full Usage: wireToBB wire

Parameters:
Returns: BoundingBox

Returns the smallest BB that contains all segments of wire.

wire : Wire
Returns: BoundingBox

zoomCenteredScrollPosition oldScreenCentre zoom clientWidth clientHeight

Full Usage: zoomCenteredScrollPosition oldScreenCentre zoom clientWidth clientHeight

Parameters:
    oldScreenCentre : XYPos
    zoom : float
    clientWidth : float
    clientHeight : float

Returns: XYPos

Calculate the scroll position that keeps a sheet point at the centre of the viewport.

oldScreenCentre : XYPos
zoom : float
clientWidth : float
clientHeight : float
Returns: XYPos

Type something to start searching.