Global

Global

Type Definitions

Area

Area object.

{left: number, top: number, right: number, bottom: number}

NameTypeDescription
leftnumber

Left coordinate

topnumber

Top coordinate

rightnumber

Right coordinate

bottomnumber

Bottom coordinate

BBox

Bounding box object.

{x: number, y: number, width: number, height: number}

NameTypeDescription
xnumber

X coordinate

ynumber

Y coordinate

widthnumber

Width of bounding box

heightnumber

Height of bounding box

Intersect

Intersect object.

{pts: Point[], ts1: number[], ts2: number[]}

NameTypeDescription
ptsPoint[]

An array of intersected points, or an empty array if no intersections.

tsArray.<number[]>

Two arrays (0 === first segment, 1 === second segment) of T values for the intersected points.

PathList

Path segment list. Contains an array of objects in the following format:

{type: string, x: number, y: number, x1: number, y1: number, x2: number, y2: number}

NameTypeAttributesDescription
typestring

Valid svg path command limited to M, L, C, Q, Z

xnumber

X coordinate

ynumber

Y coordinate

x1numberoptional

X control point for quadratic and bezier curve

y1numberoptional

Y control point for quadratic and bezier curve

x2numberoptional

Second X control point for bezier curve

y2numberoptional

Second Y control point for bezier curve

lengthnumber

The number of items in the path segment list

Point

Point object.

{x: number, y: number}

NameTypeDescription
xnumber

X coordinate

ynumber

Y coordinate

Methods

.addToGroup(src, tgt) Returns: Vecta.Shape

Add src shape to first level of the tgt shape

NameTypeDescription
srcVecta.Shape

Source shape to be added into the tgt shape

tgtVecta.Shape

Target shape to keep the src shape

Returns:

tgt Target shape that contained the src shape

.batchUpdate(path, json) Returns: *

Batch update to remedy the "Write too large" error on Firebase

NameTypeDescription
path

Path to data

json

Update json object

.getRefComp(infos, ref_shapes, [type], [edit], [include_empty]) Returns: Object

Get components of all symbol references and also reset group value to start from 1

NameTypeAttributesDefaultDescription
infosObject

All symbols information like location and group

ref_shapesObject

All refs that separated by page ({ pg_id: [shp_ids] })

typeObjectoptional11

Symbol type, default to electrical symbol

editBooleanoptionalfalse

To denote whether want to update infos while update group

include_emptyBooleanoptionalfalse

To denote whether want to include wires that have no component

Returns:

comps Object that contains the ref and corresponding comp info. Example: { reference: { id:shp_id, page_id:page id, ref:reference, group:Number, shps:[shp1, shp2], pages: [pg1, pg2], type:symbol type } }

.getRefShapes([options]) Returns: Object

Get list of shape ids with the same reference

NameTypeAttributesDescription
optionsobjectoptional

Object that contains options such as reference, name, etc

NameTypeAttributesDescription
refstringoptional

Reference to search

namestringoptional

Name of shape to search, default to all

page_idstringoptional

Page to search, default to all

skip_idstringoptional

ID of shape to skip search

storageobjectoptional

Storage for the shape. Default to symbols storage

Returns:

ret List of shape ids by page ids. Structure is { pg_id: [shp_ids] }

.getTags(tag_ids) Returns: Object

Get lists of component tags and cable tags from the given ids

NameTypeDescription
tag_idsstring

IDs of the component tags and cable tags in the format of 'id1|id2|id3'

Returns:

tags Contains list of cable tags and component tags, their key is the symbol type number Example: { 29: []. 30: [] }

.getTBlockComps(term_blocks) Returns: Object

Get terminal blocks with their information such as group number

NameTypeDescription
term_blocksObject

All terminal block's information like location and group

Returns:

obj Object that contains the ref and corresponding comp info. Example: { reference: { id:shp_id, page_id:page id, ref:reference, group:Number, shps:[shp1, shp2], pages: [pg1, pg2], type:symbol type } }

.loadOriginalView(cur_view, cur_pg_id, [shape])

Load a page with a given zoom and view coordinate

NameTypeAttributesDescription
cur_viewobject

Object that hold information such as zoom and coordinate of view

NameTypeDescription
zoomstring

Zoom percentage

xnumber

X position of the view

ynumber

Y position of the view

cur_pg_idstring

ID of the page

shapeVecta.Shapeoptional

The shape to be selected after view the page

.preparePages() Returns: *

returns a Promise with an array of Vecta.Page as return value. also prepares Vecta.activeDoc and Vecta.activePage and v.pages to be used by export functions later

.searchNetwork(wire, scanned) Returns: Promise.<T>

Given a wire, we scan through all the wires and symbols that connected to it

NameTypeDescription
wireVecta.Shape

The wire that we want to scan

scannedobject

The list of wires that already scanned before, its structure is { wire_id: 1 }

Returns:

It resolved an object: 1. if the wire is already scanned previously, it resolve { scanned: true } 2. otherwise, it resolve { nets: { id: {object} }, shapes: [ {object} ] }

.spinText(str, [decrement], [begin]) Returns: string

increment or decrement page prefix or refs/net names

NameTypeAttributesDefaultDescription
strstring

the string to do inc/dec

decrementbooleanoptionalfalse

increment by default

beginbooleanoptionalfalse

dec/inc the begin number

Returns:

incremented/decremented text

.typeNo(shape, [val]) Returns: number

Get or set the symbol type

NameTypeAttributesDescription
shapeVecta.Shape|v.Group

The symbol shape in Vecta.Shape or v.Group

valnumberoptional

The value of symbol type to set or get if undefined

Returns:

type Type of the symbol

.updateVType(connector)

Update v:type according to the path

NameTypeDescription
connectorVecta.Shape

.userJSON(shape, [key], [val]) Returns: string|number|null

Get or set the shape's json.user

NameTypeAttributesDescription
shapeVecta.Shape|v.Group

The symbol shape in Vecta.Shape or v.Group

keystring|objectoptional

The key of the property in json.user, set multiple properties if this is an object, returns whole object if this is undefined

valstring|number|nulloptional

The value to be set on the property if given, null to remove, read value this is not provided

Returns:

type Returns the value if val is not provided

.waitLangLoaded()

Utility method to check & wait for lang loaded if it's not already loaded. If it's already loaded, then it will just resolve

Capital™ X Panel Designer