object:modified at the end of a transform or any change when statefull is true
object:rotating while an object is being rotated from the control
object:scaling while an object is being scaled by controls
object:moving while an object is being dragged
object:skewing while an object is being skewed from the controls
before:transform before a transform is is started
before:selection:cleared
selection:cleared
selection:updated
selection:created
path:created after a drawing operation ends and the path is added
mouse:down
mouse:move
mouse:up
mouse:down:before on mouse down,event: before the inner fabric logic runs
mouse:move:before on mouse move,event: before the inner fabric logic runs
mouse:up:before on mouse up,event: before the inner fabric logic runs
mouse:over
mouse:out
mouse:dblclick whenever a native dbl click event fires on the canvas.
event:dragover
event:dragenter
event:dragleave
drop:before before drop event. same native event.event: This is added to handle edge cases
event:drop
after:render at the end of the render process,event: receives the context in the callback
before:render at start the render process,event: receives the context in the callback
Extends
fabric.StaticCanvas
Members
Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas
指示在使用触摸屏并在画布上拖动时是否可以滚动浏览器
Type:
Boolean
Inherited From:
fabric.StaticCanvas#allowTouchScrolling
Source:
fabric.js
,
line 8867
Indicates which key enable alternate action on corner
values: 'altKey', 'shiftKey', 'ctrlKey'.
If `null` or 'none' or any other string that is not a modifier key
feature is disabled feature disabled.
指示在角落上启用交替动作的键
值:'altKey', 'shiftKey', 'ctrlKey'。
如果' null '或'none'或任何其他不是修饰键的字符串
Feature is disabled Feature被禁用。
Type:
String
Since:
1.6.2
Default Value:
shiftKey
Source:
fabric.js
,
line 11629
Indicates which key enable alternative selection
in case of target overlapping with active object
values: 'altKey', 'shiftKey', 'ctrlKey'.
For a series of reason that come from the general expectations on how
things should work, this feature works only for preserveObjectStacking true.
If `null` or 'none' or any other string that is not a modifier key
feature is disabled.
指示启用备选选择的键
如果目标与活动对象重叠
值:'altKey', 'shiftKey', 'ctrlKey'。
因为一系列的原因,来自于人们对如何
事情应该工作,这个特性只工作于preserveObjectStacking true。
如果' null '或'none'或任何其他不是修饰键的字符串
功能是禁用的。
Type:
String
Since:
1.6.5
Source:
fabric.js
,
line 11669
Background color of canvas instance.
Should be set via
fabric.StaticCanvas#setBackgroundColor
.
画布实例的背景色。
应该通过fabric.StaticCanvas#setBackgroundColor设置。
Type:
String
fabric.Pattern
Inherited From:
fabric.StaticCanvas#backgroundColor
Source:
fabric.js
,
line 8797
Background image of canvas instance.
since 2.4.0 image caching is active, please when putting an image as background, add to the
canvas property a reference to the canvas it is on. Otherwise the image cannot detect the zoom
vale. As an alternative you can disable image objectCaching
画布实例的背景图像。
由于2.4.0图像缓存是活动的,请在将图像作为背景时,添加到
Canvas属性是它所在画布的引用。否则,图像无法检测到缩放
淡水河谷。另一种方法是禁用图像objectCaching
Type:
fabric.Image
Inherited From:
fabric.StaticCanvas#backgroundImage
Source:
fabric.js
,
line 8807
if set to false background image is not affected by viewport transform
如果设置为假背景图像不受视口变换的影响
Type:
Boolean
Since:
1.6.3
Inherited From:
fabric.StaticCanvas#backgroundVpt
Default Value:
Source:
fabric.js
,
line 8893
Indicates which key enable centered Transform
values: 'altKey', 'shiftKey', 'ctrlKey'.
If `null` or 'none' or any other string that is not a modifier key
feature is disabled feature disabled.
指示哪个键启用居中变换
值:'altKey', 'shiftKey', 'ctrlKey'。
如果' null '或'none'或任何其他不是修饰键的字符串
Feature is disabled Feature被禁用。
Type:
String
Since:
1.6.2
Default Value:
altKey
Source:
fabric.js
,
line 11618
When true, objects use center point as the origin of rotate transformation.
Backwards incompatibility note:
This property replaces "centerTransform" (Boolean).
当为true时,对象使用中心点作为旋转变换的原点。
注意:此属性将替换“centerTransform”(布尔值)。
Type:
Boolean
Since:
1.3.4
Source:
fabric.js
,
line 11607
When true, objects use center point as the origin of scale transformation.
Backwards incompatibility note:
This property replaces "centerTransform" (Boolean).
当为true时,对象使用中心点作为尺度变换的原点。
注意:此属性将替换“centerTransform”(布尔值)。
Type:
Boolean
Since:
1.3.4
Source:
fabric.js
,
line 11598
a fabricObject that, without stroke define a clipping area with their shape. filled in black
the clipPath object gets used when the canvas has rendered, and the context is placed in the
top left corner of the canvas.
clipPath will clip away controls, if you do not want this to happen use controlsAboveOverlay = true
一个fabricObject,没有描边,用它们的形状定义一个裁剪区域。填充黑色
clipPath对象在画布渲染后被使用,而上下文被放置在
画布的左上角。
clipPath将剪切掉控件,如果你不希望发生这种情况,请使用controlsAboveOverlay = true
Type:
fabric.Object
Inherited From:
fabric.StaticCanvas#clipPath
Source:
fabric.js
,
line 8940
Default element class that's given to wrapper (div) element of canvas
给画布的包装器(div)元素的默认元素类
Type:
String
Default Value:
canvas-container
Source:
fabric.js
,
line 11747
Indicates whether object controls (borders/controls) are rendered above overlay image
指示对象控件(边框/控件)是否呈现在覆盖图像之上
Type:
Boolean
Inherited From:
fabric.StaticCanvas#controlsAboveOverlay
Source:
fabric.js
,
line 8860
When the option is enabled, PointerEvent is used instead of MouseEvent.
当启用该选项时,将使用PointerEvent而不是MouseEvent。
Type:
Boolean
Source:
fabric.js
,
line 11844
When true, canvas is scaled by devicePixelRatio for better rendering on retina screens
当为true时,画布通过devicePixelRatio缩放,以便在视网膜屏幕上更好地渲染
Type:
Boolean
Inherited From:
fabric.StaticCanvas#enableRetinaScaling
Default Value:
Source:
fabric.js
,
line 8908
Indicates whether this canvas will use image smoothing, this is on by default in browsers
指示此画布是否将使用图像平滑,这在浏览器中默认是打开的
Type:
Boolean
Inherited From:
fabric.StaticCanvas#imageSmoothingEnabled
Default Value:
Source:
fabric.js
,
line 8874
Indicates whether toObject/toDatalessObject should include default values
if set to false, takes precedence over the object value.
指示toObject/toDatalessObject是否应包含默认值
如果设置为false,则优先于对象值。
Type:
Boolean
Inherited From:
fabric.StaticCanvas#includeDefaultValues
Default Value:
Source:
fabric.js
,
line 8834
Indicates that canvas is interactive. This property should not be changed.
指示画布是交互式的。不应更改此属性。
Type:
Boolean
Default Value:
Source:
fabric.js
,
line 11636
When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing.
After mousedown, mousemove creates a shape,
and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas.
当为true时,画布上的鼠标事件(mousedown/ mouseremove /mouseup)将导致自由绘制。
按下鼠标后,鼠标移动创建一个形状,
然后mouseup结束它并添加fabric实例。路径的画布上。
Type:
Boolean
Source:
fabric.js
,
line 11782
Tutorials:
Tutorial:
http://fabricjs.com/fabric-intro-part-4#free_drawing
Default cursor value used when moving an object on canvas
在画布上移动对象时使用的默认游标值
Type:
String
Default Value:
Source:
fabric.js
,
line 11718
Cursor value used for disabled elements ( corners with disabled action )
用于禁用元素的游标值(带有禁用动作的角)
Type:
String
Since:
2.0.0
Default Value:
not-allowed
Source:
fabric.js
,
line 11740
Overlay image of canvas instance.
since 2.4.0 image caching is active, please when putting an image as overlay, add to the
canvas property a reference to the canvas it is on. Otherwise the image cannot detect the zoom
vale. As an alternative you can disable image objectCaching
覆盖图像的画布实例。
由于2.4.0图像缓存是活动的,请在将图像作为叠加时,添加到
Canvas属性是它所在画布的引用。否则,图像无法检测到缩放
淡水河谷。另一种方法是禁用图像objectCaching
Type:
fabric.Image
Inherited From:
fabric.StaticCanvas#overlayImage
Source:
fabric.js
,
line 8826
if set to false overlya image is not affected by viewport transform
如果设置为false, overlya图像不受视口变换的影响
Type:
Boolean
Since:
1.6.3
Inherited From:
fabric.StaticCanvas#overlayVpt
Default Value:
Source:
fabric.js
,
line 8901
When true, object detection happens on per-pixel basis rather than on per-bounding-box
当为true时,对象检测按像素而不是按边界框进行
Type:
Boolean
Source:
fabric.js
,
line 11754
Indicates whether objects should remain in current stack position when selected.
When false objects are brought to top and rendered as part of the selection group
指示对象在选中时是否应保持在当前堆栈位置。
当假对象被带到顶部并作为选择组的一部分渲染时
Type:
Boolean
Source:
fabric.js
,
line 11790
Indicates whether
fabric.Collection.add
,
fabric.Collection.insertAt
and
fabric.Collection.remove
,
fabric.StaticCanvas.moveTo, fabric.StaticCanvas.clear and many more, should also re-render canvas.
Disabling this option will not give a performance boost when adding/removing a lot of objects to/from canvas at once
since the renders are quequed and executed one per frame.
Disabling is suggested anyway and managing the renders of the app manually is not a big effort ( canvas.requestRenderAll() )
Left default to true to do not break documentation and old app, fiddles.
指示是否fabric.Collection。添加,fabric.Collection.insertAt和fabric.Collection.remove
fabric.StaticCanvas。moveTo, fabric.StaticCanvas.clear等等,也应该重新渲染画布。
禁用此选项将不会给性能提升时,添加/删除大量的对象/从画布一次
因为渲染是排队和每帧执行一个。
禁用是建议无论如何和管理应用程序的渲染手动不是一个大的努力(canvas.requestRenderAll())
左默认为true不破坏文档和旧的应用程序,fiddles。
Type:
Boolean
Inherited From:
fabric.StaticCanvas#renderOnAddRemove
Default Value:
Source:
fabric.js
,
line 8853
Color of the border of selection (usually slightly darker than color of selection itself)
选区边框的颜色(通常比选区本身的颜色稍深)
Type:
String
Default Value:
rgba(255, 255, 255, 0.3)
Source:
fabric.js
,
line 11690
Select only shapes that are fully contained in the dragged selection rectangle.
只选择完全包含在拖拽选择矩形中的形状。
Type:
Boolean
Source:
fabric.js
,
line 11704
Indicates which key or keys enable multiple click selection
Pass value as a string or array of strings
values: 'altKey', 'shiftKey', 'ctrlKey'.
If `null` or empty or containing any other string that is not a modifier key
feature is disabled.
指示哪个键或哪个键启用多次单击选择
将value作为字符串或字符串数组传递
值:'altKey', 'shiftKey', 'ctrlKey'。
如果' null '或为空或包含任何其他不是修饰键的字符串
功能是禁用的。
Type:
String
Array
Since:
1.6.2
Default Value:
shiftKey
Source:
fabric.js
,
line 11655
Based on vptCoords and object.aCoords, skip rendering of objects that
are not included in current viewport.
May greatly help in applications with crowded canvas and use of zoom/pan
If One of the corner of the bounding box of the object is on the canvas
the objects get rendered.
基于vptCoords和对象。aCoords,跳过对象的渲染
不包含在当前视口中。
可能在拥挤的画布和使用缩放/平移的应用程序中有很大的帮助
如果对象的边框的一个角在画布上
对象被渲染。
Type:
Boolean
Inherited From:
fabric.StaticCanvas#skipOffscreen
Default Value:
Source:
fabric.js
,
line 8931
When true, target detection is skipped. Target detection will return always undefined.
click selection won't work anymore, events will fire with no targets.
if something is selected before setting it to true, it will be deselected at the first click.
area selection will still work. check the `selection` property too.
if you deactivate both, you should look into staticCanvas.
当为true时,将跳过目标检测。目标检测将返回始终未定义。
点击选择不再工作,事件将在没有目标的情况下触发。
如果在设置为true之前选择了某些内容,那么在第一次单击时它将被取消选择。
区域选择仍然有效。检查“selection”属性。
如果禁用了两者,则应该查看staticCanvas。
Type:
Boolean
Source:
fabric.js
,
line 11772
Indicates the distance from the snapAngle the rotation will lock to the snapAngle.
When `null`, the snapThreshold will default to the snapAngle.
指示旋转将锁定的snapAngle到snapAngle的距离。
当' null '时,snapThreshold将默认为snapAngle。
Type:
Number
Since:
1.6.7
Source:
fabric.js
,
line 11807
Indicates if the right click on canvas can output the context menu or not
指示在画布上的右键单击是否可以输出上下文菜单
Type:
Boolean
Since:
1.6.5
Source:
fabric.js
,
line 11815
When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true,
a zoomed canvas will then produce zoomed SVG output.
当为true时,getSvgTransform()将应用StaticCanvas。viewportTransform转换为SVG转换。当真正的,
缩放后的画布将产生缩放后的SVG输出。
Type:
Boolean
Inherited From:
fabric.StaticCanvas#svgViewportTransformation
Default Value:
Source:
fabric.js
,
line 9988
Number of pixels around target pixel to tolerate (consider active) during object detection
目标像素周围的像素数,以容忍(认为活动)在目标检测
Type:
Number
Source:
fabric.js
,
line 11761
When true, objects can be transformed by one side (unproportionally)
when dragged on the corners that normally would not do that.
当为true时,对象可以由一侧转换(不成比例地)
当拖到角落时,通常不会这样做。
Type:
Boolean
Since:
fabric 4.0 // changed name and default value
Default Value:
Source:
fabric.js
,
line 11575
Indicates which key switches uniform scaling.
values: 'altKey', 'shiftKey', 'ctrlKey'.
If `null` or 'none' or any other string that is not a modifier key
feature is disabled.
totally wrong named. this sounds like `uniform scaling`
if Canvas.uniformScaling is true, pressing this will set it to false
and viceversa.
指示哪个键切换均匀缩放。
值:'altKey', 'shiftKey', 'ctrlKey'。
如果' null '或'none'或任何其他不是修饰键的字符串
功能是禁用的。
完全错误的命名。这听起来像"均匀缩放"
如果画布。uniformScaling为true,按下这个将设置为false
,反之亦然。
Type:
String
Since:
1.6.2
Default Value:
shiftKey
Source:
fabric.js
,
line 11589
The transformation (a Canvas 2D API transform matrix) which focuses the viewport
聚焦视口的转换(一个Canvas 2D API转换矩阵)
Type:
Array
Inherited From:
fabric.StaticCanvas#viewportTransform
Source:
fabric.js
,
line 8885
Default transform
canvas.viewportTransform = [1, 0, 0, 1, 0, 0];
Scale by 70% and translate toward bottom-right by 50, without skewing
canvas.viewportTransform = [0.7, 0, 0, 0.7, 50, 50];
Describe canvas element extension over design
properties are tl,tr,bl,br.
if canvas is not zoomed/panned those points are the four corner of canvas
if canvas is viewportTransformed you those points indicate the extension
of canvas element in plain untrasformed coordinates
The coordinates get updated with @method calcViewportBoundaries.
描述画布元素在设计上的扩展
属性是tl、tr、提单、br。
如果画布没有缩放/平移,这些点是画布的四个角
如果canvas是viewporttransforms,这些点表示扩展
的canvas元素
坐标用@method calcviewportborders更新。
Inherited From:
fabric.StaticCanvas#vptCoords
Source:
fabric.js
,
line 8919
Divides objects in two groups, one to render immediately
and one to render as activeGroup.
将对象分为两组,一组立即呈现
一个渲染为activeGroup。
Source:
fabric.js
,
line 11882
`drop:before` is a an event that allow you to schedule logic
before the `drop` event. Prefer `drop` event always, but if you need
to run some drop-disabling logic on an event, since there is no way
to handle event handlers ordering, use `drop:before`
' drop:before '是一个允许你安排逻辑的事件
在“drop”事件之前。喜欢' drop '事件总是,但如果你需要
在事件上运行一些删除禁用逻辑,因为没有办法
要处理事件处理程序排序,请使用' drop:before '
Parameters:
Description
Sets the cursor depending on where the canvas is being hovered.
Note: very buggy in Opera
根据画布悬停的位置设置光标。
注意:Opera中有很多bug
Parameters:
Description
absolutePan
(point)
→ {
fabric.Canvas
}
Pan viewport so as to place point at top left corner of canvas
平移视口以便放置点在画布的左上角
Parameters:
Description
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的实例(或继承自)。对象
强烈建议对团体使用此功能。
你可以用add方法添加一堆对象,但你需要
对Group类或position/bbox运行addWithUpdate调用将是错误的。
Parameters:
Attributes
Description
bringForward
(object, intersecting
opt
)
→ {
fabric.Canvas
}
Moves an object or a selection up in stack of drawn objects
An optional parameter, intersecting allows 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.
在绘制对象的堆栈中向上移动对象或所选对象
一个可选参数,intersecting允许将对象移动到前面
第一个相交物体的。用什么来计算交集
边界框。如果没有发现交集,则不会有变化
Parameters:
Attributes
Description
bringToFront
(object)
→ {
fabric.Canvas
}
Moves an object or the objects of a multiple selection
to the top of the stack of drawn objects
移动一个对象或多重选择的对象
到绘制对象堆栈的顶部
Parameters:
Description
calcOffset
()
→ {
fabric.Canvas
}
Calculates canvas element offset relative to the document
This method is also attached as "resize" event handler of window
计算画布元素相对于文档的偏移量
此方法还附加为窗口的“调整大小”事件处理程序
Inherited From:
fabric.StaticCanvas#calcOffset
Source:
fabric.js
,
line 9014
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个角的位置。
帮助确定对象何时处于当前呈现视口中
对象绝对坐标
Inherited From:
fabric.StaticCanvas#calcViewportBoundaries
Source:
fabric.js
,
line 9624
centerObject
(object)
→ {
fabric.Canvas
}
Centers object vertically and horizontally in the canvas
将对象在画布中垂直和水平居中
Parameters:
Description
Clones canvas instance without cloning existing data.
This essentially copies canvas dimensions, clipping properties, etc.
but leaves data empty (so that you can populate it with your own)
克隆画布实例而不克隆现有数据。
这基本上复制了画布的尺寸、剪切属性等。
但将数据保留为空(以便您可以用自己的数据填充它)
Parameters:
Attributes
Description
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中提取的
Parameters:
Description
Creates markup containing SVG referenced elements like patterns, gradients etc.
创建包含SVG引用元素的标记,如模式、渐变等。
Inherited From:
fabric.StaticCanvas#createSVGRefElementsMarkup
Source:
fabric.js
,
line 10125
discardActiveObject
(e)
→ {
fabric.Canvas
}
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参数没有任何应用。
Parameters:
Description
findTarget
(e, skipGroup)
→ {
fabric.Object
}
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.
方法,该方法确定所单击的对象
skipGroup参数是内部使用的,是shift+click动作所需要的
TODO:如果findTarget能够分辨是完整的目标,那就太酷了
或者角的外面部分。
Parameters:
Description
Executes given function for each object in this group
为该组中的每个对象执行给定的函数
Parameters:
Description
Callback invoked with current object as first argument,
index - as second and an array of all objects - as third.
Callback is invoked in a context of Global Object (e.g. `window`)
when no `context` argument is given
用当前对象作为第一个参数调用回调,
Index——作为第二个,所有对象的数组——作为第三个。
回调是在全局对象的上下文中调用的。“窗口”)
当没有给出' context '参数时
context
Object
Context (aka thisObject)
上下文(即thisObject)
Centers object horizontally with animation.
以动画水平居中对象。
Parameters:
Attributes
Description
Centers object vertically with animation.
用动画将对象垂直居中。
Parameters:
Attributes
Description
Same as `fabric.Canvas#remove` but animated
一样的面料。帆布#删除但动画
Parameters:
Attributes
Description
fxStraightenObject
(object)
→ {
fabric.Canvas
}
Same as fabric.Canvas.prototype.straightenObject, but animated
fabric.Canvas.prototype一样。straightenObject,但动画
Parameters:
Description
getActiveObjects
()
→ {
fabric.Object
}
Returns an array with the current selected objects
返回包含当前选定对象的数组
Source:
fabric.js
,
line 12526
Returns coordinates of a center of canvas.
Returned value is an object with top and left properties
返回画布中心的坐标。
返回值是一个具有top和left属性的对象
Inherited From:
fabric.StaticCanvas#getCenter
Source:
fabric.js
,
line 9772
Returns context of canvas where objects are drawn
返回绘制对象的画布上下文
Inherited From:
fabric.StaticCanvas#getContext
Source:
fabric.js
,
line 9551
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.3.10中引入
自2.3.5以来,该方法总是返回数组的副本;
Parameters:
Attributes
Description
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.
返回相对于画布的指针坐标。
可以使用viewportTransform或不使用viewportTransform返回坐标。
ignoreZoom false返回表示的坐标
点点在画布元素上。
ignoreZoom true在处理后返回坐标
通过viewportTransform(显示内容的坐标排序)
在您正在单击的画布上。
ignoreZoom true = HTMLElement相对于左上角的坐标
ignoreZoom false,默认=织物空间坐标,与形状位置相同
为了与你的形状的顶部和左边交互,你想使用ignoreZoom true
大多数情况下,ignoreZoom false会给你坐标
与对象兼容。oCoords系统。
Parameters:
Description
Returns context of canvas where object selection is drawn
返回绘制对象选择的画布的上下文
Source:
fabric.js
,
line 12502
Returns <canvas> element on which object selection is drawn
返回绘制对象选择的