0.7.3 • Published 6 years ago

@apexearth/layout v0.7.3

Weekly downloads
-
License
ISC
Repository
github
Last release
6 years ago

@apexearth/layout

Install

npm install @apexearth/layout

Usage

const Layout = require('@apexearth/layout')

Layout

Class used to create layouts.

Kind: global class

new Layout(autoShrink, overlap)

ParamDescription
autoShrinkWhether to automatically shrink the Layout bounds when possible.
overlapWhether to allow Sections to overlap each other.

layout.bounds : Object

The bounds of the Layout.

Kind: instance property of Layout

layout.size : number

The total area of the Layout. (width * height)

Kind: instance property of Layout

layout.fillSize : number

The total filled area of the Layout. (Total width * height of all sections)

Kind: instance property of Layout

layout.sections : Array

The sections within the Layout.

Kind: instance property of Layout

layout.width ⇒ number

The width of the Layout.

Kind: instance property of Layout

layout.height ⇒ number

The height of the Layout.

Kind: instance property of Layout

layout.addSection(left, top, right, bottom, name, data, corner) ⇒ Section

Add a section to the Layout.

Kind: instance method of Layout

ParamTypeDescription
leftnumberThe left bound.
topnumberThe top bound.
rightnumberThe right bound.
bottomnumberThe bottom bound.
namestringThe name of the Section.
dataobjectThe data to associate with the section.
corner'top-left' | 'top-right' | 'bottom-right' | 'bottom-left' | undefinedWhether the section is a corner.

layout.deleteAllSections()

Delete all sections within the Layout.

Kind: instance method of Layout

layout.deleteSections(x, y)

Delete sections located at coordinates.

Kind: instance method of Layout

ParamType
xnumber
ynumber

layout.deleteSection(section) ⇒ Section

Delete a specific section.

Kind: instance method of Layout

ParamDescription
sectionThe section to delete from the Layout.

layout.removeSection(section) ⇒ Section

Same as deleteSection.

Kind: instance method of Layout

ParamDescription
sectionThe section to delete from the Layout.

layout.sectionsAt(x, y, ignoredSection)

Get all sections at a coordinate.

Kind: instance method of Layout

ParamType
xnumber
ynumber
ignoredSectionSection

layout.isEmptyWithin(left, top, right, bottom, ignoredSection)

Check if an area is empty.

Kind: instance method of Layout

ParamTypeDescription
leftnumber
topnumber
rightnumber
bottomnumber
ignoredSectionSectionA section to ignore.

layout.toString() ⇒ string

Create an ASCII representation of the Layout.

Kind: instance method of Layout

layout.add(left, top, right, bottom, x, y, width, height, corner, name, data) ⇒ Section

Add a section to the Layout using more flexible options.

Kind: instance method of Layout
Returns: Section - - The Section added.

ParamTypeDescription
leftThe left bound.
topThe top bound.
rightThe right bound.
bottomThe bottom bound.
xThe left bound.
yThe right bound.
widthThe right bound, minus x.
heightThe bottom bound, minus y.
corner'top-left' | 'top-right' | 'bottom-right' | 'bottom-left' | undefinedWhether the section is a corner.
nameThe name of the Section.
dataThe data to associate with the Section.

Section

The Section class.

Kind: global class

section.layout : Layout

Kind: instance property of Section

section.name : string

Kind: instance property of Section

section.left : number

Kind: instance property of Section

section.top : number

Kind: instance property of Section

section.right : number

Kind: instance property of Section

section.bottom : number

Kind: instance property of Section

section.data : *

Kind: instance property of Section

section.corner : 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left' | undefined

Kind: instance property of Section

section.leftSections : Array

Kind: instance property of Section

section.topSections : Array

Kind: instance property of Section

section.rightSections : Array

Kind: instance property of Section

section.bottomSections : Array

Kind: instance property of Section

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.5.0

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.3

7 years ago