Element
Functions
- getType([fabricType]) ⇒
String
Gets the type of an element.
- isSVG() ⇒
Boolean
Checks if the element is a SVG.
- isColorizable() ⇒
Boolean
Checks if the element is colorizable.
- isBitmap() ⇒
Boolean
Checks if the element is a bitmap image.
- hasColorSelection() ⇒
Boolean
Checks if the element has a color selection.
- checkEditable(checkProps) ⇒
Boolean
Checks if the element can be edited by the user.
- changeColor(colorData, [colorLinking]) ⇐
fabric.Canvas
Changes the color of an element.
- setPattern(patternUrl) ⇐
fabric.Canvas
Sets the pattern for an element.
- getZIndex() ⇒
Number
Gets the z-index of an element.
- centerElement([hCenter], [vCenter]) ⇐
fabric.Object
Centers an element horizontal or/and vertical.
- getBoundingBoxCoords(element) ⇒
Object
|Boolean
Returns the bounding box of an element.
- getClippingObject() ⇒
Object
|fabric.Object
Gets the object for the clipping. Could be an object with coordinates or a fabric.Object.
- getElementJSON([addPropertiesToInclude], [propertyKeys]) ⇒
Object
Gets the JSON representation of the element.
- alignToPosition([pos]) ⇐
fabric.Canvas
Aligns an element.
- toggleUploadZone() ⇐
fabric.Canvas
Toggles the visibility of an upload zone. The upload zone is visible if it contains an element and hidden when empty.
getType([fabricType]) ⇒ String
Gets the type of an element.
Kind: global function
Extends: fabric.Canvas
Returns: String
- The element type - text or image.
Param | Type | Description |
---|---|---|
[fabricType] | String | Checks this fabrich type instead of this. |
isSVG() ⇒ Boolean
Checks if the element is a SVG.
Kind: global function
Extends: fabric.Canvas
Returns: Boolean
- State
isColorizable() ⇒ Boolean
Checks if the element is colorizable.
Kind: global function
Extends: fabric.Canvas
Returns: Boolean
- State
isBitmap() ⇒ Boolean
Checks if the element is a bitmap image.
Kind: global function
Extends: fabric.Canvas
Returns: Boolean
- State
hasColorSelection() ⇒ Boolean
Checks if the element has a color selection.
Kind: global function
Extends: fabric.Canvas
Returns: Boolean
- State
checkEditable(checkProps) ⇒ Boolean
Checks if the element can be edited by the user.
Kind: global function
Extends: fabric.Canvas
Returns: Boolean
- Editable state
Param | Type | Description |
---|---|---|
checkProps | Object | Pass an object of properties instead of using this element. |
changeColor(colorData, [colorLinking]) ⇐ fabric.Canvas
Changes the color of an element.
Kind: global function
Extends: fabric.Canvas
Param | Type | Default | Description |
---|---|---|---|
colorData | String | Array | Hex color value or any array of hex color values. | |
[colorLinking] | Boolean | true | If element is color linked, execute it. |
setPattern(patternUrl) ⇐ fabric.Canvas
Sets the pattern for an element.
Kind: global function
Extends: fabric.Canvas
Param | Type | Description |
---|---|---|
patternUrl | String | The URL of the image used as pattern. |
getZIndex() ⇒ Number
Gets the z-index of an element.
Kind: global function
Extends: fabric.Object
Returns: Number
- The z-index.
centerElement([hCenter], [vCenter]) ⇐ fabric.Object
Centers an element horizontal or/and vertical.
Kind: global function
Extends: fabric.Object
Param | Type | Default | Description |
---|---|---|---|
[hCenter] | Boolean | true | Center horizontal. |
[vCenter] | Boolean | true | Center vertical. |
getBoundingBoxCoords(element) ⇒ Object
| Boolean
Returns the bounding box of an element.
Kind: global function
Returns: Object
| Boolean
- The bounding box object with x,y,width and height or false.
Param | Type | Description |
---|---|---|
element | fabric.Object | A fabric object |
getClippingObject() ⇒ Object
| fabric.Object
Gets the object for the clipping. Could be an object with coordinates or a fabric.Object.
Kind: global function
Extends: fabric.Canvas
Returns: Object
| fabric.Object
- The object used for clipping.
getElementJSON([addPropertiesToInclude], [propertyKeys]) ⇒ Object
Gets the JSON representation of the element.
Kind: global function
Extends: fabric.Canvas
Returns: Object
- A JSON representation of the element.
Param | Type | Default | Description |
---|---|---|---|
[addPropertiesToInclude] | Boolean | false | Add properties from propertiesToInclude property. |
[propertyKeys] | Array | [] | Addtional property keys to include. |
alignToPosition([pos]) ⇐ fabric.Canvas
Aligns an element.
Kind: global function
Extends: fabric.Canvas
Param | Type | Default | Description |
---|---|---|---|
[pos] | String | 'left' | Allowed values: left, right, top or bottom. |
toggleUploadZone() ⇐ fabric.Canvas
Toggles the visibility of an upload zone. The upload zone is visible if it contains an element and hidden when empty.
Kind: global function
Extends: fabric.Canvas