fabricjs / fabric.js

Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser
http://fabricjs.com
Other
29.06k stars 3.51k forks source link

a bug when make yellow car smaller #7624

Open xinbingyiran opened 2 years ago

xinbingyiran commented 2 years ago

Version

3.6.0

Test Case

http://fabricjs.com/kitchensink

Information about environment

Microsoft Edge 版本 97.0.1072.62 (官方内部版本) (64 位)

Steps to reproduce

1 Add SVG shapes to canvas: Yellow Car 2 Select car 3 control it smaller , smaller , and smaller (not too smaller to 10*10)

Expected Behavior

a smaller car

Actual Behavior

exception and can't do other step,the console show this:

Uncaught DOMException: Failed to execute 'createPattern' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
    at klass._applyPatternForTransformedGradient (http://fabricjs.com/lib/fabric.js:15671:30)
    at klass._setStrokeStyles (http://fabricjs.com/lib/fabric.js:15414:18)
    at klass._renderStroke (http://fabricjs.com/lib/fabric.js:15633:12)
    at klass._renderPaintInOrder (http://fabricjs.com/lib/fabric.js:15576:14)
    at klass._render (http://fabricjs.com/lib/fabric.js:19516:12)
    at klass.drawObject (http://fabricjs.com/lib/fabric.js:15307:12)
    at klass.render (http://fabricjs.com/lib/fabric.js:15165:14)
    at klass.drawObject (http://fabricjs.com/lib/fabric.js:20087:26)
    at klass.renderCache (http://fabricjs.com/lib/fabric.js:15180:14)
    at klass.render (http://fabricjs.com/lib/fabric.js:15159:14)
graphics-et-al commented 2 years ago

7798 might be relevant- check the SVG for paths that have gradients as their stroke.