Constructor
new JigSaw(nx, ny)
JigSaw constructor
Name | Type | Description |
---|---|---|
nx | number | Number of columns |
ny | number | Number of rows |
- Source
Extends
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
- Overrides
- Source
nCols :number
Number of columns (useful in grid-based shapers)
- number
- Overrides
- Source
nRows :number
Number of rows (useful in grid-based shapers)
- number
- Overrides
- 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
- Overrides
- 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
- Overrides
- 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
Methods
buildShapes()
Builds the jigsaw shapes based on the number of rows and columns
- 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
hLine(sd, type, x, y, w, h, inv)
Adds an horizontal line to the provided path
Name | Type | Description |
---|---|---|
sd | module:AWT. | The Path to which the line will be added |
type | number | Type of tooth: 0 is flat (no tooth), 1 means tooth up, and 2 means tooth down |
x | number | X coordinate of the starting point |
y | number | Y coordinate of the starting point |
w | number | Width of the piece |
h | number | Height of the piece |
inv | boolean | The line must be drawn right to left |
- Source
reset(nCols, nRows)
Initializes this Shaper to default values
Name | Type | Description |
---|---|---|
nCols | number | Number of columns |
nRows | number | Number of rows |
- Overrides
- 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
vLine(sd, type, x, y, w, h, inv)
Adds a vertical line to the provided path
Name | Type | Description |
---|---|---|
sd | module:AWT. | The Path to which the line will be added |
type | number | Type of tooth: 0 is flat (no tooth), 1 means tooth right, and 2 means tooth left |
x | number | X coordinate of the starting point |
y | number | Y coordinate of the starting point |
w | number | Width of the piece |
h | number | Height of the piece |
inv | boolean | The line must be drawn bottom to top |
- Source