1. Methods
1.1.
鼠标执行滑轮方法
1.2.
将对象分为两组,一组立即呈现,另一组作为activeGroup呈现。
1.3.
Sets the cursor depending on where the canvas is being hovered. Note: very buggy in Opera
根据画布的悬停位置设置光标。注意:在Opera中有很多bug
1.4.
绝对定位,左上角
1.5.
Adds objects to collection, Canvas or Group, then renders canvas (if renderOnAddRemove
is not false
). in case of Group no changes to bounding box are made. Objects should be instances of (or inherit from) fabric.Object Use of this function is highly discouraged for groups. you can add a bunch of objects with the add method but then you NEED to run a addWithUpdate call for the Group class or position/bbox will be wrong.
将对象添加到集合、画布或组中,然后呈现画布(如果“renderOnAddRemove”不是“false”)。在组的情况下,不改变边界框。对象应该是fabric的实例(或继承自fabric)。不鼓励使用此函数的对象。你可以用add方法添加一堆对象,但是你需要为Group类或者position/bbox运行一个addWithUpdate调用。
1.6.
Moves an object or a selection up in stack of drawn objects An optional paramter, intersecting allowes to move the object in front of the first intersecting object. Where intersection is calculated with bounding box. If no intersection is found, there will not be change in the stack.
在绘制对象堆栈中向上移动一个对象或一个选择项(可选参数),相贯允许将该对象移动到第一个相贯对象的前面。其中交集用边界框计算。如果没有找到交集,则堆栈中不会有更改。
1.7.
Moves an object or the objects of a multiple selection to the top of the stack of drawn objects
将一个对象或多个选择项的对象移动到绘制对象堆栈的顶部
1.8.
Calculates canvas element offset relative to the document This method is also attached as "resize" event handler of window
计算画布元素相对于文档的偏移量,此方法也附加为窗口的“resize”事件处理程序
1.9.
Calculate the position of the 4 corner of canvas with current viewportTransform. helps to determinate when an object is in the current rendering viewport using object absolute coordinates ( aCoords )
使用当前viewportTransform计算画布的4个角的位置。使用对象绝对坐标(aCoords)帮助确定对象何时处于当前呈现视图中
1.10.
Centers object vertically and horizontally in the canvas
在画布中垂直和水平居中对象
1.11.
Centers object horizontally in the canvas
在画布中水平居中对象
1.12.
Centers object vertically in the canvas
在画布中垂直居中对象
1.13.
Clears all contexts (background, main, top) of an instance
清除实例的所有上下文(背景、主、顶)
1.14.
Clears specified context of canvas element
清除指定的画布元素上下文
1.15.
Returns number representation of a collection complexity
返回集合复杂度的数字表示形式
1.16.
Returns true if collection contains an object
如果集合包含对象,则返回true
1.17.
Checks if point is contained within an area of given object
检查点是否包含在给定对象的区域内
1.18.
Creates markup containing SVG font faces, font URLs for font faces must be collected by developers and are not extracted from the DOM by fabricjs
创建包含SVG字体外观的标记,字体外观的字体url必须由开发人员收集,而不是由fabricjs从DOM中提取
1.19.
Creates markup containing SVG referenced elements like patterns, gradients etc.
创建包含SVG引用元素(如模式、梯度等)的标记。
1.20.
Discards currently active object and fire events. If the function is called by fabric as a consequence of a mouse event, the event is passed as a parameter and sent to the fire function for the custom events. When used as a method the e param does not have any application.
丢弃当前活动的对象和火灾事件。如果fabric由于鼠标事件而调用该函数,则将该事件作为参数传递,并将其发送给fire函数以处理自定义事件。当作为方法使用时,e参数没有任何应用。
1.21.
Clears a canvas element and removes all event listeners
清除画布元素并删除所有事件监听器
1.22.
Method that determines what object we are clicking on the skipGroup parameter is for internal use, is needed for shift+click action 11/09/2018 TODO: would be cool if findTarget could discern between being a full target or the outside part of the corner.
1.23.
Executes given function for each object in this group
循环遍历对象
1.24.
Centers object horizontally with animation.
带动画的水平居中
1.25.
Centers object vertically with animation.
带动画的垂直居中
1.26.
Same as fabric.Canvas#remove
but animated
带动画的删除
1.27.
带动画的拉伸对象
1.28.
获取活动的对象
Returns currently active object
1.29.
Returns an array with the current selected objects
获取活动的对象数组
1.30.
Returns coordinates of a center of canvas. Returned value is an object with top and left properties
中心点
1.31.
Returns context of canvas where objects are drawn
返回绘制对象的canvas上下文
1.32.
Returns <canvas> element corresponding to this instance
返回dom元素
1.33.
Returns canvas height (in px)
获取高度
1.34.
Returns an array of children objects of this instance Type parameter introduced in 1.3.10 since 2.3.5 this method return always a COPY of the array;
获取对象
1.35.
Returns pointer coordinates relative to canvas. Can return coordinates with or without viewportTransform. ignoreZoom false gives back coordinates that represent the point clicked on canvas element. ignoreZoom true gives back coordinates after being processed by the viewportTransform ( sort of coordinates of what is displayed on the canvas where you are clicking. ignoreZoom true = HTMLElement coordinates relative to top,left ignoreZoom false, default = fabric space coordinates, the same used for shape position To interact with your shapes top and left you want to use ignoreZoom true most of the time, while ignoreZoom false will give you coordinates compatible with the object.oCoords system. of the time.
返回点
1.36.
Returns context of canvas where object selection is drawn
获取选中的上下文
1.37.
Returns <canvas> element on which object selection is drawn
获取选中的canvas元素
1.38.
Calculate the point in canvas that correspond to the center of actual viewport.
计算画布中对应于实际视口中心的点。
1.39.
Returns canvas width (in px)
返回宽度
1.40.
Returns canvas zoom level
返回鼠标缩放级别
1.41.
Constructor
构造函数
1.42.
Inserts an object into collection at specified index, then renders canvas (if renderOnAddRemove
is not false
) An object should be an instance of (or inherit from) fabric.Object Use of this function is highly discouraged for groups. you can add a bunch of objects with the insertAt method but then you NEED to run a addWithUpdate call for the Group class or position/bbox will be wrong.
在指定索引处将对象插入集合,然后呈现画布(如果“renderOnAddRemove”不是“false”),则对象应是结构的实例(或继承自结构)。对于组,强烈建议不使用此函数的对象。您可以使用insertAt方法添加一组对象,但是您需要为组类运行addWithUpdate调用,否则position/bbox将出错。
1.43.
Returns true if collection contains no objects
如果集合为空,则返回true
1.44.
Returns true if object is transparent at a certain location
如果对象在某个位置是透明的,则返回true
1.45.
Returns object at specified index
返回指定索引处的对象
1.46.
Populates canvas with data from the specified dataless JSON. JSON format must conform to the one of fabric.Canvas#toDatalessJSON
使用指定的无数据JSON中的数据填充画布。JSON格式必须与fabric.Canvas#toDatalessJSON格式一致
1.47.
Populates canvas with data from the specified JSON. JSON format must conform to the one of fabric.Canvas#toJSON
使用指定JSON中的数据填充画布。JSON格式必须与fabric.Canvas#toJSON格式一致
1.48.
Moves an object to specified level in stack of drawn objects
将对象移动到绘制对象堆栈中的指定级别
1.49.
Pans viewpoint relatively
相对平移
1.50.
Removes objects from a collection, then renders canvas (if renderOnAddRemove
is not false
)
从集合中移除对象,然后呈现画布
1.51.
Renders both the top canvas and the secondary container canvas.
渲染顶部画布和辅助容器画布。
1.52.
Renders background, objects, overlay and controls.
渲染背景,对象,覆盖和控制。
1.53.
Method to render only the top canvas. Also used to render the group selection box.
方法仅呈现顶层画布。也用于渲染组选择框。
1.54.
Append a renderAll request to next animation frame. unless one is already in progress, in that case nothing is done a boolean flag will avoid appending more.
向下一个动画帧追加一个renderAll请求。除非一个已经在进行中,否则在这种情况下什么也不做布尔标志将避免附加更多。
1.55.
Returns pointer coordinates without the effect of the viewport
返回不受视口影响的指针坐标
1.56.
Moves an object or a selection down in stack of drawn objects An optional paramter, intersecting allowes to move the object in behind the first intersecting object. Where intersection is calculated with bounding box. If no intersection is found, there will not be change in the stack.
在绘制对象堆栈中向下移动一个对象或一个选择项(可选参数),相贯允许将该对象移动到第一个相贯对象的后面。其中交集用边界框计算。如果没有找到交集,则堆栈中不会有更改。
1.57.
Moves an object or the objects of a multiple selection to the bottom of the stack of drawn objects
将一个对象或多个选择项的对象移动到绘制对象堆栈的底部
1.58.
Sets given object as the only active object on canvas
将给定对象设置为画布上唯一的活动对象
1.59.
Sets background color for this canvas
设置此画布的背景颜色
1.60.
Sets background image for this canvas
设置背景色
1.61.
Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em)
设置画布实例的尺寸(宽度、高度)。
1.62.
Sets height of this canvas instance
设置高度
1.63.
Sets foreground color for this canvas
设置此画布的前景色
1.64.
Sets overlay image for this canvas
为这个画布设置叠加图像
1.65.
Sets viewport transform of this canvas instance
设置此画布实例的viewport转换
1.66.
Sets width of this canvas instance
设置此画布实例的宽度
1.67.
Sets zoom level of this canvas instance
设置此画布实例的缩放级别
1.68.
Returns a size of a collection (i.e: length of an array containing its objects)
含它的对象的数组的长度
1.69.
Straightens object, then rerenders canvas
提取对象,然后重新生成画布
1.70.
Returs dataless JSON representation of canvas
返回画布的无数据JSON表示
1.71.
Returns dataless object representation of canvas
返回画布的无数据对象表示
1.72.
导出为 dataURL 图像
1.73.
Returns JSON representation of canvas
转化为json字符串
1.74.
Returns object representation of canvas
转化为对象
1.75.
Returns a string representation of an instance
转化为string
1.76.
Returns SVG representation of canvas
转化为svg
1.77.
Centers object vertically and horizontally in the viewport
在视口中垂直和水平居中对象
1.78.
Centers object horizontally in the viewport, object.top is unchanged
在viewport中水平居中对象
1.79.
Centers object Vertically in the viewport, object.top is unchanged
在viewport中垂直居中对象
1.80.
Sets zoom level of this canvas instance, zoom centered around point
设置此画布实例的缩放级别,缩放以点为中心