fabric 5.0.0 → 5.1.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 +12 -0
- package/HEADER.js +1 -1
- package/dist/fabric.js +56 -23
- package/dist/fabric.min.js +1 -1
- package/package.json +87 -90
- package/src/filters/blendcolor_filter.class.js +6 -0
- package/src/filters/blendimage_filter.class.js +3 -2
- package/src/filters/blur_filter.class.js +2 -0
- package/src/filters/colormatrix_filter.class.js +3 -1
- package/src/shapes/object.class.js +1 -0
- package/src/static_canvas.class.js +0 -4
- package/src/util/animate.js +40 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.1.0]
|
|
4
|
+
|
|
5
|
+
- build(deps): bump node-fetch from 2.6.6 to 2.6.7 [`#7684`](https://github.com/fabricjs/fabric.js/pull/7684)
|
|
6
|
+
- build(deps): bump follow-redirects from 1.14.6 to 1.14.8 [`#7683`](https://github.com/fabricjs/fabric.js/pull/7683)
|
|
7
|
+
- build(deps): bump simple-get from 3.1.0 to 3.1.1 [`#7682`](https://github.com/fabricjs/fabric.js/pull/7682)
|
|
8
|
+
- build(deps): bump engine.io from 6.1.0 to 6.1.2 [`#7681`](https://github.com/fabricjs/fabric.js/pull/7681)
|
|
9
|
+
- fix(test): Remove expect assertion [`#7678`](https://github.com/fabricjs/fabric.js/pull/7678)
|
|
10
|
+
- docs(blendimage_filter.class.js) corrected mode options [`#7672`](https://github.com/fabricjs/fabric.js/pull/7672)
|
|
11
|
+
- chore(): Update bug_report.md [`#7659`](https://github.com/fabricjs/fabric.js/pull/7659)
|
|
12
|
+
- fix(util.animation): remove extra animation cancel [`#7631`](https://github.com/fabricjs/fabric.js/pull/7631)
|
|
13
|
+
- feat(animation): Support a list of animation values for animating matrices changes [`#7633`](https://github.com/fabricjs/fabric.js/pull/7633)
|
|
14
|
+
- ci(tests): windows and linux paths resolutions [`#7635`](https://github.com/fabricjs/fabric.js/pull/7635)
|
|
3
15
|
|
|
4
16
|
## [5.0.0]
|
|
5
17
|
|
package/HEADER.js
CHANGED
package/dist/fabric.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* build: `node build.js modules=ALL exclude=gestures,accessors,erasing requirejs minifier=uglifyjs` */
|
|
2
2
|
/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
|
|
3
3
|
|
|
4
|
-
var fabric = fabric || { version: '5.
|
|
4
|
+
var fabric = fabric || { version: '5.1.0' };
|
|
5
5
|
if (typeof exports !== 'undefined') {
|
|
6
6
|
exports.fabric = fabric;
|
|
7
7
|
}
|
|
@@ -3577,19 +3577,34 @@ fabric.warn = console.warn;
|
|
|
3577
3577
|
|
|
3578
3578
|
/**
|
|
3579
3579
|
* @typedef {Object} AnimationOptions
|
|
3580
|
-
*
|
|
3581
|
-
*
|
|
3582
|
-
*
|
|
3583
|
-
*
|
|
3584
|
-
*
|
|
3585
|
-
*
|
|
3586
|
-
*
|
|
3587
|
-
*
|
|
3580
|
+
* Animation of a value or list of values.
|
|
3581
|
+
* When using lists, think of something like this:
|
|
3582
|
+
* fabric.util.animate({
|
|
3583
|
+
* startValue: [1, 2, 3],
|
|
3584
|
+
* endValue: [2, 4, 6],
|
|
3585
|
+
* onChange: function([a, b, c]) {
|
|
3586
|
+
* canvas.zoomToPoint({x: b, y: c}, a)
|
|
3587
|
+
* canvas.renderAll()
|
|
3588
|
+
* }
|
|
3589
|
+
* });
|
|
3590
|
+
* @example
|
|
3591
|
+
* @property {Function} [onChange] Callback; invoked on every value change
|
|
3592
|
+
* @property {Function} [onComplete] Callback; invoked when value change is completed
|
|
3593
|
+
* @example
|
|
3594
|
+
* // Note: startValue, endValue, and byValue must match the type
|
|
3595
|
+
* var animationOptions = { startValue: 0, endValue: 1, byValue: 0.25 }
|
|
3596
|
+
* var animationOptions = { startValue: [0, 1], endValue: [1, 2], byValue: [0.25, 0.25] }
|
|
3597
|
+
* @property {number | number[]} [startValue=0] Starting value
|
|
3598
|
+
* @property {number | number[]} [endValue=100] Ending value
|
|
3599
|
+
* @property {number | number[]} [byValue=100] Value to modify the property by
|
|
3600
|
+
* @property {Function} [easing] Easing function
|
|
3601
|
+
* @property {Number} [duration=500] Duration of change (in ms)
|
|
3602
|
+
* @property {Function} [abort] Additional function with logic. If returns true, animation aborts.
|
|
3588
3603
|
*
|
|
3589
3604
|
* @typedef {() => void} CancelFunction
|
|
3590
3605
|
*
|
|
3591
3606
|
* @typedef {Object} AnimationCurrentState
|
|
3592
|
-
* @property {number} currentValue value in range [`startValue`, `endValue`]
|
|
3607
|
+
* @property {number | number[]} currentValue value in range [`startValue`, `endValue`]
|
|
3593
3608
|
* @property {number} completionRate value in range [0, 1]
|
|
3594
3609
|
* @property {number} durationRate value in range [0, 1]
|
|
3595
3610
|
*
|
|
@@ -3694,6 +3709,10 @@ fabric.warn = console.warn;
|
|
|
3694
3709
|
* Changes value from one to another within certain period of time, invoking callbacks as value is being changed.
|
|
3695
3710
|
* @memberOf fabric.util
|
|
3696
3711
|
* @param {AnimationOptions} [options] Animation options
|
|
3712
|
+
* @example
|
|
3713
|
+
* // Note: startValue, endValue, and byValue must match the type
|
|
3714
|
+
* fabric.util.animate({ startValue: 0, endValue: 1, byValue: 0.25 })
|
|
3715
|
+
* fabric.util.animate({ startValue: [0, 1], endValue: [1, 2], byValue: [0.25, 0.25] })
|
|
3697
3716
|
* @returns {CancelFunction} cancel function
|
|
3698
3717
|
*/
|
|
3699
3718
|
function animate(options) {
|
|
@@ -3724,9 +3743,12 @@ fabric.warn = console.warn;
|
|
|
3724
3743
|
abort = options.abort || noop,
|
|
3725
3744
|
onComplete = options.onComplete || noop,
|
|
3726
3745
|
easing = options.easing || defaultEasing,
|
|
3746
|
+
isMany = 'startValue' in options ? options.startValue.length > 0 : false,
|
|
3727
3747
|
startValue = 'startValue' in options ? options.startValue : 0,
|
|
3728
3748
|
endValue = 'endValue' in options ? options.endValue : 100,
|
|
3729
|
-
byValue = options.byValue ||
|
|
3749
|
+
byValue = options.byValue || (isMany ? startValue.map(function(value, i) {
|
|
3750
|
+
return endValue[i] - startValue[i];
|
|
3751
|
+
}) : endValue - startValue);
|
|
3730
3752
|
|
|
3731
3753
|
options.onStart && options.onStart();
|
|
3732
3754
|
|
|
@@ -3734,10 +3756,13 @@ fabric.warn = console.warn;
|
|
|
3734
3756
|
time = ticktime || +new Date();
|
|
3735
3757
|
var currentTime = time > finish ? duration : (time - start),
|
|
3736
3758
|
timePerc = currentTime / duration,
|
|
3737
|
-
current =
|
|
3738
|
-
|
|
3759
|
+
current = isMany ? startValue.map(function(_value, i) {
|
|
3760
|
+
return easing(currentTime, startValue[i], byValue[i], duration);
|
|
3761
|
+
}) : easing(currentTime, startValue, byValue, duration),
|
|
3762
|
+
valuePerc = isMany ? Math.abs((current[0] - startValue[0]) / byValue[0])
|
|
3763
|
+
: Math.abs((current - startValue) / byValue);
|
|
3739
3764
|
// update context
|
|
3740
|
-
context.currentValue = current;
|
|
3765
|
+
context.currentValue = isMany ? current.slice() : current;
|
|
3741
3766
|
context.completionRate = valuePerc;
|
|
3742
3767
|
context.durationRate = timePerc;
|
|
3743
3768
|
if (cancel) {
|
|
@@ -3749,11 +3774,11 @@ fabric.warn = console.warn;
|
|
|
3749
3774
|
}
|
|
3750
3775
|
if (time > finish) {
|
|
3751
3776
|
// update context
|
|
3752
|
-
context.currentValue = endValue;
|
|
3777
|
+
context.currentValue = isMany ? endValue.slice() : endValue;
|
|
3753
3778
|
context.completionRate = 1;
|
|
3754
3779
|
context.durationRate = 1;
|
|
3755
3780
|
// execute callbacks
|
|
3756
|
-
onChange(endValue, 1, 1);
|
|
3781
|
+
onChange(isMany ? endValue.slice() : endValue, 1, 1);
|
|
3757
3782
|
onComplete(endValue, 1, 1);
|
|
3758
3783
|
removeFromRegistry();
|
|
3759
3784
|
return;
|
|
@@ -10503,10 +10528,6 @@ fabric.ElementsParser = function(elements, callback, options, reviver, parsingOp
|
|
|
10503
10528
|
}
|
|
10504
10529
|
this.forEachObject(function(object) {
|
|
10505
10530
|
object.dispose && object.dispose();
|
|
10506
|
-
// animation module is still optional
|
|
10507
|
-
if (fabric.runningAnimations) {
|
|
10508
|
-
fabric.runningAnimations.cancelByTarget(object);
|
|
10509
|
-
}
|
|
10510
10531
|
});
|
|
10511
10532
|
this._objects = [];
|
|
10512
10533
|
if (this.backgroundImage && this.backgroundImage.dispose) {
|
|
@@ -16253,6 +16274,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, /** @lends fabric.Stati
|
|
|
16253
16274
|
|
|
16254
16275
|
/**
|
|
16255
16276
|
* cancel instance's running animations
|
|
16277
|
+
* override if necessary to dispose artifacts such as `clipPath`
|
|
16256
16278
|
*/
|
|
16257
16279
|
dispose: function () {
|
|
16258
16280
|
if (fabric.runningAnimations) {
|
|
@@ -22481,8 +22503,10 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
|
|
|
22481
22503
|
mainParameter: 'matrix',
|
|
22482
22504
|
|
|
22483
22505
|
/**
|
|
22484
|
-
* Lock the colormatrix on the color part, skipping alpha,
|
|
22506
|
+
* Lock the colormatrix on the color part, skipping alpha, mainly for non webgl scenario
|
|
22485
22507
|
* to save some calculation
|
|
22508
|
+
* @type Boolean
|
|
22509
|
+
* @default true
|
|
22486
22510
|
*/
|
|
22487
22511
|
colorsOnly: true,
|
|
22488
22512
|
|
|
@@ -23881,17 +23905,23 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
|
|
|
23881
23905
|
/**
|
|
23882
23906
|
* Color to make the blend operation with. default to a reddish color since black or white
|
|
23883
23907
|
* gives always strong result.
|
|
23908
|
+
* @type String
|
|
23909
|
+
* @default
|
|
23884
23910
|
**/
|
|
23885
23911
|
color: '#F95C63',
|
|
23886
23912
|
|
|
23887
23913
|
/**
|
|
23888
23914
|
* Blend mode for the filter: one of multiply, add, diff, screen, subtract,
|
|
23889
23915
|
* darken, lighten, overlay, exclusion, tint.
|
|
23916
|
+
* @type String
|
|
23917
|
+
* @default
|
|
23890
23918
|
**/
|
|
23891
23919
|
mode: 'multiply',
|
|
23892
23920
|
|
|
23893
23921
|
/**
|
|
23894
23922
|
* alpha value. represent the strength of the blend color operation.
|
|
23923
|
+
* @type Number
|
|
23924
|
+
* @default
|
|
23895
23925
|
**/
|
|
23896
23926
|
alpha: 1,
|
|
23897
23927
|
|
|
@@ -24132,8 +24162,9 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
|
|
|
24132
24162
|
image: null,
|
|
24133
24163
|
|
|
24134
24164
|
/**
|
|
24135
|
-
* Blend mode for the filter
|
|
24136
|
-
*
|
|
24165
|
+
* Blend mode for the filter (one of "multiply", "mask")
|
|
24166
|
+
* @type String
|
|
24167
|
+
* @default
|
|
24137
24168
|
**/
|
|
24138
24169
|
mode: 'multiply',
|
|
24139
24170
|
|
|
@@ -25269,6 +25300,8 @@ fabric.Image.filters.BaseFilter.fromObject = function(object, callback) {
|
|
|
25269
25300
|
* blur value, in percentage of image dimensions.
|
|
25270
25301
|
* specific to keep the image blur constant at different resolutions
|
|
25271
25302
|
* range between 0 and 1.
|
|
25303
|
+
* @type Number
|
|
25304
|
+
* @default
|
|
25272
25305
|
*/
|
|
25273
25306
|
blur: 0,
|
|
25274
25307
|
|