-
Notifications
You must be signed in to change notification settings - Fork 0
Fabric gotchas
-
new fabric.Canvas('foo')
wraps<canvas id="foo">
element with a<div>
one, and adds another (absolutely positioned) canvas element on top of existing canvas (the one with id="foo"). This only happens for dynamic canvases (fabric.Canvas
), not static ones (fabric.StaticCanvas
). Also see How fabric canvas layering works. -
When object coordinates/boundaries don't match those detected by selection, you might need to call
object.setCoords()
. This recalculates object's coordinates used to detect its controls. -
When mouse-based group selection has incorrect offset on canvas, you can fix it via
canvas.calcOffset()
. This usually happens when canvas position in a document is changed after canvas is initialized (e.g. if there was an image before that was loaded).