shapers/Rectangular. Rectangular

This is the simplest Shaper. It divides the graphic object in a set of rectangular
shapes distributed in the specified number of rows and columns.

Constructor

new Rectangular(nx, ny)

Rectangular constructor

Parameters:
NameTypeDescription
nxnumber

Number of columns

nynumber

Number of rows

Extends

Members

baseWidthFactor :number

In JigSaw, ratio between the base width of the tooth and the total length of the side.

Type:
  • number

className :string

This shaper class name

Type:
  • string

customShapes :boolean

Only the Holes shaper has this flag activated

Type:
  • boolean

enclosing :module:AWT.Shape

In Holes, the enclosing area where all shapes are placed.

hasRemainder :boolean

Flag indicating if this Shaper deploys over a surface biggest than the rectangle enclosing
all its shapes

Type:
  • boolean

initiated :boolean

Flag used to check if the Shaper has been initialized against a real surface

Type:
  • boolean

nCells :number

Number of cells managed by this shaper

Type:
  • number

nCols :number

Number of columns (useful in grid-based shapers)

Type:
  • number

nRows :number

Number of rows (useful in grid-based shapers)

Type:
  • number

randomLines :boolean

In JigSaw, whether the tooths take random directions or not

Type:
  • boolean

rectangularShapes :boolean

Overrides same flag in Shaper#rectangularShapes

Type:
  • boolean

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.

Type:
  • number

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.

Type:
  • number

shapeData :object

Contains the specific definition of each shape

Type:
  • object

showEnclosure :boolean

In Holes, when true, the enclosing area will be drawn

Type:
  • boolean

toothHeightFactor :number

In JigSaw, ratio between the tooth height and the total length of the side.

Type:
  • number

Methods

buildShapes()

Builds the rectangular shapes based on the number of rows and columns

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.

Returns:
  • The resulting object, with minimal attrributes
Type: 
object

getEnclosingShapeData() → {module:AWT.Rectangle}

Gets the AWT.Rectangle that contains all shapes of this Shaper.

Returns:
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.

Parameters:
NameTypeDescription
rectmodule:AWT.Rectangle

The frame where to move and scale all the shapes

Returns:
Type: 
module:AWT.Rectangle

getShape(n, rect) → {module:AWT.Shape}

Gets a clone of the nth Shape object, scaled and located inside a Rectangle

Parameters:
NameTypeDescription
nnumber
rectmodule:AWT.Rectangle
Returns:
Type: 
module:AWT.Shape

getShapeData(n) → {object}

Gets the nth Shape data object

Parameters:
NameTypeDescription
nnumber
Returns:
Type: 
object

reset(nCols, nRows)

Initializes this Shaper to default values

Parameters:
NameTypeDescription
nColsnumber

Number of columns

nRowsnumber

Number of rows

setProperties($xml)

Loads this shaper settings from a specific JQuery XML element

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The XML element with the shaper data