Constructor
new Shaper(nx, ny)
Shaper constructor
Name | Type | Description |
---|---|---|
nx | number | Number of columns (in grid-based shapers) |
ny | number | Number of rows (in grid-based shapers) |
- Source
Members
baseWidthFactor :number
In JigSaw
, ratio between the base width of the tooth and the total length of the side.
- number
- Source
className :string
This shaper class name
- string
- Source
customShapes :boolean
Only the Holes
shaper has this flag activated
- boolean
- Source
enclosing :module:AWT.Shape
In Holes
, the enclosing area where all shapes are placed.
- Source
hasRemainder :boolean
Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing
all its shapes
- boolean
- Source
initiated :boolean
Flag used to check if the Shaper
has been initialized against a real surface
- boolean
- Source
nCells :number
Number of cells managed by this shaper
- number
- Source
nCols :number
Number of columns (useful in grid-based shapers)
- number
- Source
nRows :number
Number of rows (useful in grid-based shapers)
- number
- Source
randomLines :boolean
In JigSaw
, whether the tooths take random directions or not
- boolean
- Source
rectangularShapes :boolean
Flag indicating if this shaper organizes its cells in rows and columns
- boolean
- Source
scaleX :number
In Holes
, scale to be applied to horizontal positions and lengths to achieve the real
value of the shape placed on a real surface.
- number
- Source
scaleY :number
In Holes
, scale to be applied to vertical positions and lengths to achieve the real
value of the shape placed on a real surface.
- number
- Source
shapeData :object
Contains the specific definition of each shape
- object
- Source
showEnclosure :boolean
In Holes
, when true
, the enclosing area will be drawn
- boolean
- Source
toothHeightFactor :number
In JigSaw
, ratio between the tooth height and the total length of the side.
- number
- Source
(static) CLASSES :object
List of known classes derived from Shaper. It should be filled by real shaper classes at
declaration time.
- object
- Source
Methods
buildShapes()
Builds the individual shapes that will form this Shaper
- Source
getAttributes() → {object}
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
- Source
- The resulting object, with minimal attrributes
- Type:
- object
getEnclosingShapeData() → {module:AWT.Rectangle}
Gets the AWT.Rectangle that contains all shapes of this Shaper.
- Source
- Type:
- module:AWT.
Rectangle
getRemainderShape(rect) → {module:AWT.Rectangle}
When hasRemainder
is true, this method gets the rectangle containing the full surface where
the Shaper develops.
Name | Type | Description |
---|---|---|
rect | module:AWT. | The frame where to move and scale all the shapes |
- Source
- Type:
- module:AWT.
Rectangle
getShape(n, rect) → {module:AWT.Shape}
Gets a clone of the nth Shape object, scaled and located inside a Rectangle
Name | Type | Description |
---|---|---|
n | number | |
rect | module:AWT. |
- Source
- Type:
- module:AWT.
Shape
getShapeData(n) → {object}
Gets the nth Shape data object
Name | Type | Description |
---|---|---|
n | number |
- Source
- Type:
- object
reset(nCols, nRows)
Initializes this Shaper to default values
Name | Type | Description |
---|---|---|
nCols | number | Number of columns |
nRows | number | Number of rows |
- Source
setProperties($xml)
Loads this shaper settings from a specific JQuery XML element
Name | Type | Description |
---|---|---|
$xml | external:jQuery | The XML element with the shaper data |
- Source
(static) factory(data) → {module:shapers/Shaper.Shaper}
Builds a new shaper, based on the properties specified in a data object
Name | Type | Description |
---|---|---|
data | object | The data object to be parsed |
- Source
(static) getShaper(className, nx, ny) → {module:shapers/Shaper.Shaper}
Factory constructor that returns a Shaper of the requested class.
Name | Type | Description |
---|---|---|
className | string | The class name of the requested Shaper. |
nx | number | Number of columns (in grid-based shapers) |
ny | number | Number of rows (in grid-based shapers) |
- Source
(static) readShapeData($xml, scaleX, scaleY) → {module:AWT.Shape}
Reads an individual shape from an XML element.
Shapes are arrays of stroke
objects.
Each stroke
has an action
(move to, line to, quad to...) and associated data
.
Name | Type | Description |
---|---|---|
$xml | external:jQuery | The XML element with the shape data |
scaleX | number | |
scaleY | number |
- Source
- Type:
- module:AWT.
Shape
(static) registerClass(shaperName, shaperClass) → {module:shapers/Shaper.Shaper}
Registers a new type of shaper
Name | Type | Description |
---|---|---|
shaperName | string | The name used to identify this shaper |
shaperClass | function | The shaper class, usually extending Shaper |
- Source
- The provided shaper class