A collection of common methods used for DojoX Drawing. This singleton is accessible in most Drawing classes as this.util
Converts a namespace (typically a tool or a stencil) into an abbreviation
Parameter | Type | Description |
---|---|---|
type | undefined |
Return angle based on mouse object
Parameter | Type | Description |
---|---|---|
obj | EventObject | Manager.Mouse event. |
snap | Float |
Optional Returns nearest angle within snap limits |
Attempts to determine in a Mouse Object was passed or indiviual numbers. Returns an object.
Helper function to attach attributes to SVG and VML raw nodes.
Parameter | Type | Description |
---|---|---|
elem | Object | |
prop | property | |
value | ? value | |
squelchErrors | undefined |
Get an object that was registered with util.register
Parameter | Type | Description |
---|---|---|
id | String |
Ensures the angle in the Mouse Object is within the min and max limits. If not one of those limits is used. Returns an x,y point for the angle used.
Parameter | Type | Description |
---|---|---|
obj | EventObject | |
min | Number | |
max | Number |
Convert the passed number to radians.
Parameter | Type | Description |
---|---|---|
n | Number |
Return the length derived from the coordinates in the Mouse object. Different from util.length in that this always returns an absolute value.
Return the length derived from the coordinates in the Mouse object.
Parameter | Type | Description |
---|---|---|
o | EventObject |
Subtract an amount from a line
x1,y1,x2,y2 represents the Line. 'amt' represents the amount to subtract from it.
Parameter | Type | Description |
---|---|---|
x1 | Number | |
y1 | Number | |
x2 | Number | |
y2 | Number | |
amt | Number |
Parameter | Type | Description |
---|---|---|
o1 | undefined | |
o2 | undefined |
A very helpful method. If you know the center (or starting) point, length and angle, find the x,y point at the end of that line.
Parameter | Type | Description |
---|---|---|
cx | Number | |
cy | Number | |
radius | Number | |
angle | Number |
Return the radians derived from the coordinates in the Mouse object.
Parameter | Type | Description |
---|---|---|
o | EventObject |
Convert the passed number to degrees.
Parameter | Type | Description |
---|---|---|
n | Number |
Since util is the only Singleton in Drawing (besides keys) it is used to help connect the Drawing object the Toolbar. Since multiple drawings can be on one page, this function serves a little more use than on first apearance.
Parameter | Type | Description |
---|---|---|
obj | Object |
Given two poits of a line, returns the slope.
Parameter | Type | Description |
---|---|---|
p1 | Object | |
p2 | Object |
Snaps a line to the nearest angle
Parameter | Type | Description |
---|---|---|
obj | EventObject | |
ca | Float | A decimal number fraction of a half circle.
|
Creates a unique ID.
Parameter | Type | Description |
---|---|---|
str | String |
Optional If provided, kept in a map, incremented and used in the id. Otherwise 'shape' is used. |