Find general v2 changes here
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