Find general v2 changes here
Mostly svg fixes for this release, on input and output
- Fix: Shift click and onSelect function #5348 - Fix: Load from Json from images with filters and resize filters #5346
- Fix: add clipPath to stateful cache check. #5384 - Fix: restore draggability of small objects #5379 - Improvement: Added strokeDashOffset to objects and from SVG import. #5398 - Fix: do not mark objects as invisible if strokeWidth is > 0 #5382 - Improvement: Better gradients parsing with xlink:href #5357
An handfull of fixes for group and clipPaths, Image serializations and filters, click interactions
- Fix: Shift click and onSelect function #5348 - Fix: Load from Json from images with filters and resize filters #5346 - Fix: Remove special case of 1x1 rect #5345 - Fix: Group with clipPath restore #5344 - Fix: Fix shift + click interaction with unselectable objects #5324
Clippath to SVG fixed, a couple of nice bugfix for targeting in nested groups and svg loading on ie11
- Fix: Better toSVG support to enable clipPath #5284 - Fix: Per pixel target find and groups and sub targets #5287 - Fix: Object clone as Image and shadow clipping #5308 - Fix: IE11 loading SVG #5307
First round of feedback for clipPath bugs, plus other bugfixes that piledup while working on clipPaths
- Fix: Avoid enterEditing if another object is the activeObject #5261 - Fix: clipPath enliving for Image fromObject #5279 - Fix: toDataURL and canvas clipPath #5278 - Fix: early return if no xml is available #5263 - Fix: clipPath svg parsing in nodejs #5262 - Fix: Avoid running selection logic on mouse up #5259 - Fix: fix font size parsing on SVG #5258 - Fix: Avoid extra renders on mouseUp/Down #5256
Launched clipPath support, check tutorial for more info ClipPath tutorials
Fixed a regression in spray brush created by the 2.3.5 group fix.
Make the image class aware of natural dimensions of the image element if available and restored two fingers events that were broken since we improved the normal events.
The issue of iText interaction fixed in 2.3.5 has been reopened with a less common interaction problem. We are working on automated interaction tests before fixing it.
- Fix: Make image.class aware of naturalWidth and naturalHeight. #5178 - Fix: Make 2 finger events works again #5177 - Fix: Make Groups respect origin and correct position ( fix spray/circle brushes ) #5176
2 notable changes! from now canvas.getObjects() will return a copy of the array of objects. The documentation was never clear about what was given back. Not returning a copy was creating subtle strange bugs that often took hours to debug. Also resize filters and color filters should interact properly with each other now. On top of this minor improvements in svg import export.
- Change: make canvas.getObjects() always return a shallow copy of the array #5162 - Fix: Improve fabric.Pattern.toSVG to look correct on offsets and no-repeat #5164 - Fix: Do not enter edit in Itext if the mouseUp is relative to a group selector #5153 - Improvement: Do not require xlink namespace in front of href attribut for svgs ( is a SVG2 new spec, unsupported ) #5156 - Fix: fix resizeFilter having the wrong cached texture, also improved interaction between filters #5165
Lot of bug fixes and improvement by contributors. A big news: we have an automated visual tests suite that works across browser, node and travis.
- Fix: ToSVG was ignoring excludeFromExport for backgroundImage and OverlayImage. #5075 - Fix: ToSVG for circle with start and end angles. #5085 - Fix: Added callback for setPatternFill. #5101 - Fix: Resize filter taking in account multiple scale sources. #5117 - Fix: Blend image filter clean after refilter. #5121 - Fix: Object.toDataURL should not be influenced by zoom. #5139 - Improvement: requestRenderAllBound add to Canvas instance. #5138 - Improvement: Make path bounding cache optional and also reacheable/cleanable #5140 - Improvement: Make the logic of isNeutralState filters work before filtering start. #5129 - Improvement: Added some code to clean up some memory when canvas is disposed in nodejs. #5142 - Fix: Make numeric origins work with group creation. #5143
Some well reported bug got easily fixed. Generic fonts like serif, sans-serif, monospace works again.
We were quoting the font name for all fonts in order to avoid problem with fonts starting with numbers or with spaces in the family name, but it looks like that you cannot do that for serif, sans-serif, fantasy, monospace and cursive. Those are sort of reserved name and must be used without quotes.
Fabric was leaving trails of text selection if a fast zoom would happen when an itext had selected text or blinking cursor. While this is an edge case created by developers, the fix was fairly easy and so we fixed it.
Also zero width characters were correctly measured but then wrongly retrieved from measuring cache. That whould mean that text would break and also that there was a performance hit ( very small ) since a 0 width joiner, spacer, non joiner was always measured and never returned from cache. All the fix have been handled in a single PR that you can check here:
Lot of small IText fixes and a group caching bug removed.
- Fix: justify + charspacing + textDecoration Add and improve more events for transformations and mouse interaction. #5007 #5009 - Fix: Enter edit on object selected programmatically. #5010 - Fix: Canvas.dispose was not removing all events properly. #5020 - Fix: Make rgba and hsla regex work case insensitive. #5017 - Fix: Make group transitioning from not cached to cached work. #5021
Added new events and a performance improvement for pixel transparency on cached object.
Cached objects gets now sampled directly on their cached to check for transparency without a repaint.
Check the new events here
- Add and improve more events for transformations and mouse interaction #4979 - Improvement: whenever possible use cache for target transparency sampling #4955
Just fixes to brushes, filters and events mostly coming from contributors.
A new method is added isPartiallyOnscreen for objects, helps you identify when the object is crossing your viewport boundaries and an important bug in statefull processing is fixed that was causing type errors when comparing an array with null or an object with null or a string
- Fix getPointer on touch devices #4866 - Fix issues with selectionDashArray bleeding into free drawing #4894 - Fix blur filter for nodejs #4905 - Fix Register mousemove as non passive to help touch devices #4933 - Fix modified shadow tosvg for safari compatibility #4934 - Fix shader to avoid premultiplied alpha pixel getting dirty in blend filter #4936 - Add isPartiallyOnScreen method #4856 - Fix isEqual failing on array/null or objects/null/string compare #4949 - Fix pencilBrush with alpha and with rerendering canvas #4938
There are mixed changes. Most of them are about toSVG and fromSVG without new big features.
There 2 changes that may interests you and change how your code behaves:
When rotating an object by mouse, the origins are no more forced to be centered, that means that top and left of the rotating object will not change to centerPoint without you asking for that. Top and Left will change accordingly to what you see on screen, like it happens for scale, skew and translate. Is a good change, but it may be considered a behaviour change. I did not feel like leave it like this nor to issue a major version for it.
Another change is that setSrc on image is also going to reset width and heigth to the one of the element. Since width and height now crop an image or just render it with white space around if dimensions do not match, changing width and heigth back to default is something that i consider a bugfix. If you built a feature between 2.0 and 2.2.2 that rely on swapping image sources and not changing widht and height, this may gonna break.
- improvement: Allow to parse quoted url string. url('#myid') #4881 - improvement: text fromSVG import char-spacing attribute #3718 - fix: text toSVG export with multiple spaces in safari #4880 - fix: setSrc reset width and height on images #4877 - improvements: Removed forced origin swap when rotating #4878 - fix: Make the background of canvas cover all SVG in toSVG export #4852 - fix: Added startAngle to cacheProperties for fabric.Circle #4875 - fix: Rerender all the content of upperCanvas if canvas gets resized #4850 - fix: Remove references to context when disposing #4846 - improvements: Added single quoting to font names in toSVG #4840 - improvements: Added reserved space to wrapLine functionality #4841
- Fixed: Applying filters to an image will invalidate its cache #4828 - Fixed: Attempt at fix font families that requires quoting #4831 - Improvement: check upperCanvas client size for textarea position #4827 - Fixed: Attempt to fix multiple touchends #4804 - Fixed: Wrapping of textbox with charspacing #4803 - Fixed: bad calculation of empty line in text (regression from 2.2.0) #4802
New feature: superscript and subscript! check the demo to see how to activate it, along with the docs.
Fixes to text kerning with fonts that have a positive kerning on couples
- Fixed: super/sub script svg export #4780 - Added: Text superScript and subScript support #4765 - Fixed: negative kerning support (Pacifico font) #4772 - Fixed: removing text on mousedown should be safe now #4774 - Improved: pass to inner functions the parameter calculate coords in isOnscreen #4763
New events! now objects and canvas can fire
Refer to our events demo for an introduction, specific demo coming soon: Events demo.
Also an important fix for styled textboxes, and more to come, since some methods are marked as broken in the current JSDOC sources.
Since it has been requested, the amd footer has been inserted in the standard fabricjs build, removing the need to have 2 files built every time.
- Added: Drag and drop event binding #4421 - Fixed: isEmptyStyle implementation for TextBox #4762
This time is contributors time! @boomayao noticed that the pencilBrush was doing too much work and wrote a function to draw just the new segment, @stefanhayden fixed the clanStyle function for text styles, @scriptspry fixed a weird interaction between onBeforeScaleRotate and canvasZoom, @blucobalto repoted the exact line and problem of a group subclass problem.
- Fix: now sub target check can work with subclasses of fabric.Group #4753 - Improvement: PencilBrush is now compexity 1 instead of complexity N during draw #4743 - Fix the cleanStyle was not checking for the right property to exist #4751 - Fix onBeforeScaleRotate with canvas zoom #4734
Fix image toSVG export for images with cropping. Improved math around coordinates to avoid long decimals
Fix a bad mutation problem for filters in Image restore from JSON, also the interaction between retina and dataURL. Both bugfixes coming from contributors.
- fixed filter for blend image in WEBGL - fixed interactions between canvas toDataURL and multiplier + retina - fixed bug with originX and originY not invalidating the transform - fixed unwanted mutation on object enliving in fabric.Image