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 index
number 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 name
string name of the property
Returns:
number -index of the property in the array of properties or
-1
if 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 convertor
function function that converts int to int
-
rotateLeft(centerX, centerY)
-
rotate by 90 degrees to the left
Parameters:
Name Type Description centerX
number horizontal position of the center of the rotation
centerY
number vertical position of the center of the rotation
-
rotateRight(centerX, centerY)
-
rotate by 90 degrees to the right
Parameters:
Name Type Description centerX
number horizontal position of the center of the rotation
centerY
number 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
right
Parameters:
Name Type Description centerX
number horizontal position of the center of the rotation
centerY
number vertical position of the center of the rotation
right
boolean 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 name
string name of the property
args
array array of arguments of the specified property
-
setRotate(deg, centerX, centerY)
-
set rotate to the specified values
Parameters:
Name Type Description deg
number angle of the rotation in degrees
centerX
number horizontal position of the center of the rotation
centerY
number vertical position of the center of the rotation
-
setTranslate(x, y)
-
set translate to the specified values
Parameters:
Name Type Description x
number horizontal translation
y
number vertical translation
-
toGridPixels(appInstance)
-
convert distances from SVG pixels to grid pixels
Parameters:
Name Type Description appInstance
App instance of App
-
toSVGPixels(appInstance)
-
convert distances from grid pixels to SVG pixels
Parameters:
Name Type Description appInstance
App instance of App