fabric 4.6.0 → 5.0.0-browser
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/HEADER.js +1 -1
- package/README.md +1 -6
- package/SECURITY.md +5 -0
- package/dist/fabric.js +652 -393
- package/dist/fabric.min.js +1 -1
- package/lib/event.js +7 -3
- package/package.json +87 -88
- package/src/brushes/base_brush.class.js +2 -2
- package/src/brushes/pattern_brush.class.js +7 -5
- package/src/brushes/pencil_brush.class.js +33 -4
- package/src/canvas.class.js +9 -17
- package/src/mixins/animation.mixin.js +16 -21
- package/src/mixins/canvas_events.mixin.js +27 -56
- package/src/mixins/eraser_brush.mixin.js +354 -420
- package/src/mixins/itext_behavior.mixin.js +7 -1
- package/src/mixins/object_geometry.mixin.js +3 -34
- package/src/mixins/object_straightening.mixin.js +4 -9
- package/src/parser.js +13 -9
- package/src/shapes/circle.class.js +20 -17
- package/src/shapes/group.class.js +13 -25
- package/src/shapes/image.class.js +3 -3
- package/src/shapes/object.class.js +45 -19
- package/src/shapes/path.class.js +13 -9
- package/src/shapes/polygon.class.js +9 -1
- package/src/shapes/polyline.class.js +33 -9
- package/src/shapes/text.class.js +38 -21
- package/src/static_canvas.class.js +15 -7
- package/src/util/animate.js +146 -22
- package/src/util/misc.js +193 -45
- package/src/util/path.js +2 -56
package/src/util/path.js
CHANGED
|
@@ -507,15 +507,15 @@
|
|
|
507
507
|
p, nextLen, nextStep = 0.01, angleFinder = segInfo.angleFinder, lastPerc;
|
|
508
508
|
// nextStep > 0.0001 covers 0.00015625 that 1/64th of 1/100
|
|
509
509
|
// the path
|
|
510
|
-
while (tmpLen < distance &&
|
|
510
|
+
while (tmpLen < distance && nextStep > 0.0001) {
|
|
511
511
|
p = iterator(perc);
|
|
512
512
|
lastPerc = perc;
|
|
513
513
|
nextLen = calcLineLength(tempP.x, tempP.y, p.x, p.y);
|
|
514
514
|
// compare tmpLen each cycle with distance, decide next perc to test.
|
|
515
515
|
if ((nextLen + tmpLen) > distance) {
|
|
516
516
|
// we discard this step and we make smaller steps.
|
|
517
|
-
nextStep /= 2;
|
|
518
517
|
perc -= nextStep;
|
|
518
|
+
nextStep /= 2;
|
|
519
519
|
}
|
|
520
520
|
else {
|
|
521
521
|
tempP = p;
|
|
@@ -811,50 +811,6 @@
|
|
|
811
811
|
});
|
|
812
812
|
}
|
|
813
813
|
|
|
814
|
-
/**
|
|
815
|
-
* Calculate bounding box of a elliptic-arc
|
|
816
|
-
* @deprecated
|
|
817
|
-
* @param {Number} fx start point of arc
|
|
818
|
-
* @param {Number} fy
|
|
819
|
-
* @param {Number} rx horizontal radius
|
|
820
|
-
* @param {Number} ry vertical radius
|
|
821
|
-
* @param {Number} rot angle of horizontal axis
|
|
822
|
-
* @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points
|
|
823
|
-
* @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction
|
|
824
|
-
* @param {Number} tx end point of arc
|
|
825
|
-
* @param {Number} ty
|
|
826
|
-
*/
|
|
827
|
-
function getBoundsOfArc(fx, fy, rx, ry, rot, large, sweep, tx, ty) {
|
|
828
|
-
|
|
829
|
-
var fromX = 0, fromY = 0, bound, bounds = [],
|
|
830
|
-
segs = arcToSegments(tx - fx, ty - fy, rx, ry, large, sweep, rot);
|
|
831
|
-
|
|
832
|
-
for (var i = 0, len = segs.length; i < len; i++) {
|
|
833
|
-
bound = getBoundsOfCurve(fromX, fromY, segs[i][1], segs[i][2], segs[i][3], segs[i][4], segs[i][5], segs[i][6]);
|
|
834
|
-
bounds.push({ x: bound[0].x + fx, y: bound[0].y + fy });
|
|
835
|
-
bounds.push({ x: bound[1].x + fx, y: bound[1].y + fy });
|
|
836
|
-
fromX = segs[i][5];
|
|
837
|
-
fromY = segs[i][6];
|
|
838
|
-
}
|
|
839
|
-
return bounds;
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
/**
|
|
843
|
-
* Draws arc
|
|
844
|
-
* @deprecated
|
|
845
|
-
* @param {CanvasRenderingContext2D} ctx
|
|
846
|
-
* @param {Number} fx
|
|
847
|
-
* @param {Number} fy
|
|
848
|
-
* @param {Array} coords coords of the arc, without the front 'A/a'
|
|
849
|
-
*/
|
|
850
|
-
function drawArc(ctx, fx, fy, coords) {
|
|
851
|
-
coords = coords.slice(0).unshift('X'); // command A or a does not matter
|
|
852
|
-
var beziers = fromArcToBeziers(fx, fy, coords);
|
|
853
|
-
beziers.forEach(function(bezier) {
|
|
854
|
-
ctx.bezierCurveTo.apply(ctx, bezier.slice(1));
|
|
855
|
-
});
|
|
856
|
-
};
|
|
857
|
-
|
|
858
814
|
/**
|
|
859
815
|
* Join path commands to go back to svg format
|
|
860
816
|
* @param {Array} pathData fabricJS parsed path commands
|
|
@@ -870,14 +826,4 @@
|
|
|
870
826
|
fabric.util.getBoundsOfCurve = getBoundsOfCurve;
|
|
871
827
|
fabric.util.getPointOnPath = getPointOnPath;
|
|
872
828
|
fabric.util.transformPath = transformPath;
|
|
873
|
-
/**
|
|
874
|
-
* Typo of `fromArcToBeziers` kept for not breaking the api once corrected.
|
|
875
|
-
* Will be removed in fabric 5.0
|
|
876
|
-
* @deprecated
|
|
877
|
-
*/
|
|
878
|
-
fabric.util.fromArcToBeizers = fromArcToBeziers;
|
|
879
|
-
// kept because we do not want to make breaking changes.
|
|
880
|
-
// but useless and deprecated.
|
|
881
|
-
fabric.util.getBoundsOfArc = getBoundsOfArc;
|
|
882
|
-
fabric.util.drawArc = drawArc;
|
|
883
829
|
})();
|