Home Reference Source
import Snap from './ui/glpatch/snap.js'
public class | source

Snap

Extends:

Events → Snap

snapping of ops/ports etc to an invisible grid

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

enabled: boolean

public

rect: *

Private Members
private
private
private

_rectWidth: number

private
private

_xCoords: *[]

Method Summary

Public Methods
public

render(mouseDown: *)

public

snapOpX(_x: *, op: *, dist: *): *

public

snapX(_x: *): *

public

snapY(y: *, force: *): *

public

update()

Private Methods
private

_snapPortX(_x: *, port: *, index: *, dist: *): *

Inherited Summary

From class Events
public

off: *

public

on: *

private
private
private

_log: *

private

_logEvents: boolean

private

_logName: string

public

addEventListener(which: *, cb: *, idPrefix: string): string

add event listener

public

emitEvent(which: string, param1: *, param2: *, param3: *, param4: *, param5: *, param6: *)

emit event

public

hasEventListener(id: *, cb: *): boolean

check event listener registration

public

hasListenerForEventName(eventName: *): boolean

check event listener by name

public

logEvents(enabled: boolean, logName: string)

enable/disable logging of events for the class

public

removeEventListener(id: *, cb: *)

rempve event listener registration

Public Constructors

public constructor() source

Override:

Events#constructor

Public Members

public enabled: boolean source

public rect: * source

Private Members

private _glPatch: * source

private _instancer: * source

private _rectWidth: number source

private _timeout: * source

private _xCoords: *[] source

Public Methods

public render(mouseDown: *) source

Params:

NameTypeAttributeDescription
mouseDown *

public snapOpX(_x: *, op: *, dist: *): * source

Params:

NameTypeAttributeDescription
_x *
op *
dist *

Return:

*

public snapX(_x: *): * source

Params:

NameTypeAttributeDescription
_x *

Return:

*

public snapY(y: *, force: *): * source

Params:

NameTypeAttributeDescription
y *
force *

Return:

*

public update() source

Private Methods

private _snapPortX(_x: *, port: *, index: *, dist: *): * source

Params:

NameTypeAttributeDescription
_x *
port *
index *
dist *

Return:

*