Skip to main content

Canvas

Functions

addElement(elements, [callback])fabric.Canvas

Adds a set of elements into the view.

addElement(type, source, title, [parameters])fabric.Canvas

Adds a new element to the view.

resetSize(discardActiveObject)fabric.Canvas

Deselects the current selected element.

resetSize()fabric.Canvas

Resets the canvas size considering the available space on the device.

setResZoom(value)fabric.Canvas

Sets the zoom of the stage. 1 is equal to no zoom.

resetZoom()fabric.Canvas

Resets the the zoom.

getElements()Array

Returns an array with fabricjs objects.

getElementsJSON(title)Object

Returns an fabric object by title.

getElementByTitle(title)Object

Returns an fabric object by title.

getElementByID(id)Object

Returns an fabric object by ID.

reset()fabric.Canvas

Removes the canvas and resets all relevant view properties.

removeElement(element)fabric.Canvas

Removes an element using the fabric object or the title of an element.

getElementByReplace()fabric.Canvas

Gets an elment by replace property.

setElementOptions(parameters, [element])fabric.Canvas

Sets the parameters for a specified element.

duplicateElement(element)fabric.Canvas

Duplicates an element in the canvas.

getUploadZone(title)fabric.Object

Gets an upload zone by title.

setMask(maskOptions, [callback])fabric.Canvas

Use a SVG image as mask for the whole view. The image needs to be a SVG file with only one path. The method toSVG() does not include the mask.

addElement(elements, [callback]) ⇐ fabric.Canvas

Adds a set of elements into the view.

Kind: global function
Extends: fabric.Canvas

ParamTypeDescription
elementsArrayAn array containing elements.
[callback]functionA function that will be called when all elements have beed added.

addElement(type, source, title, [parameters]) ⇐ fabric.Canvas

Adds a new element to the view.

Kind: global function
Extends: fabric.Canvas

ParamTypeDefaultDescription
typestringThe type of an element you would like to add, 'image' or 'text'.
sourcestringFor image the URL to the image and for text elements the default text.
titlestringOnly required for image elements.
[parameters]object{}An object with the parameters, you would like to apply on the element.

resetSize(discardActiveObject) ⇐ fabric.Canvas

Deselects the current selected element.

Kind: global function
Extends: fabric.Canvas

ParamTypeDescription
discardActiveObjectBooleanDiscards currently active object and fire events

resetSize() ⇐ fabric.Canvas

Resets the canvas size considering the available space on the device.

Kind: global function
Extends: fabric.Canvas

setResZoom(value) ⇐ fabric.Canvas

Sets the zoom of the stage. 1 is equal to no zoom.

Kind: global function
Extends: fabric.Canvas

ParamTypeDescription
valuenumberThe zoom value.

resetZoom() ⇐ fabric.Canvas

Resets the the zoom.

Kind: global function
Extends: fabric.Canvas

getElements() ⇒ Array

Returns an array with fabricjs objects.

Kind: global function
Extends: fabric.Canvas
Returns: Array - An array with fabricjs objects.

getElementsJSON(title) ⇒ Object

Returns an fabric object by title.

Kind: global function
Extends: fabric.Canvas
Returns: Object - FabricJS Object.

ParamTypeDescription
titlestringThe title of an element.

getElementByTitle(title) ⇒ Object

Returns an fabric object by title.

Kind: global function
Extends: fabric.Canvas
Returns: Object - FabricJS Object.

ParamTypeDescription
titlestringThe title of an element.

getElementByID(id) ⇒ Object

Returns an fabric object by ID.

Kind: global function
Extends: fabric.Canvas
Returns: Object - FabricJS Object.

ParamTypeDescription
idStringThe ID of an element.

reset() ⇐ fabric.Canvas

Removes the canvas and resets all relevant view properties.

Kind: global function
Extends: fabric.Canvas

removeElement(element) ⇐ fabric.Canvas

Removes an element using the fabric object or the title of an element.

Kind: global function
Extends: fabric.Canvas

ParamTypeDescription
elementobject | stringNeeds to be a fabric object or the title of an element.

getElementByReplace() ⇐ fabric.Canvas

Gets an elment by replace property.

Kind: global function
Extends: fabric.Canvas

setElementOptions(parameters, [element]) ⇐ fabric.Canvas

Sets the parameters for a specified element.

Kind: global function
Extends: fabric.Canvas

ParamTypeDescription
parametersobjectAn object with the parameters that should be applied to the element.
[element]fabric.Object | stringA fabric object or the title of an element. If no element is set, the parameters will be applied to the current selected element.

duplicateElement(element) ⇐ fabric.Canvas

Duplicates an element in the canvas.

Kind: global function
Extends: fabric.Canvas

ParamTypeDescription
elementfabric.ObjectThe target element.

getUploadZone(title) ⇒ fabric.Object

Gets an upload zone by title.

Kind: global function
Extends: fabric.Canvas
Returns: fabric.Object - A fabric object representing the upload zone.

ParamTypeDescription
titleStringThe target title of an element.

setMask(maskOptions, [callback]) ⇐ fabric.Canvas

Use a SVG image as mask for the whole view. The image needs to be a SVG file with only one path. The method toSVG() does not include the mask.

Kind: global function
Extends: fabric.Canvas

ParamTypeDescription
maskOptionsObject | NullAn object containing the URL to the svg. Optional: scaleX, scaleY, left and top.
[callback]functionA function when mask is loaded and set. Returns the mask or null, when mask could not be loaded.