@visactor/vrender-components 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/cjs/util/text.d.ts +1 -3
- package/cjs/util/text.js +1 -3
- package/cjs/util/text.js.map +1 -1
- package/dist/index.js +137 -137
- 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/es/util/text.d.ts +1 -3
- package/es/util/text.js +2 -4
- package/es/util/text.js.map +1 -1
- package/package.json +6 -6
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.version = void 0, exports.version = "0.16.14-alpha.
|
|
20
|
+
}), exports.version = void 0, exports.version = "0.16.14-alpha.5", __exportStar(require("./core/base"), exports),
|
|
21
21
|
__exportStar(require("./scrollbar"), exports), __exportStar(require("./tag"), exports),
|
|
22
22
|
__exportStar(require("./poptip"), exports), __exportStar(require("./crosshair"), exports),
|
|
23
23
|
__exportStar(require("./label"), exports), __exportStar(require("./axis"), exports),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.16.14-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.16.14-alpha.5\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\n"]}
|
package/cjs/util/text.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { ITextGraphicAttribute } from '@visactor/vrender-core';
|
|
2
2
|
import type { ITextMeasureOption } from '@visactor/vutils';
|
|
3
3
|
import { TextMeasure } from '@visactor/vutils';
|
|
4
|
-
export declare const initTextMeasure: (textSpec?: Partial<ITextGraphicAttribute>, option?: Partial<ITextMeasureOption>, useNaiveCanvas?: boolean) => TextMeasure<
|
|
5
|
-
lineHeight?: number;
|
|
6
|
-
}>;
|
|
4
|
+
export declare const initTextMeasure: (textSpec?: Partial<ITextGraphicAttribute>, option?: Partial<ITextMeasureOption>, useNaiveCanvas?: boolean) => TextMeasure<ITextGraphicAttribute>;
|
|
7
5
|
export declare function measureTextSize(text: string | number | string[] | number[], textSpec: Partial<ITextGraphicAttribute>): {
|
|
8
6
|
width: number;
|
|
9
7
|
height: number;
|
package/cjs/util/text.js
CHANGED
|
@@ -11,9 +11,7 @@ const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@v
|
|
|
11
11
|
},
|
|
12
12
|
getTextBounds: useNaiveCanvas ? void 0 : vrender_core_1.getTextBounds,
|
|
13
13
|
specialCharSet: "-/: .,@%'\"~" + vutils_1.TextMeasure.ALPHABET_CHAR_SET + vutils_1.TextMeasure.ALPHABET_CHAR_SET.toUpperCase()
|
|
14
|
-
}, null != option ? option : {}),
|
|
15
|
-
lineHeight: (0, vrender_core_1.calculateLineHeight)(null == textSpec ? void 0 : textSpec.lineHeight, null == textSpec ? void 0 : textSpec.fontSize)
|
|
16
|
-
}));
|
|
14
|
+
}, null != option ? option : {}), textSpec);
|
|
17
15
|
|
|
18
16
|
function measureTextSize(text, textSpec) {
|
|
19
17
|
var _a;
|
package/cjs/util/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":";;;AAEA,yDAAuD;AAGvD,6CAA+C;AAC/C,0CAA+E;AAExE,MAAM,eAAe,GAAG,CAC7B,QAAyC,EACzC,MAAoC,EACpC,cAAwB,EACY,EAAE;IACtC,OAAO,IAAI,oBAAW,iBAElB,iBAAiB,EAAE;YACjB,UAAU,EAAE,mCAAwB;YACpC,QAAQ,EAAE,iCAAsB;SACjC,EACD,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,4BAAa,EACzD,cAAc,EAAE,cAAc,GAAG,oBAAW,CAAC,iBAAiB,GAAG,oBAAW,CAAC,iBAAiB,CAAC,WAAW,EAAE,IACzG,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,GAEnB,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,eAAe,mBAiB1B;AAGF,SAAgB,eAAe,CAAC,IAA2C,EAAE,QAAwC;;IACnH,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;KAChC;IACD,MAAM,MAAM,GAAG,IAAA,4BAAa,EAAC;QAC3B,IAAI;QACJ,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;QACjC,UAAU,EAAE,QAAQ,CAAC,UAAiB;QACtC,SAAS,EAAE,MAAA,QAAQ,CAAC,SAAS,mCAAI,QAAQ;QACzC,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ;QAC7B,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,QAAQ;QAC/C,UAAU,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;KACpC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;AAC5D,CAAC;AAjBD,0CAiBC","file":"text.js","sourcesContent":["import type { ITextGraphicAttribute } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { getTextBounds } from '@visactor/vrender-core';\nimport type { ITextMeasureOption } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { TextMeasure } from '@visactor/vutils';\nimport { DEFAULT_TEXT_FONT_FAMILY, DEFAULT_TEXT_FONT_SIZE } from '../constant';\n\nexport const initTextMeasure = (\n textSpec?: Partial<ITextGraphicAttribute>,\n option?: Partial<ITextMeasureOption>,\n useNaiveCanvas?: boolean\n): TextMeasure<ITextGraphicAttribute> => {\n return new TextMeasure<ITextGraphicAttribute>(\n {\n defaultFontParams: {\n fontFamily: DEFAULT_TEXT_FONT_FAMILY,\n fontSize: DEFAULT_TEXT_FONT_SIZE\n },\n getTextBounds: useNaiveCanvas ? undefined : getTextBounds,\n specialCharSet: '-/: .,@%\\'\"~' + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase(),\n ...(option ?? {})\n },\n textSpec\n );\n};\n\n// FIXME: 和上一个方法统一,使用 TextMeasure 类\nexport function measureTextSize(text: string | number | string[] | number[], textSpec: Partial<ITextGraphicAttribute>) {\n if (!text) {\n return { width: 0, height: 0 };\n }\n const bounds = getTextBounds({\n text,\n fontFamily: textSpec.fontFamily,\n fontSize: textSpec.fontSize || 12,\n fontWeight: textSpec.fontWeight as any,\n textAlign: textSpec.textAlign ?? 'center',\n textBaseline: textSpec.textBaseline,\n ellipsis: !!textSpec.ellipsis,\n maxLineWidth: textSpec.maxLineWidth || Infinity,\n lineHeight: textSpec.fontSize || 12\n });\n\n return { width: bounds.width(), height: bounds.height() };\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -5348,137 +5348,6 @@
|
|
|
5348
5348
|
return containPath(commands, lineWidth, !0, x, y);
|
|
5349
5349
|
}
|
|
5350
5350
|
|
|
5351
|
-
var Edge;
|
|
5352
|
-
!function (Edge) {
|
|
5353
|
-
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";
|
|
5354
|
-
}(Edge || (Edge = {}));
|
|
5355
|
-
var _strokeVec4 = [!1, !1, !1, !1];
|
|
5356
|
-
var parseStroke = function parseStroke(stroke) {
|
|
5357
|
-
var _a;
|
|
5358
|
-
var isFullStroke = !0;
|
|
5359
|
-
if (vutils.isBoolean(stroke, !0)) {
|
|
5360
|
-
for (var i = 0; i < 4; i++) _strokeVec4[i] = stroke, isFullStroke && (isFullStroke = !(null !== (_a = _strokeVec4[i]) && void 0 !== _a && !_a));
|
|
5361
|
-
isFullStroke = stroke;
|
|
5362
|
-
} 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;
|
|
5363
|
-
return {
|
|
5364
|
-
isFullStroke: isFullStroke,
|
|
5365
|
-
stroke: _strokeVec4
|
|
5366
|
-
};
|
|
5367
|
-
};
|
|
5368
|
-
var _paddingVec4 = [0, 0, 0, 0];
|
|
5369
|
-
var parsePadding = function parsePadding(padding) {
|
|
5370
|
-
return padding ? vutils.isArray(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;
|
|
5371
|
-
};
|
|
5372
|
-
var _coords = [{
|
|
5373
|
-
x: 0,
|
|
5374
|
-
y: 0
|
|
5375
|
-
}, {
|
|
5376
|
-
x: 0,
|
|
5377
|
-
y: 0
|
|
5378
|
-
}, {
|
|
5379
|
-
x: 0,
|
|
5380
|
-
y: 0
|
|
5381
|
-
}, {
|
|
5382
|
-
x: 0,
|
|
5383
|
-
y: 0
|
|
5384
|
-
}],
|
|
5385
|
-
indexList = [1, 2, 3, 0, 1, 2, 3, 0];
|
|
5386
|
-
function circleBounds(startAngle, endAngle, radius, bounds) {
|
|
5387
|
-
for (; startAngle >= vutils.pi2;) startAngle -= vutils.pi2;
|
|
5388
|
-
for (; startAngle < 0;) startAngle += vutils.pi2;
|
|
5389
|
-
for (; startAngle > endAngle;) endAngle += vutils.pi2;
|
|
5390
|
-
_coords[0].x = radius, _coords[1].y = radius, _coords[2].x = -radius, _coords[3].y = -radius;
|
|
5391
|
-
var startIdx = Math.ceil(startAngle / vutils.halfPi) % 4,
|
|
5392
|
-
endIdx = Math.ceil(endAngle / vutils.halfPi) % 4;
|
|
5393
|
-
if (bounds.add(vutils.cos(startAngle) * radius, vutils.sin(startAngle) * radius), bounds.add(vutils.cos(endAngle) * radius, vutils.sin(endAngle) * radius), startIdx !== endIdx || endAngle - startAngle > vutils.pi) {
|
|
5394
|
-
var match = !1;
|
|
5395
|
-
for (var i = 0; i < indexList.length; i++) if (match || startIdx !== indexList[i]) {
|
|
5396
|
-
if (match && endIdx === indexList[i]) break;
|
|
5397
|
-
if (match) {
|
|
5398
|
-
var p = _coords[indexList[i]];
|
|
5399
|
-
bounds.add(p.x, p.y);
|
|
5400
|
-
}
|
|
5401
|
-
} else {
|
|
5402
|
-
match = !0;
|
|
5403
|
-
var _p = _coords[startIdx];
|
|
5404
|
-
bounds.add(_p.x, _p.y);
|
|
5405
|
-
}
|
|
5406
|
-
}
|
|
5407
|
-
}
|
|
5408
|
-
function pointInterpolation(pointA, pointB, ratio) {
|
|
5409
|
-
var _pointAt = vutils.pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio),
|
|
5410
|
-
x = _pointAt.x,
|
|
5411
|
-
y = _pointAt.y,
|
|
5412
|
-
_pointAt2 = vutils.pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio),
|
|
5413
|
-
x1 = _pointAt2.x,
|
|
5414
|
-
y1 = _pointAt2.y,
|
|
5415
|
-
point = new vutils.Point(x, y, x1, y1);
|
|
5416
|
-
return point.defined = pointB.defined, point;
|
|
5417
|
-
}
|
|
5418
|
-
function pointsInterpolation(pointsA, pointsB, ratio) {
|
|
5419
|
-
if (!pointsA || !pointsB) return [];
|
|
5420
|
-
Array.isArray(pointsA) || (pointsA = [pointsA]), Array.isArray(pointsB) || (pointsB = [pointsB]);
|
|
5421
|
-
var points = [];
|
|
5422
|
-
if (pointsA.length > pointsB.length) {
|
|
5423
|
-
points = pointsB.map(function (point) {
|
|
5424
|
-
var p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
5425
|
-
return p.defined = point.defined, p;
|
|
5426
|
-
});
|
|
5427
|
-
for (var i = 0; i < pointsB.length; i++) points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
5428
|
-
} else {
|
|
5429
|
-
points = pointsB.map(function (point) {
|
|
5430
|
-
var p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
5431
|
-
return p.defined = point.defined, p;
|
|
5432
|
-
});
|
|
5433
|
-
for (var _i2 = 0; _i2 < pointsA.length; _i2++) points[_i2] = pointInterpolation(pointsA[_i2], pointsB[_i2], ratio);
|
|
5434
|
-
}
|
|
5435
|
-
return points;
|
|
5436
|
-
}
|
|
5437
|
-
function getAttributeFromDefaultAttrList(attr, key) {
|
|
5438
|
-
if (vutils.isArray(attr)) {
|
|
5439
|
-
var val;
|
|
5440
|
-
for (var i = 0; i < attr.length && void 0 === val; i++) val = attr[i][key];
|
|
5441
|
-
return val;
|
|
5442
|
-
}
|
|
5443
|
-
return attr[key];
|
|
5444
|
-
}
|
|
5445
|
-
var RafBasedSTO = /*#__PURE__*/function () {
|
|
5446
|
-
function RafBasedSTO() {
|
|
5447
|
-
_classCallCheck(this, RafBasedSTO);
|
|
5448
|
-
this.durations = [], this.timeout = RafBasedSTO.TimeOut, this.lastDate = 0, this.durationsListThreshold = 30;
|
|
5449
|
-
}
|
|
5450
|
-
_createClass(RafBasedSTO, [{
|
|
5451
|
-
key: "call",
|
|
5452
|
-
value: function call(cb) {
|
|
5453
|
-
var _this = this;
|
|
5454
|
-
return this.lastDate = Date.now(), setTimeout(function () {
|
|
5455
|
-
_this.appendDuration(Date.now() - _this.lastDate), cb(0);
|
|
5456
|
-
}, this.timeout, !0);
|
|
5457
|
-
}
|
|
5458
|
-
}, {
|
|
5459
|
-
key: "clear",
|
|
5460
|
-
value: function clear(h) {
|
|
5461
|
-
clearTimeout(h);
|
|
5462
|
-
}
|
|
5463
|
-
}, {
|
|
5464
|
-
key: "appendDuration",
|
|
5465
|
-
value: function appendDuration(d) {
|
|
5466
|
-
this.durations.push(d), this.durations.length > this.durationsListThreshold && this.durations.shift(), this.timeout = Math.min(Math.max(this.durations.reduce(function (a, b) {
|
|
5467
|
-
return a + b;
|
|
5468
|
-
}, 0) / this.durations.length, 1e3 / 60), 1e3 / 30);
|
|
5469
|
-
}
|
|
5470
|
-
}]);
|
|
5471
|
-
return RafBasedSTO;
|
|
5472
|
-
}();
|
|
5473
|
-
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
5474
|
-
new RafBasedSTO();
|
|
5475
|
-
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
5476
|
-
if (vutils.isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
5477
|
-
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
5478
|
-
}
|
|
5479
|
-
return lineHeight;
|
|
5480
|
-
};
|
|
5481
|
-
|
|
5482
5351
|
var __decorate$U = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
5483
5352
|
var d,
|
|
5484
5353
|
c = arguments.length,
|
|
@@ -5555,9 +5424,7 @@
|
|
|
5555
5424
|
},
|
|
5556
5425
|
getTextBounds: void 0,
|
|
5557
5426
|
specialCharSet: "-/: .,@%'\"~" + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase()
|
|
5558
|
-
}, null != option ? option : {}),
|
|
5559
|
-
lineHeight: calculateLineHeight(null == textSpec ? void 0 : textSpec.lineHeight, null == textSpec ? void 0 : textSpec.fontSize)
|
|
5560
|
-
}));
|
|
5427
|
+
}, null != option ? option : {}), textSpec);
|
|
5561
5428
|
}
|
|
5562
5429
|
}]);
|
|
5563
5430
|
return DefaultGraphicUtil;
|
|
@@ -7472,6 +7339,137 @@
|
|
|
7472
7339
|
easing: "cubicOut"
|
|
7473
7340
|
};
|
|
7474
7341
|
|
|
7342
|
+
var Edge;
|
|
7343
|
+
!function (Edge) {
|
|
7344
|
+
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";
|
|
7345
|
+
}(Edge || (Edge = {}));
|
|
7346
|
+
var _strokeVec4 = [!1, !1, !1, !1];
|
|
7347
|
+
var parseStroke = function parseStroke(stroke) {
|
|
7348
|
+
var _a;
|
|
7349
|
+
var isFullStroke = !0;
|
|
7350
|
+
if (vutils.isBoolean(stroke, !0)) {
|
|
7351
|
+
for (var i = 0; i < 4; i++) _strokeVec4[i] = stroke, isFullStroke && (isFullStroke = !(null !== (_a = _strokeVec4[i]) && void 0 !== _a && !_a));
|
|
7352
|
+
isFullStroke = stroke;
|
|
7353
|
+
} 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;
|
|
7354
|
+
return {
|
|
7355
|
+
isFullStroke: isFullStroke,
|
|
7356
|
+
stroke: _strokeVec4
|
|
7357
|
+
};
|
|
7358
|
+
};
|
|
7359
|
+
var _paddingVec4 = [0, 0, 0, 0];
|
|
7360
|
+
var parsePadding = function parsePadding(padding) {
|
|
7361
|
+
return padding ? vutils.isArray(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;
|
|
7362
|
+
};
|
|
7363
|
+
var _coords = [{
|
|
7364
|
+
x: 0,
|
|
7365
|
+
y: 0
|
|
7366
|
+
}, {
|
|
7367
|
+
x: 0,
|
|
7368
|
+
y: 0
|
|
7369
|
+
}, {
|
|
7370
|
+
x: 0,
|
|
7371
|
+
y: 0
|
|
7372
|
+
}, {
|
|
7373
|
+
x: 0,
|
|
7374
|
+
y: 0
|
|
7375
|
+
}],
|
|
7376
|
+
indexList = [1, 2, 3, 0, 1, 2, 3, 0];
|
|
7377
|
+
function circleBounds(startAngle, endAngle, radius, bounds) {
|
|
7378
|
+
for (; startAngle >= vutils.pi2;) startAngle -= vutils.pi2;
|
|
7379
|
+
for (; startAngle < 0;) startAngle += vutils.pi2;
|
|
7380
|
+
for (; startAngle > endAngle;) endAngle += vutils.pi2;
|
|
7381
|
+
_coords[0].x = radius, _coords[1].y = radius, _coords[2].x = -radius, _coords[3].y = -radius;
|
|
7382
|
+
var startIdx = Math.ceil(startAngle / vutils.halfPi) % 4,
|
|
7383
|
+
endIdx = Math.ceil(endAngle / vutils.halfPi) % 4;
|
|
7384
|
+
if (bounds.add(vutils.cos(startAngle) * radius, vutils.sin(startAngle) * radius), bounds.add(vutils.cos(endAngle) * radius, vutils.sin(endAngle) * radius), startIdx !== endIdx || endAngle - startAngle > vutils.pi) {
|
|
7385
|
+
var match = !1;
|
|
7386
|
+
for (var i = 0; i < indexList.length; i++) if (match || startIdx !== indexList[i]) {
|
|
7387
|
+
if (match && endIdx === indexList[i]) break;
|
|
7388
|
+
if (match) {
|
|
7389
|
+
var p = _coords[indexList[i]];
|
|
7390
|
+
bounds.add(p.x, p.y);
|
|
7391
|
+
}
|
|
7392
|
+
} else {
|
|
7393
|
+
match = !0;
|
|
7394
|
+
var _p = _coords[startIdx];
|
|
7395
|
+
bounds.add(_p.x, _p.y);
|
|
7396
|
+
}
|
|
7397
|
+
}
|
|
7398
|
+
}
|
|
7399
|
+
function pointInterpolation(pointA, pointB, ratio) {
|
|
7400
|
+
var _pointAt = vutils.pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio),
|
|
7401
|
+
x = _pointAt.x,
|
|
7402
|
+
y = _pointAt.y,
|
|
7403
|
+
_pointAt2 = vutils.pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio),
|
|
7404
|
+
x1 = _pointAt2.x,
|
|
7405
|
+
y1 = _pointAt2.y,
|
|
7406
|
+
point = new vutils.Point(x, y, x1, y1);
|
|
7407
|
+
return point.defined = pointB.defined, point;
|
|
7408
|
+
}
|
|
7409
|
+
function pointsInterpolation(pointsA, pointsB, ratio) {
|
|
7410
|
+
if (!pointsA || !pointsB) return [];
|
|
7411
|
+
Array.isArray(pointsA) || (pointsA = [pointsA]), Array.isArray(pointsB) || (pointsB = [pointsB]);
|
|
7412
|
+
var points = [];
|
|
7413
|
+
if (pointsA.length > pointsB.length) {
|
|
7414
|
+
points = pointsB.map(function (point) {
|
|
7415
|
+
var p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
7416
|
+
return p.defined = point.defined, p;
|
|
7417
|
+
});
|
|
7418
|
+
for (var i = 0; i < pointsB.length; i++) points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
7419
|
+
} else {
|
|
7420
|
+
points = pointsB.map(function (point) {
|
|
7421
|
+
var p = new vutils.Point(point.x, point.y, point.x1, point.y1);
|
|
7422
|
+
return p.defined = point.defined, p;
|
|
7423
|
+
});
|
|
7424
|
+
for (var _i2 = 0; _i2 < pointsA.length; _i2++) points[_i2] = pointInterpolation(pointsA[_i2], pointsB[_i2], ratio);
|
|
7425
|
+
}
|
|
7426
|
+
return points;
|
|
7427
|
+
}
|
|
7428
|
+
function getAttributeFromDefaultAttrList(attr, key) {
|
|
7429
|
+
if (vutils.isArray(attr)) {
|
|
7430
|
+
var val;
|
|
7431
|
+
for (var i = 0; i < attr.length && void 0 === val; i++) val = attr[i][key];
|
|
7432
|
+
return val;
|
|
7433
|
+
}
|
|
7434
|
+
return attr[key];
|
|
7435
|
+
}
|
|
7436
|
+
var RafBasedSTO = /*#__PURE__*/function () {
|
|
7437
|
+
function RafBasedSTO() {
|
|
7438
|
+
_classCallCheck(this, RafBasedSTO);
|
|
7439
|
+
this.durations = [], this.timeout = RafBasedSTO.TimeOut, this.lastDate = 0, this.durationsListThreshold = 30;
|
|
7440
|
+
}
|
|
7441
|
+
_createClass(RafBasedSTO, [{
|
|
7442
|
+
key: "call",
|
|
7443
|
+
value: function call(cb) {
|
|
7444
|
+
var _this = this;
|
|
7445
|
+
return this.lastDate = Date.now(), setTimeout(function () {
|
|
7446
|
+
_this.appendDuration(Date.now() - _this.lastDate), cb(0);
|
|
7447
|
+
}, this.timeout, !0);
|
|
7448
|
+
}
|
|
7449
|
+
}, {
|
|
7450
|
+
key: "clear",
|
|
7451
|
+
value: function clear(h) {
|
|
7452
|
+
clearTimeout(h);
|
|
7453
|
+
}
|
|
7454
|
+
}, {
|
|
7455
|
+
key: "appendDuration",
|
|
7456
|
+
value: function appendDuration(d) {
|
|
7457
|
+
this.durations.push(d), this.durations.length > this.durationsListThreshold && this.durations.shift(), this.timeout = Math.min(Math.max(this.durations.reduce(function (a, b) {
|
|
7458
|
+
return a + b;
|
|
7459
|
+
}, 0) / this.durations.length, 1e3 / 60), 1e3 / 30);
|
|
7460
|
+
}
|
|
7461
|
+
}]);
|
|
7462
|
+
return RafBasedSTO;
|
|
7463
|
+
}();
|
|
7464
|
+
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
7465
|
+
new RafBasedSTO();
|
|
7466
|
+
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
7467
|
+
if (vutils.isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
7468
|
+
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
7469
|
+
}
|
|
7470
|
+
return lineHeight;
|
|
7471
|
+
};
|
|
7472
|
+
|
|
7475
7473
|
var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
|
|
7476
7474
|
_inherits(IncreaseCount, _ACustomAnimate);
|
|
7477
7475
|
var _super = _createSuper(IncreaseCount);
|
|
@@ -11932,7 +11930,9 @@
|
|
|
11932
11930
|
var Paragraph = /*#__PURE__*/function () {
|
|
11933
11931
|
function Paragraph(text, newLine, character) {
|
|
11934
11932
|
_classCallCheck(this, Paragraph);
|
|
11935
|
-
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic"
|
|
11933
|
+
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
11934
|
+
var lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
11935
|
+
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
11936
11936
|
var _measureTextCanvas = measureTextCanvas(text, character),
|
|
11937
11937
|
ascent = _measureTextCanvas.ascent,
|
|
11938
11938
|
height = _measureTextCanvas.height,
|
|
@@ -20947,7 +20947,7 @@
|
|
|
20947
20947
|
return new vutils.TextMeasure(Object.assign({ defaultFontParams: {
|
|
20948
20948
|
fontFamily: DEFAULT_TEXT_FONT_FAMILY,
|
|
20949
20949
|
fontSize: DEFAULT_TEXT_FONT_SIZE
|
|
20950
|
-
}, getTextBounds: useNaiveCanvas ? undefined : getTextBounds, specialCharSet: '-/: .,@%\'"~' + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})),
|
|
20950
|
+
}, getTextBounds: useNaiveCanvas ? undefined : getTextBounds, specialCharSet: '-/: .,@%\'"~' + vutils.TextMeasure.ALPHABET_CHAR_SET + vutils.TextMeasure.ALPHABET_CHAR_SET.toUpperCase() }, (option !== null && option !== void 0 ? option : {})), textSpec);
|
|
20951
20951
|
};
|
|
20952
20952
|
function measureTextSize(text, textSpec) {
|
|
20953
20953
|
var _a;
|
|
@@ -31408,7 +31408,7 @@
|
|
|
31408
31408
|
}
|
|
31409
31409
|
};
|
|
31410
31410
|
|
|
31411
|
-
const version = "0.16.14-alpha.
|
|
31411
|
+
const version = "0.16.14-alpha.5";
|
|
31412
31412
|
|
|
31413
31413
|
exports.AbstractComponent = AbstractComponent;
|
|
31414
31414
|
exports.ArcInfo = ArcInfo;
|