new module:Transform(stringopt)
Initialize the Transform object
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
string |
string |
<optional> |
string in the format of the |
Classes
Members
-
items :Array
-
array of Property instances
Methods
-
get() → {string}
-
get the transform values in a string
Returns:
string -string that can be used as a value for the transform property of a SVG element
-
getArguments(index) → {array}
-
get arguments of a property specified by index
Parameters:
Name Type Description indexnumber index of the property
Returns:
array -array of arguments of the specified property
-
getIndex(name) → {number}
-
find a transform property by name and get its index in the items array
Parameters:
Name Type Description namestring name of the property
Returns:
number -index of the property in the array of properties or
-1if not found -
getRotate() → {Object}
-
get the rotate property
Returns:
Object -object containing parameters of the rotate attribute
-
getTranslate() → {Object}
-
get the translate property
Returns:
Object -object containing parameters of the translate attribute
-
pixelConversion(convertor)
-
Convert distances using a specified convertor. Used by toGridPixels and toSVGPixels
Parameters:
Name Type Description convertorfunction function that converts int to int
-
rotateLeft(centerX, centerY)
-
rotate by 90 degrees to the left
Parameters:
Name Type Description centerXnumber horizontal position of the center of the rotation
centerYnumber vertical position of the center of the rotation
-
rotateRight(centerX, centerY)
-
rotate by 90 degrees to the right
Parameters:
Name Type Description centerXnumber horizontal position of the center of the rotation
centerYnumber vertical position of the center of the rotation
-
rotateRightAngle(centerX, centerY, right)
-
rotate by 90 degrees to the right or left, depending on the parameter
rightParameters:
Name Type Description centerXnumber horizontal position of the center of the rotation
centerYnumber vertical position of the center of the rotation
rightboolean rotate to the right if
true, to the left iffalse -
setParameter(name, args)
-
set argumets of a property specified by name
Parameters:
Name Type Description namestring name of the property
argsarray array of arguments of the specified property
-
setRotate(deg, centerX, centerY)
-
set rotate to the specified values
Parameters:
Name Type Description degnumber angle of the rotation in degrees
centerXnumber horizontal position of the center of the rotation
centerYnumber vertical position of the center of the rotation
-
setTranslate(x, y)
-
set translate to the specified values
Parameters:
Name Type Description xnumber horizontal translation
ynumber vertical translation
-
toGridPixels(appInstance)
-
convert distances from SVG pixels to grid pixels
Parameters:
Name Type Description appInstanceApp instance of App
-
toSVGPixels(appInstance)
-
convert distances from grid pixels to SVG pixels
Parameters:
Name Type Description appInstanceApp instance of App