Constructor
new SVGPolygon(optsopt)
Creates svgext.SVGPolygon instance
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
polygonOpts |
<optional> |
- Mixes In:
- Source:
Extends
Members
(constant) NS :String
SVG namespace
Type:
- String
- Inherited From:
- Default Value:
- http://www.w3.org/2000/svg
- Source:
Methods
activate() → {SVGElement}
Adds an active class
- Overrides:
- Source:
Fires:
- svgext.SVGElement#event:activated
Returns:
- Type
- SVGElement
addClass(newClass) → {SVGElement}
Adds a new class to the element
Parameters:
Name | Type | Description |
---|---|---|
newClass |
String | Class name or several classes separated by a space |
- Inherited From:
- Source:
Returns:
- Type
- SVGElement
addPoint(point) → {SVGPolygon}
Adds a point to the polygon between two nearest points
Parameters:
Name | Type | Description |
---|---|---|
point |
Point |
- Source:
Returns:
- Type
- SVGPolygon
append(svgElem) → {SVGBlock}
Appends an element
Parameters:
Name | Type | Description |
---|---|---|
svgElem |
SVGElement |
- Mixes In:
- Source:
Returns:
- Type
- SVGBlock
appendElem(node)
Appends svg node
Parameters:
Name | Type | Description |
---|---|---|
node |
SVGNode |
- Mixes In:
- Source:
attr(key, valueopt) → {SVGElement}
SVGElement node attributes setter & getter
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
String | ||
value |
String |
<optional> |
- Inherited From:
- Source:
Fires:
- svgext.SVGElement#event:change[ATTR_NAME]
Returns:
- Type
- SVGElement
bringToFront() → {SVGElement}
Brings an element above another
- Inherited From:
- Source:
Returns:
- Type
- SVGElement
deactivate() → {SVGElement}
Removes an active class
- Overrides:
- Source:
Fires:
- svgext.SVGElement#event:deactivated
Returns:
- Type
- SVGElement
destroy()
Destroys an object
- Overrides:
- Source:
drag()
SVGDraggable drag implementation
- Source:
(abstract) drag(delta)
Changes element position on mouse move
Parameters:
Name | Type | Description |
---|---|---|
delta |
coordinates |
- Mixes In:
- Source:
emit(type, …arguments)
Emits custom event on the element
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
String | ||
arguments |
* |
<repeatable> |
- Inherited From:
- Source:
getContainerRect() → {TextRectangle}
Svg container bounding client rect getter
- Inherited From:
- Source:
Returns:
- Type
- TextRectangle
getRect() → {TextRectangle}
Element bounding client rect getter
- Inherited From:
- Source:
Returns:
- Type
- TextRectangle
getValue(relativeopt) → {*}
Polygon coordinates getter
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
relative |
Boolean |
<optional> |
false |
- Source:
Returns:
- Type
- *
hasClass(className) → {Boolean}
Checks if instance has a class
Parameters:
Name | Type | Description |
---|---|---|
className |
String |
- Inherited From:
- Source:
Returns:
- Type
- Boolean
hide() → {SVGElement}
Hides an elment
- Overrides:
- Source:
Returns:
- Type
- SVGElement
isSimple(highlightopt) → {Boolean}
Checks if polygon doesn't intersect itself
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
highlight |
Boolean |
<optional> |
false | Highlights polygon if it is complex |
- Source:
Returns:
- Type
- Boolean
(abstract) normalizeCoords(delta) → {coordinates}
Checks if a new element position won't cross the border
and changes delta object to avoid border crossing
Parameters:
Name | Type | Description |
---|---|---|
delta |
coordinates |
- Mixes In:
- Source:
Returns:
- Type
- coordinates
normalizeCoords()
SVGDraggable normalizeCoords implementation
- Source:
off(type, listener) → {SVGElement}
Removes an event listener
Parameters:
Name | Type | Description |
---|---|---|
type |
String | Event name |
listener |
function | Event handler |
- Inherited From:
- Source:
Returns:
- Type
- SVGElement
offDoubleTap(tap) → {SVGElement}
Removes double tap event handler
Parameters:
Name | Type | Description |
---|---|---|
tap |
function |
- Inherited From:
- Source:
Returns:
- Type
- SVGElement
on(type, listener) → {SVGElement}
Adds an event listener
Parameters:
Name | Type | Description |
---|---|---|
type |
String | Event name |
listener |
function | Event handler |
- Inherited From:
- Source:
Returns:
- Type
- SVGElement
onAppend(container)
Fires when an element is appended to the DOM
Parameters:
Name | Type | Description |
---|---|---|
container |
SVGBlock | New element container |
- Overrides:
- Source:
onDoubleTap(listener) → {function}
Adds double tap event handler
Parameters:
Name | Type | Description |
---|---|---|
listener |
function |
- Inherited From:
- Source:
Returns:
- Type
- function
remove(svgElem) → {SVGBlock}
Removes an svg element
Parameters:
Name | Type | Description |
---|---|---|
svgElem |
SVGElement |
- Mixes In:
- Source:
Returns:
- Type
- SVGBlock
removeClass(className) → {SVGElement}
Removes class
Parameters:
Name | Type | Description |
---|---|---|
className |
String |
- Inherited From:
- Source:
Returns:
- Type
- SVGElement
removeDndHandlers()
Removes all handlers
- Mixes In:
- Source:
removeElem(node)
Removes svg node
Parameters:
Name | Type | Description |
---|---|---|
node |
SVGNode |
- Mixes In:
- Source:
render() → {SVGPolygon}
Renders a polygon based on vertexes coordinates
- Source:
Returns:
- Type
- SVGPolygon
resize(widthFactor, heightFactor)
Resizes polygon
Parameters:
Name | Type | Description |
---|---|---|
widthFactor |
Number | width resize factor |
heightFactor |
Number | height resize factor |
- Source:
select() → {SVGPolygon}
Activates polygon
- Source:
Returns:
- Type
- SVGPolygon
setPoints(points) → {SVGPolygon}
SVGPolygon points setter
Parameters:
Name | Type | Description |
---|---|---|
points |
Array | SVGPolygon points |
- Source:
Returns:
- Type
- SVGPolygon
show() → {SVGElement}
Shows an elment
- Overrides:
- Source:
Returns:
- Type
- SVGElement