@visactor/vrender 0.16.14-alpha.3 → 0.16.14-alpha.5
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/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.js +169 -162
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +6 -6
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -21,5 +21,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
|
|
22
22
|
const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits");
|
|
23
23
|
|
|
24
|
-
exports.version = "0.16.14-alpha.
|
|
24
|
+
exports.version = "0.16.14-alpha.5", (0, vrender_kits_1.loadAllModule)(vrender_core_1.container),
|
|
25
25
|
__exportStar(require("@visactor/vrender-core"), exports), __exportStar(require("@visactor/vrender-kits"), exports);
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,yDAAuD;AAG1C,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,IAAA,4BAAa,EAAC,wBAAS,CAAC,CAAC;AAEzB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import { container } from '@visactor/vrender-core';\nimport { loadAllModule } from '@visactor/vrender-kits';\n\n// 导出版本号\nexport const version = \"0.16.14-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,yDAAuD;AAG1C,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,IAAA,4BAAa,EAAC,wBAAS,CAAC,CAAC;AAEzB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import { container } from '@visactor/vrender-core';\nimport { loadAllModule } from '@visactor/vrender-kits';\n\n// 导出版本号\nexport const version = \"0.16.14-alpha.5\";\n\nloadAllModule(container);\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
|
package/dist/index.js
CHANGED
|
@@ -4591,9 +4591,13 @@
|
|
|
4591
4591
|
_this$_userSpec$textB = _this$_userSpec.textBaseline,
|
|
4592
4592
|
textBaseline = _this$_userSpec$textB === void 0 ? null != baseline ? baseline : "middle" : _this$_userSpec$textB,
|
|
4593
4593
|
ellipsis = _this$_userSpec.ellipsis,
|
|
4594
|
-
limit = _this$_userSpec.limit
|
|
4595
|
-
|
|
4594
|
+
limit = _this$_userSpec.limit;
|
|
4595
|
+
var _this$_userSpec$lineH = this._userSpec.lineHeight,
|
|
4596
4596
|
lineHeight = _this$_userSpec$lineH === void 0 ? fontSize : _this$_userSpec$lineH;
|
|
4597
|
+
if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
4598
|
+
var scale = Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100;
|
|
4599
|
+
lineHeight = fontSize * scale;
|
|
4600
|
+
}
|
|
4597
4601
|
return {
|
|
4598
4602
|
fontStyle: fontStyle,
|
|
4599
4603
|
fontVariant: fontVariant,
|
|
@@ -4669,6 +4673,7 @@
|
|
|
4669
4673
|
}, {
|
|
4670
4674
|
key: "_measureWithNaiveCanvas",
|
|
4671
4675
|
value: function _measureWithNaiveCanvas(text) {
|
|
4676
|
+
var _a;
|
|
4672
4677
|
if (!this.initContext()) return this._quickMeasureWithoutCanvas(text);
|
|
4673
4678
|
var metrics = this._context.measureText(text),
|
|
4674
4679
|
_this$textSpec2 = this.textSpec,
|
|
@@ -4676,7 +4681,7 @@
|
|
|
4676
4681
|
lineHeight = _this$textSpec2.lineHeight;
|
|
4677
4682
|
return {
|
|
4678
4683
|
width: metrics.width,
|
|
4679
|
-
height: null
|
|
4684
|
+
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
|
|
4680
4685
|
};
|
|
4681
4686
|
}
|
|
4682
4687
|
}, {
|
|
@@ -4706,6 +4711,7 @@
|
|
|
4706
4711
|
}, {
|
|
4707
4712
|
key: "_quickMeasureWithoutCanvas",
|
|
4708
4713
|
value: function _quickMeasureWithoutCanvas(text) {
|
|
4714
|
+
var _a;
|
|
4709
4715
|
var totalSize = {
|
|
4710
4716
|
width: 0,
|
|
4711
4717
|
height: 0
|
|
@@ -4718,11 +4724,12 @@
|
|
|
4718
4724
|
size = ["F", "W"].includes(eastAsianCharacterInfo(_char2)) ? 1 : .53;
|
|
4719
4725
|
totalSize.width += size * fontSize;
|
|
4720
4726
|
}
|
|
4721
|
-
return totalSize.height = null
|
|
4727
|
+
return totalSize.height = null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize, totalSize;
|
|
4722
4728
|
}
|
|
4723
4729
|
}, {
|
|
4724
4730
|
key: "_measureReduce",
|
|
4725
4731
|
value: function _measureReduce(text, processor) {
|
|
4732
|
+
var _a;
|
|
4726
4733
|
var _this$textSpec4 = this.textSpec,
|
|
4727
4734
|
fontSize = _this$textSpec4.fontSize,
|
|
4728
4735
|
lineHeight = _this$textSpec4.lineHeight,
|
|
@@ -4739,7 +4746,7 @@
|
|
|
4739
4746
|
width: textArr.reduce(function (maxWidth, cur) {
|
|
4740
4747
|
return Math.max(maxWidth, processor(cur).width);
|
|
4741
4748
|
}, 0),
|
|
4742
|
-
height: textArr.length * ((null
|
|
4749
|
+
height: textArr.length * ((null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize) + 1) + 1
|
|
4743
4750
|
};
|
|
4744
4751
|
}
|
|
4745
4752
|
return processor(text.toString());
|
|
@@ -7178,158 +7185,6 @@
|
|
|
7178
7185
|
return containPath(commands, lineWidth, !0, x, y);
|
|
7179
7186
|
}
|
|
7180
7187
|
|
|
7181
|
-
exports.Edge = void 0;
|
|
7182
|
-
!function (Edge) {
|
|
7183
|
-
Edge[Edge.Top = 1] = "Top", Edge[Edge.Right = 2] = "Right", Edge[Edge.Bottom = 4] = "Bottom", Edge[Edge.Left = 8] = "Left", Edge[Edge.ALL = 15] = "ALL";
|
|
7184
|
-
}(exports.Edge || (exports.Edge = {}));
|
|
7185
|
-
var _strokeVec4 = [!1, !1, !1, !1];
|
|
7186
|
-
var parseStroke = function parseStroke(stroke) {
|
|
7187
|
-
var _a;
|
|
7188
|
-
var isFullStroke = !0;
|
|
7189
|
-
if (isBoolean$1(stroke, !0)) {
|
|
7190
|
-
for (var i = 0; i < 4; i++) _strokeVec4[i] = stroke, isFullStroke && (isFullStroke = !(null !== (_a = _strokeVec4[i]) && void 0 !== _a && !_a));
|
|
7191
|
-
isFullStroke = stroke;
|
|
7192
|
-
} else if (Array.isArray(stroke)) for (var _i = 0; _i < 4; _i++) _strokeVec4[_i] = !!stroke[_i], isFullStroke && (isFullStroke = !!_strokeVec4[_i]);else _strokeVec4[0] = !1, _strokeVec4[1] = !1, _strokeVec4[2] = !1, _strokeVec4[3] = !1;
|
|
7193
|
-
return {
|
|
7194
|
-
isFullStroke: isFullStroke,
|
|
7195
|
-
stroke: _strokeVec4
|
|
7196
|
-
};
|
|
7197
|
-
};
|
|
7198
|
-
var _paddingVec4 = [0, 0, 0, 0];
|
|
7199
|
-
var parsePadding = function parsePadding(padding) {
|
|
7200
|
-
return padding ? isArray$1(padding) ? 0 === padding.length ? 0 : 1 === padding.length ? padding[0] : 2 === padding.length ? (_paddingVec4[0] = padding[0], _paddingVec4[2] = padding[0], _paddingVec4[1] = padding[1], _paddingVec4[3] = padding[1], _paddingVec4) : padding : padding : 0;
|
|
7201
|
-
};
|
|
7202
|
-
var _coords = [{
|
|
7203
|
-
x: 0,
|
|
7204
|
-
y: 0
|
|
7205
|
-
}, {
|
|
7206
|
-
x: 0,
|
|
7207
|
-
y: 0
|
|
7208
|
-
}, {
|
|
7209
|
-
x: 0,
|
|
7210
|
-
y: 0
|
|
7211
|
-
}, {
|
|
7212
|
-
x: 0,
|
|
7213
|
-
y: 0
|
|
7214
|
-
}],
|
|
7215
|
-
indexList = [1, 2, 3, 0, 1, 2, 3, 0];
|
|
7216
|
-
function circleBounds(startAngle, endAngle, radius, bounds) {
|
|
7217
|
-
for (; startAngle >= pi2;) startAngle -= pi2;
|
|
7218
|
-
for (; startAngle < 0;) startAngle += pi2;
|
|
7219
|
-
for (; startAngle > endAngle;) endAngle += pi2;
|
|
7220
|
-
_coords[0].x = radius, _coords[1].y = radius, _coords[2].x = -radius, _coords[3].y = -radius;
|
|
7221
|
-
var startIdx = Math.ceil(startAngle / halfPi$1) % 4,
|
|
7222
|
-
endIdx = Math.ceil(endAngle / halfPi$1) % 4;
|
|
7223
|
-
if (bounds.add(cos(startAngle) * radius, sin(startAngle) * radius), bounds.add(cos(endAngle) * radius, sin(endAngle) * radius), startIdx !== endIdx || endAngle - startAngle > pi) {
|
|
7224
|
-
var match = !1;
|
|
7225
|
-
for (var i = 0; i < indexList.length; i++) if (match || startIdx !== indexList[i]) {
|
|
7226
|
-
if (match && endIdx === indexList[i]) break;
|
|
7227
|
-
if (match) {
|
|
7228
|
-
var p = _coords[indexList[i]];
|
|
7229
|
-
bounds.add(p.x, p.y);
|
|
7230
|
-
}
|
|
7231
|
-
} else {
|
|
7232
|
-
match = !0;
|
|
7233
|
-
var _p = _coords[startIdx];
|
|
7234
|
-
bounds.add(_p.x, _p.y);
|
|
7235
|
-
}
|
|
7236
|
-
}
|
|
7237
|
-
}
|
|
7238
|
-
function pointsEqual(pointsA, pointsB) {
|
|
7239
|
-
return !(!pointsA || !pointsB) && (Array.isArray(pointsA) && Array.isArray(pointsB) ? pointsA.length === pointsB.length && pointsA.every(function (point, index) {
|
|
7240
|
-
return pointEqual(point, pointsB[index]);
|
|
7241
|
-
}) : !Number.isNaN(pointsA.x + pointsA.y) && pointEqual(pointsA, pointsB));
|
|
7242
|
-
}
|
|
7243
|
-
function pointEqual(pointA, pointB) {
|
|
7244
|
-
return pointA.x === pointB.x && pointA.y === pointB.y && pointA.x1 === pointB.x1 && pointA.y1 === pointB.y1 && pointA.defined === pointB.defined;
|
|
7245
|
-
}
|
|
7246
|
-
function pointInterpolation(pointA, pointB, ratio) {
|
|
7247
|
-
var _pointAt = pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio),
|
|
7248
|
-
x = _pointAt.x,
|
|
7249
|
-
y = _pointAt.y,
|
|
7250
|
-
_pointAt2 = pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio),
|
|
7251
|
-
x1 = _pointAt2.x,
|
|
7252
|
-
y1 = _pointAt2.y,
|
|
7253
|
-
point = new Point(x, y, x1, y1);
|
|
7254
|
-
return point.defined = pointB.defined, point;
|
|
7255
|
-
}
|
|
7256
|
-
function pointInterpolationHighPerformance(pointA, pointB, ratio, point) {
|
|
7257
|
-
var _pointAt3 = pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio),
|
|
7258
|
-
x = _pointAt3.x,
|
|
7259
|
-
y = _pointAt3.y,
|
|
7260
|
-
_pointAt4 = pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio),
|
|
7261
|
-
x1 = _pointAt4.x,
|
|
7262
|
-
y1 = _pointAt4.y;
|
|
7263
|
-
return point.x = x, point.y = y, point.x1 = x1, point.y1 = y1, point.defined = pointB.defined, point;
|
|
7264
|
-
}
|
|
7265
|
-
function pointsInterpolation(pointsA, pointsB, ratio) {
|
|
7266
|
-
if (!pointsA || !pointsB) return [];
|
|
7267
|
-
Array.isArray(pointsA) || (pointsA = [pointsA]), Array.isArray(pointsB) || (pointsB = [pointsB]);
|
|
7268
|
-
var points = [];
|
|
7269
|
-
if (pointsA.length > pointsB.length) {
|
|
7270
|
-
points = pointsB.map(function (point) {
|
|
7271
|
-
var p = new Point(point.x, point.y, point.x1, point.y1);
|
|
7272
|
-
return p.defined = point.defined, p;
|
|
7273
|
-
});
|
|
7274
|
-
for (var i = 0; i < pointsB.length; i++) points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
7275
|
-
} else {
|
|
7276
|
-
points = pointsB.map(function (point) {
|
|
7277
|
-
var p = new Point(point.x, point.y, point.x1, point.y1);
|
|
7278
|
-
return p.defined = point.defined, p;
|
|
7279
|
-
});
|
|
7280
|
-
for (var _i2 = 0; _i2 < pointsA.length; _i2++) points[_i2] = pointInterpolation(pointsA[_i2], pointsB[_i2], ratio);
|
|
7281
|
-
}
|
|
7282
|
-
return points;
|
|
7283
|
-
}
|
|
7284
|
-
var transformKeys = ["x", "y", "dx", "dy", "scaleX", "scaleY", "angle", "anchor", "postMatrix", "scrollX", "scrollY"];
|
|
7285
|
-
var isTransformKey = function isTransformKey(key) {
|
|
7286
|
-
return transformKeys.includes(key);
|
|
7287
|
-
};
|
|
7288
|
-
function getAttributeFromDefaultAttrList(attr, key) {
|
|
7289
|
-
if (isArray$1(attr)) {
|
|
7290
|
-
var val;
|
|
7291
|
-
for (var i = 0; i < attr.length && void 0 === val; i++) val = attr[i][key];
|
|
7292
|
-
return val;
|
|
7293
|
-
}
|
|
7294
|
-
return attr[key];
|
|
7295
|
-
}
|
|
7296
|
-
var RafBasedSTO = /*#__PURE__*/function () {
|
|
7297
|
-
function RafBasedSTO() {
|
|
7298
|
-
_classCallCheck(this, RafBasedSTO);
|
|
7299
|
-
this.durations = [], this.timeout = RafBasedSTO.TimeOut, this.lastDate = 0, this.durationsListThreshold = 30;
|
|
7300
|
-
}
|
|
7301
|
-
_createClass(RafBasedSTO, [{
|
|
7302
|
-
key: "call",
|
|
7303
|
-
value: function call(cb) {
|
|
7304
|
-
var _this = this;
|
|
7305
|
-
return this.lastDate = Date.now(), setTimeout(function () {
|
|
7306
|
-
_this.appendDuration(Date.now() - _this.lastDate), cb(0);
|
|
7307
|
-
}, this.timeout, !0);
|
|
7308
|
-
}
|
|
7309
|
-
}, {
|
|
7310
|
-
key: "clear",
|
|
7311
|
-
value: function clear(h) {
|
|
7312
|
-
clearTimeout(h);
|
|
7313
|
-
}
|
|
7314
|
-
}, {
|
|
7315
|
-
key: "appendDuration",
|
|
7316
|
-
value: function appendDuration(d) {
|
|
7317
|
-
this.durations.push(d), this.durations.length > this.durationsListThreshold && this.durations.shift(), this.timeout = Math.min(Math.max(this.durations.reduce(function (a, b) {
|
|
7318
|
-
return a + b;
|
|
7319
|
-
}, 0) / this.durations.length, 1e3 / 60), 1e3 / 30);
|
|
7320
|
-
}
|
|
7321
|
-
}]);
|
|
7322
|
-
return RafBasedSTO;
|
|
7323
|
-
}();
|
|
7324
|
-
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
7325
|
-
var rafBasedSto = new RafBasedSTO();
|
|
7326
|
-
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
7327
|
-
if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
7328
|
-
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
7329
|
-
}
|
|
7330
|
-
return lineHeight;
|
|
7331
|
-
};
|
|
7332
|
-
|
|
7333
7188
|
var __decorate$1P = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
7334
7189
|
var d,
|
|
7335
7190
|
c = arguments.length,
|
|
@@ -7406,9 +7261,7 @@
|
|
|
7406
7261
|
},
|
|
7407
7262
|
getTextBounds: void 0,
|
|
7408
7263
|
specialCharSet: "-/: .,@%'\"~" + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase()
|
|
7409
|
-
}, null != option ? option : {}),
|
|
7410
|
-
lineHeight: calculateLineHeight(null == textSpec ? void 0 : textSpec.lineHeight, null == textSpec ? void 0 : textSpec.fontSize)
|
|
7411
|
-
}));
|
|
7264
|
+
}, null != option ? option : {}), textSpec);
|
|
7412
7265
|
}
|
|
7413
7266
|
}]);
|
|
7414
7267
|
return DefaultGraphicUtil;
|
|
@@ -9956,6 +9809,158 @@
|
|
|
9956
9809
|
easing: "quadInOut"
|
|
9957
9810
|
};
|
|
9958
9811
|
|
|
9812
|
+
exports.Edge = void 0;
|
|
9813
|
+
!function (Edge) {
|
|
9814
|
+
Edge[Edge.Top = 1] = "Top", Edge[Edge.Right = 2] = "Right", Edge[Edge.Bottom = 4] = "Bottom", Edge[Edge.Left = 8] = "Left", Edge[Edge.ALL = 15] = "ALL";
|
|
9815
|
+
}(exports.Edge || (exports.Edge = {}));
|
|
9816
|
+
var _strokeVec4 = [!1, !1, !1, !1];
|
|
9817
|
+
var parseStroke = function parseStroke(stroke) {
|
|
9818
|
+
var _a;
|
|
9819
|
+
var isFullStroke = !0;
|
|
9820
|
+
if (isBoolean$1(stroke, !0)) {
|
|
9821
|
+
for (var i = 0; i < 4; i++) _strokeVec4[i] = stroke, isFullStroke && (isFullStroke = !(null !== (_a = _strokeVec4[i]) && void 0 !== _a && !_a));
|
|
9822
|
+
isFullStroke = stroke;
|
|
9823
|
+
} else if (Array.isArray(stroke)) for (var _i = 0; _i < 4; _i++) _strokeVec4[_i] = !!stroke[_i], isFullStroke && (isFullStroke = !!_strokeVec4[_i]);else _strokeVec4[0] = !1, _strokeVec4[1] = !1, _strokeVec4[2] = !1, _strokeVec4[3] = !1;
|
|
9824
|
+
return {
|
|
9825
|
+
isFullStroke: isFullStroke,
|
|
9826
|
+
stroke: _strokeVec4
|
|
9827
|
+
};
|
|
9828
|
+
};
|
|
9829
|
+
var _paddingVec4 = [0, 0, 0, 0];
|
|
9830
|
+
var parsePadding = function parsePadding(padding) {
|
|
9831
|
+
return padding ? isArray$1(padding) ? 0 === padding.length ? 0 : 1 === padding.length ? padding[0] : 2 === padding.length ? (_paddingVec4[0] = padding[0], _paddingVec4[2] = padding[0], _paddingVec4[1] = padding[1], _paddingVec4[3] = padding[1], _paddingVec4) : padding : padding : 0;
|
|
9832
|
+
};
|
|
9833
|
+
var _coords = [{
|
|
9834
|
+
x: 0,
|
|
9835
|
+
y: 0
|
|
9836
|
+
}, {
|
|
9837
|
+
x: 0,
|
|
9838
|
+
y: 0
|
|
9839
|
+
}, {
|
|
9840
|
+
x: 0,
|
|
9841
|
+
y: 0
|
|
9842
|
+
}, {
|
|
9843
|
+
x: 0,
|
|
9844
|
+
y: 0
|
|
9845
|
+
}],
|
|
9846
|
+
indexList = [1, 2, 3, 0, 1, 2, 3, 0];
|
|
9847
|
+
function circleBounds(startAngle, endAngle, radius, bounds) {
|
|
9848
|
+
for (; startAngle >= pi2;) startAngle -= pi2;
|
|
9849
|
+
for (; startAngle < 0;) startAngle += pi2;
|
|
9850
|
+
for (; startAngle > endAngle;) endAngle += pi2;
|
|
9851
|
+
_coords[0].x = radius, _coords[1].y = radius, _coords[2].x = -radius, _coords[3].y = -radius;
|
|
9852
|
+
var startIdx = Math.ceil(startAngle / halfPi$1) % 4,
|
|
9853
|
+
endIdx = Math.ceil(endAngle / halfPi$1) % 4;
|
|
9854
|
+
if (bounds.add(cos(startAngle) * radius, sin(startAngle) * radius), bounds.add(cos(endAngle) * radius, sin(endAngle) * radius), startIdx !== endIdx || endAngle - startAngle > pi) {
|
|
9855
|
+
var match = !1;
|
|
9856
|
+
for (var i = 0; i < indexList.length; i++) if (match || startIdx !== indexList[i]) {
|
|
9857
|
+
if (match && endIdx === indexList[i]) break;
|
|
9858
|
+
if (match) {
|
|
9859
|
+
var p = _coords[indexList[i]];
|
|
9860
|
+
bounds.add(p.x, p.y);
|
|
9861
|
+
}
|
|
9862
|
+
} else {
|
|
9863
|
+
match = !0;
|
|
9864
|
+
var _p = _coords[startIdx];
|
|
9865
|
+
bounds.add(_p.x, _p.y);
|
|
9866
|
+
}
|
|
9867
|
+
}
|
|
9868
|
+
}
|
|
9869
|
+
function pointsEqual(pointsA, pointsB) {
|
|
9870
|
+
return !(!pointsA || !pointsB) && (Array.isArray(pointsA) && Array.isArray(pointsB) ? pointsA.length === pointsB.length && pointsA.every(function (point, index) {
|
|
9871
|
+
return pointEqual(point, pointsB[index]);
|
|
9872
|
+
}) : !Number.isNaN(pointsA.x + pointsA.y) && pointEqual(pointsA, pointsB));
|
|
9873
|
+
}
|
|
9874
|
+
function pointEqual(pointA, pointB) {
|
|
9875
|
+
return pointA.x === pointB.x && pointA.y === pointB.y && pointA.x1 === pointB.x1 && pointA.y1 === pointB.y1 && pointA.defined === pointB.defined;
|
|
9876
|
+
}
|
|
9877
|
+
function pointInterpolation(pointA, pointB, ratio) {
|
|
9878
|
+
var _pointAt = pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio),
|
|
9879
|
+
x = _pointAt.x,
|
|
9880
|
+
y = _pointAt.y,
|
|
9881
|
+
_pointAt2 = pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio),
|
|
9882
|
+
x1 = _pointAt2.x,
|
|
9883
|
+
y1 = _pointAt2.y,
|
|
9884
|
+
point = new Point(x, y, x1, y1);
|
|
9885
|
+
return point.defined = pointB.defined, point;
|
|
9886
|
+
}
|
|
9887
|
+
function pointInterpolationHighPerformance(pointA, pointB, ratio, point) {
|
|
9888
|
+
var _pointAt3 = pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio),
|
|
9889
|
+
x = _pointAt3.x,
|
|
9890
|
+
y = _pointAt3.y,
|
|
9891
|
+
_pointAt4 = pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio),
|
|
9892
|
+
x1 = _pointAt4.x,
|
|
9893
|
+
y1 = _pointAt4.y;
|
|
9894
|
+
return point.x = x, point.y = y, point.x1 = x1, point.y1 = y1, point.defined = pointB.defined, point;
|
|
9895
|
+
}
|
|
9896
|
+
function pointsInterpolation(pointsA, pointsB, ratio) {
|
|
9897
|
+
if (!pointsA || !pointsB) return [];
|
|
9898
|
+
Array.isArray(pointsA) || (pointsA = [pointsA]), Array.isArray(pointsB) || (pointsB = [pointsB]);
|
|
9899
|
+
var points = [];
|
|
9900
|
+
if (pointsA.length > pointsB.length) {
|
|
9901
|
+
points = pointsB.map(function (point) {
|
|
9902
|
+
var p = new Point(point.x, point.y, point.x1, point.y1);
|
|
9903
|
+
return p.defined = point.defined, p;
|
|
9904
|
+
});
|
|
9905
|
+
for (var i = 0; i < pointsB.length; i++) points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
9906
|
+
} else {
|
|
9907
|
+
points = pointsB.map(function (point) {
|
|
9908
|
+
var p = new Point(point.x, point.y, point.x1, point.y1);
|
|
9909
|
+
return p.defined = point.defined, p;
|
|
9910
|
+
});
|
|
9911
|
+
for (var _i2 = 0; _i2 < pointsA.length; _i2++) points[_i2] = pointInterpolation(pointsA[_i2], pointsB[_i2], ratio);
|
|
9912
|
+
}
|
|
9913
|
+
return points;
|
|
9914
|
+
}
|
|
9915
|
+
var transformKeys = ["x", "y", "dx", "dy", "scaleX", "scaleY", "angle", "anchor", "postMatrix", "scrollX", "scrollY"];
|
|
9916
|
+
var isTransformKey = function isTransformKey(key) {
|
|
9917
|
+
return transformKeys.includes(key);
|
|
9918
|
+
};
|
|
9919
|
+
function getAttributeFromDefaultAttrList(attr, key) {
|
|
9920
|
+
if (isArray$1(attr)) {
|
|
9921
|
+
var val;
|
|
9922
|
+
for (var i = 0; i < attr.length && void 0 === val; i++) val = attr[i][key];
|
|
9923
|
+
return val;
|
|
9924
|
+
}
|
|
9925
|
+
return attr[key];
|
|
9926
|
+
}
|
|
9927
|
+
var RafBasedSTO = /*#__PURE__*/function () {
|
|
9928
|
+
function RafBasedSTO() {
|
|
9929
|
+
_classCallCheck(this, RafBasedSTO);
|
|
9930
|
+
this.durations = [], this.timeout = RafBasedSTO.TimeOut, this.lastDate = 0, this.durationsListThreshold = 30;
|
|
9931
|
+
}
|
|
9932
|
+
_createClass(RafBasedSTO, [{
|
|
9933
|
+
key: "call",
|
|
9934
|
+
value: function call(cb) {
|
|
9935
|
+
var _this = this;
|
|
9936
|
+
return this.lastDate = Date.now(), setTimeout(function () {
|
|
9937
|
+
_this.appendDuration(Date.now() - _this.lastDate), cb(0);
|
|
9938
|
+
}, this.timeout, !0);
|
|
9939
|
+
}
|
|
9940
|
+
}, {
|
|
9941
|
+
key: "clear",
|
|
9942
|
+
value: function clear(h) {
|
|
9943
|
+
clearTimeout(h);
|
|
9944
|
+
}
|
|
9945
|
+
}, {
|
|
9946
|
+
key: "appendDuration",
|
|
9947
|
+
value: function appendDuration(d) {
|
|
9948
|
+
this.durations.push(d), this.durations.length > this.durationsListThreshold && this.durations.shift(), this.timeout = Math.min(Math.max(this.durations.reduce(function (a, b) {
|
|
9949
|
+
return a + b;
|
|
9950
|
+
}, 0) / this.durations.length, 1e3 / 60), 1e3 / 30);
|
|
9951
|
+
}
|
|
9952
|
+
}]);
|
|
9953
|
+
return RafBasedSTO;
|
|
9954
|
+
}();
|
|
9955
|
+
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
9956
|
+
var rafBasedSto = new RafBasedSTO();
|
|
9957
|
+
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
9958
|
+
if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
9959
|
+
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
9960
|
+
}
|
|
9961
|
+
return lineHeight;
|
|
9962
|
+
};
|
|
9963
|
+
|
|
9959
9964
|
var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
|
|
9960
9965
|
_inherits(IncreaseCount, _ACustomAnimate);
|
|
9961
9966
|
var _super = _createSuper(IncreaseCount);
|
|
@@ -16622,7 +16627,9 @@
|
|
|
16622
16627
|
var Paragraph = /*#__PURE__*/function () {
|
|
16623
16628
|
function Paragraph(text, newLine, character) {
|
|
16624
16629
|
_classCallCheck(this, Paragraph);
|
|
16625
|
-
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic"
|
|
16630
|
+
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
16631
|
+
var lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
16632
|
+
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
16626
16633
|
var _measureTextCanvas = measureTextCanvas(text, character),
|
|
16627
16634
|
ascent = _measureTextCanvas.ascent,
|
|
16628
16635
|
height = _measureTextCanvas.height,
|
|
@@ -34627,7 +34634,7 @@
|
|
|
34627
34634
|
|
|
34628
34635
|
var roughModule = _roughModule;
|
|
34629
34636
|
|
|
34630
|
-
const version = "0.16.14-alpha.
|
|
34637
|
+
const version = "0.16.14-alpha.5";
|
|
34631
34638
|
loadAllModule(container);
|
|
34632
34639
|
|
|
34633
34640
|
exports.ACustomAnimate = ACustomAnimate;
|