@visactor/vrender 0.20.3 → 0.20.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.es.js +90 -34
- package/dist/index.js +90 -34
- 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 +4 -4
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
|
|
22
22
|
const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits"), vrender_kits_2 = require("@visactor/vrender-kits");
|
|
23
23
|
|
|
24
|
-
exports.version = "0.20.
|
|
24
|
+
exports.version = "0.20.5", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
|
|
25
25
|
vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0, vrender_core_1.isNodeEnv)() && (0,
|
|
26
26
|
vrender_kits_1.loadNodeEnv)(vrender_core_1.container), (0, vrender_kits_2.registerArc)(),
|
|
27
27
|
(0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(), (0, vrender_kits_2.registerCircle)(),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AACtB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\nexport const version = \"0.20.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,4CAA6B,GAAE,CAAC;AAChC,IAAA,0CAA2B,GAAE,CAAC;AAC9B,IAAA,2CAA4B,GAAE,CAAC;AAC/B,IAAA,uCAAwB,GAAE,CAAC;AAC3B,IAAA,kCAAmB,GAAE,CAAC;AACtB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport {\n container,\n isBrowserEnv,\n isNodeEnv,\n preLoadAllModule,\n registerFlexLayoutPlugin,\n registerViewTransform3dPlugin,\n registerHtmlAttributePlugin,\n registerReactAttributePlugin,\n registerDirectionalLight,\n registerOrthoCamera\n} from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\nexport const version = \"0.20.5\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\n\nregisterFlexLayoutPlugin();\nregisterViewTransform3dPlugin();\nregisterHtmlAttributePlugin();\nregisterReactAttributePlugin();\nregisterDirectionalLight();\nregisterOrthoCamera();\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -2549,7 +2549,7 @@ class BoundsContext {
|
|
|
2549
2549
|
this.bounds.add(cx + xmin, cy + ymin), this.bounds.add(cx + xmax, cy + ymax);
|
|
2550
2550
|
}
|
|
2551
2551
|
arcTo(x1, y1, x2, y2, radius) {
|
|
2552
|
-
|
|
2552
|
+
this.bounds.add(x1, y1);
|
|
2553
2553
|
}
|
|
2554
2554
|
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
|
|
2555
2555
|
this.bounds.add(cp1x, cp1y), this.bounds.add(cp2x, cp2y), this.bounds.add(x, y);
|
|
@@ -2758,19 +2758,25 @@ function drawArc(context, x, y, coords) {
|
|
|
2758
2758
|
}
|
|
2759
2759
|
const addArcToBezierPath$1 = (bezierPath, startAngle, endAngle, cx, cy, rx, ry) => {
|
|
2760
2760
|
const delta = Math.abs(endAngle - startAngle),
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2761
|
+
count = delta > .5 * Math.PI ? Math.ceil(2 * delta / Math.PI) : 1,
|
|
2762
|
+
stepAngle = (endAngle - startAngle) / count;
|
|
2763
|
+
for (let i = 0; i < count; i++) {
|
|
2764
|
+
const sa = startAngle + stepAngle * i,
|
|
2765
|
+
ea = startAngle + stepAngle * (i + 1),
|
|
2766
|
+
len = 4 * Math.tan(Math.abs(stepAngle) / 4) / 3,
|
|
2767
|
+
dir = ea < sa ? -1 : 1,
|
|
2768
|
+
c1 = Math.cos(sa),
|
|
2769
|
+
s1 = Math.sin(sa),
|
|
2770
|
+
c2 = Math.cos(ea),
|
|
2771
|
+
s2 = Math.sin(ea),
|
|
2772
|
+
x1 = c1 * rx + cx,
|
|
2773
|
+
y1 = s1 * ry + cy,
|
|
2774
|
+
x4 = c2 * rx + cx,
|
|
2775
|
+
y4 = s2 * ry + cy,
|
|
2776
|
+
hx = rx * len * dir,
|
|
2777
|
+
hy = ry * len * dir;
|
|
2778
|
+
bezierPath.push(x1 - hx * s1, y1 + hy * c1, x4 + hx * s2, y4 - hy * c2, x4, y4);
|
|
2779
|
+
}
|
|
2774
2780
|
};
|
|
2775
2781
|
|
|
2776
2782
|
const commandFuncs = [(command, context, x, y, sx, sy, z) => context.arc(command[1] * sx + x, command[2] * sy + y, command[3] * (sx + sy) / 2, command[4], command[5], command[6], z), (command, context, x, y, sx, sy, z) => context.arcTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * (sx + sy) / 2, z), (command, context, x, y, sx, sy, z) => context.bezierCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * sx + x, command[6] * sy + y, z), (command, context, x, y) => context.closePath(), (command, context, x, y, sx, sy) => context.ellipse(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, command[5], command[6], command[7], command[8]), (command, context, x, y, sx, sy, z) => context.lineTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.moveTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.quadraticCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, z), (command, context, x, y, sx, sy, z) => context.rect(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, z)];
|
|
@@ -11237,6 +11243,7 @@ let DefaultGraphicService = class {
|
|
|
11237
11243
|
validCheck(attribute, theme, aabbBounds, graphic) {
|
|
11238
11244
|
if (!graphic) return !0;
|
|
11239
11245
|
if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
|
|
11246
|
+
if (graphic.shadowRoot) return !0;
|
|
11240
11247
|
if (!graphic.valid) return aabbBounds.clear(), !1;
|
|
11241
11248
|
const {
|
|
11242
11249
|
visible = theme.visible
|
|
@@ -14383,13 +14390,23 @@ class Text extends Graphic {
|
|
|
14383
14390
|
if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
|
|
14384
14391
|
}
|
|
14385
14392
|
get cliped() {
|
|
14393
|
+
var _a, _b;
|
|
14386
14394
|
const textTheme = this.getGraphicTheme(),
|
|
14387
|
-
attribute = this.attribute
|
|
14388
|
-
|
|
14389
|
-
|
|
14390
|
-
|
|
14391
|
-
|
|
14392
|
-
|
|
14395
|
+
attribute = this.attribute,
|
|
14396
|
+
{
|
|
14397
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
14398
|
+
text: text,
|
|
14399
|
+
whiteSpace = textTheme.whiteSpace
|
|
14400
|
+
} = attribute;
|
|
14401
|
+
if (!Number.isFinite(maxLineWidth)) return !1;
|
|
14402
|
+
if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
|
|
14403
|
+
let mergedText = "";
|
|
14404
|
+
this.cache.layoutData.lines.forEach(item => {
|
|
14405
|
+
mergedText += item.str;
|
|
14406
|
+
});
|
|
14407
|
+
return (Array.isArray(text) ? text.join("") : text) !== mergedText;
|
|
14408
|
+
}
|
|
14409
|
+
return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
|
|
14393
14410
|
}
|
|
14394
14411
|
get multilineLayout() {
|
|
14395
14412
|
if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
|
|
@@ -16290,10 +16307,22 @@ class Line {
|
|
|
16290
16307
|
}
|
|
16291
16308
|
draw(ctx, lastLine, x, y, drawEllipsis, drawIcon) {
|
|
16292
16309
|
if (drawEllipsis && (lastLine || this.paragraphs.some(p => p.overflow))) {
|
|
16293
|
-
let
|
|
16310
|
+
let emptyOverflow = !0,
|
|
16311
|
+
skipEllipsis = !1;
|
|
16294
16312
|
for (let i = this.paragraphs.length - 1; i >= 0; i--) {
|
|
16295
16313
|
const paragraph = this.paragraphs[i];
|
|
16296
|
-
if (paragraph.overflow)
|
|
16314
|
+
if (paragraph.overflow) emptyOverflow = emptyOverflow && "" === paragraph.text;else if (emptyOverflow) {
|
|
16315
|
+
skipEllipsis = !0;
|
|
16316
|
+
break;
|
|
16317
|
+
}
|
|
16318
|
+
}
|
|
16319
|
+
let otherParagraphWidth = 0;
|
|
16320
|
+
if (!skipEllipsis) for (let i = this.paragraphs.length - 1; i >= 0; i--) {
|
|
16321
|
+
const paragraph = this.paragraphs[i];
|
|
16322
|
+
if (paragraph.overflow) {
|
|
16323
|
+
if ("" === paragraph.text) break;
|
|
16324
|
+
continue;
|
|
16325
|
+
}
|
|
16297
16326
|
if (paragraph instanceof RichTextIcon) break;
|
|
16298
16327
|
if ("vertical" === this.direction && "vertical" !== paragraph.direction) {
|
|
16299
16328
|
paragraph.verticalEllipsis = !0;
|
|
@@ -16387,7 +16416,13 @@ class Wrapper {
|
|
|
16387
16416
|
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
16388
16417
|
class RichText extends Graphic {
|
|
16389
16418
|
constructor(params) {
|
|
16390
|
-
super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE
|
|
16419
|
+
super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE, this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
16420
|
+
for (const key in val) if ("hoverIconId" === key) {
|
|
16421
|
+
if (val[key] === attributes[key]) continue;
|
|
16422
|
+
const icon = this._frameCache.icons.get(val[key]);
|
|
16423
|
+
this.updateHoverIconState(icon);
|
|
16424
|
+
}
|
|
16425
|
+
};
|
|
16391
16426
|
}
|
|
16392
16427
|
get width() {
|
|
16393
16428
|
var _a;
|
|
@@ -16512,6 +16547,21 @@ class RichText extends Graphic {
|
|
|
16512
16547
|
getFrameCache() {
|
|
16513
16548
|
return this.shouldUpdateShape() && (this.doUpdateFrameCache(), this.clearUpdateShapeTag()), this._frameCache;
|
|
16514
16549
|
}
|
|
16550
|
+
get cliped() {
|
|
16551
|
+
const frameCache = this.getFrameCache();
|
|
16552
|
+
if (frameCache.actualHeight > frameCache.height) return !0;
|
|
16553
|
+
const {
|
|
16554
|
+
disableAutoWrapLine: disableAutoWrapLine
|
|
16555
|
+
} = this.attribute;
|
|
16556
|
+
if (disableAutoWrapLine) for (let i = 0; i < frameCache.lines.length; i++) {
|
|
16557
|
+
const l = frameCache.lines[i];
|
|
16558
|
+
for (let j = 0; j < l.paragraphs.length; j++) {
|
|
16559
|
+
const p = l.paragraphs[j];
|
|
16560
|
+
if (p.overflow && "" !== p.text) return !0;
|
|
16561
|
+
}
|
|
16562
|
+
}
|
|
16563
|
+
return !1;
|
|
16564
|
+
}
|
|
16515
16565
|
combinedStyleToCharacter(config) {
|
|
16516
16566
|
const {
|
|
16517
16567
|
fill: fill,
|
|
@@ -16558,8 +16608,9 @@ class RichText extends Graphic {
|
|
|
16558
16608
|
paragraphs = [],
|
|
16559
16609
|
textConfig = null != tc ? tc : _tc;
|
|
16560
16610
|
for (let i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
|
|
16561
|
-
const config = this.combinedStyleToCharacter(textConfig[i])
|
|
16562
|
-
|
|
16611
|
+
const config = this.combinedStyleToCharacter(textConfig[i]);
|
|
16612
|
+
config.lineWidth = void 0;
|
|
16613
|
+
const iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
|
|
16563
16614
|
if (iconCache) paragraphs.push(iconCache);else {
|
|
16564
16615
|
const icon = new RichTextIcon(config);
|
|
16565
16616
|
icon.successCallback = () => {
|
|
@@ -16609,14 +16660,16 @@ class RichText extends Graphic {
|
|
|
16609
16660
|
}
|
|
16610
16661
|
bindIconEvent() {
|
|
16611
16662
|
this.addEventListener("pointermove", e => {
|
|
16612
|
-
var _a, _b, _c, _d, _e;
|
|
16613
16663
|
const pickedIcon = this.pickIcon(e.global);
|
|
16614
|
-
pickedIcon && pickedIcon === this._currentHoverIcon || (pickedIcon ?
|
|
16664
|
+
pickedIcon && pickedIcon === this._currentHoverIcon || (pickedIcon ? this.setAttribute("hoverIconId", pickedIcon.richtextId) : !pickedIcon && this._currentHoverIcon && this.setAttribute("hoverIconId", void 0));
|
|
16615
16665
|
}), this.addEventListener("pointerleave", e => {
|
|
16616
|
-
|
|
16617
|
-
this._currentHoverIcon && (this._currentHoverIcon.setHoverState(!1), this._currentHoverIcon = null, null === (_a = this.stage) || void 0 === _a || _a.setCursor(), null === (_b = this.stage) || void 0 === _b || _b.renderNextFrame());
|
|
16666
|
+
this._currentHoverIcon && this.setAttribute("hoverIconId", void 0);
|
|
16618
16667
|
});
|
|
16619
16668
|
}
|
|
16669
|
+
updateHoverIconState(pickedIcon) {
|
|
16670
|
+
var _a, _b, _c, _d, _e;
|
|
16671
|
+
pickedIcon ? (null === (_a = this._currentHoverIcon) || void 0 === _a || _a.setHoverState(!1), this._currentHoverIcon = pickedIcon, this._currentHoverIcon.setHoverState(!0), null === (_b = this.stage) || void 0 === _b || _b.setCursor(pickedIcon.attribute.cursor), null === (_c = this.stage) || void 0 === _c || _c.renderNextFrame()) : (this._currentHoverIcon.setHoverState(!1), this._currentHoverIcon = null, null === (_d = this.stage) || void 0 === _d || _d.setCursor(), null === (_e = this.stage) || void 0 === _e || _e.renderNextFrame());
|
|
16672
|
+
}
|
|
16620
16673
|
pickIcon(point) {
|
|
16621
16674
|
const frameCache = this.getFrameCache(),
|
|
16622
16675
|
{
|
|
@@ -16624,7 +16677,7 @@ class RichText extends Graphic {
|
|
|
16624
16677
|
f: y
|
|
16625
16678
|
} = this.globalTransMatrix;
|
|
16626
16679
|
let pickIcon;
|
|
16627
|
-
return frameCache.icons.forEach(icon => {
|
|
16680
|
+
return frameCache.icons.forEach((icon, key) => {
|
|
16628
16681
|
var _a, _b;
|
|
16629
16682
|
const bounds = icon.AABBBounds.clone();
|
|
16630
16683
|
bounds.translate(icon._marginArray[3], icon._marginArray[0]), bounds.containsPoint({
|
|
@@ -18278,7 +18331,8 @@ class Stage extends Group {
|
|
|
18278
18331
|
});
|
|
18279
18332
|
}
|
|
18280
18333
|
pauseRender() {
|
|
18281
|
-
|
|
18334
|
+
let sr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
18335
|
+
this._skipRender = sr;
|
|
18282
18336
|
}
|
|
18283
18337
|
resumeRender() {
|
|
18284
18338
|
this._skipRender = 0;
|
|
@@ -18585,8 +18639,7 @@ class Stage extends Group {
|
|
|
18585
18639
|
}
|
|
18586
18640
|
pick(x, y) {
|
|
18587
18641
|
if ("released" === this.releaseStatus) return;
|
|
18588
|
-
this.
|
|
18589
|
-
const result = this.pickerService.pick(this.children, new Point(x, y), {
|
|
18642
|
+
const result = this.getPickerService().pick(this.children, new Point(x, y), {
|
|
18590
18643
|
bounds: this.AABBBounds
|
|
18591
18644
|
});
|
|
18592
18645
|
return !(!(null == result ? void 0 : result.graphic) && !(null == result ? void 0 : result.group)) && result;
|
|
@@ -18671,6 +18724,9 @@ class Stage extends Group {
|
|
|
18671
18724
|
resumeTriggerEvent() {
|
|
18672
18725
|
this._eventSystem && this._eventSystem.resumeTriggerEvent();
|
|
18673
18726
|
}
|
|
18727
|
+
getPickerService() {
|
|
18728
|
+
return this.pickerService || (this.pickerService = container.get(PickerService)), this.pickerService;
|
|
18729
|
+
}
|
|
18674
18730
|
}
|
|
18675
18731
|
|
|
18676
18732
|
function createStage(params) {
|
|
@@ -28273,7 +28329,7 @@ const registerWrapText = _registerWrapText;
|
|
|
28273
28329
|
|
|
28274
28330
|
const roughModule = _roughModule;
|
|
28275
28331
|
|
|
28276
|
-
const version = "0.20.
|
|
28332
|
+
const version = "0.20.5";
|
|
28277
28333
|
preLoadAllModule();
|
|
28278
28334
|
if (isBrowserEnv()) {
|
|
28279
28335
|
loadBrowserEnv(container);
|
package/dist/index.js
CHANGED
|
@@ -2555,7 +2555,7 @@
|
|
|
2555
2555
|
this.bounds.add(cx + xmin, cy + ymin), this.bounds.add(cx + xmax, cy + ymax);
|
|
2556
2556
|
}
|
|
2557
2557
|
arcTo(x1, y1, x2, y2, radius) {
|
|
2558
|
-
|
|
2558
|
+
this.bounds.add(x1, y1);
|
|
2559
2559
|
}
|
|
2560
2560
|
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
|
|
2561
2561
|
this.bounds.add(cp1x, cp1y), this.bounds.add(cp2x, cp2y), this.bounds.add(x, y);
|
|
@@ -2764,19 +2764,25 @@
|
|
|
2764
2764
|
}
|
|
2765
2765
|
const addArcToBezierPath$1 = (bezierPath, startAngle, endAngle, cx, cy, rx, ry) => {
|
|
2766
2766
|
const delta = Math.abs(endAngle - startAngle),
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2767
|
+
count = delta > .5 * Math.PI ? Math.ceil(2 * delta / Math.PI) : 1,
|
|
2768
|
+
stepAngle = (endAngle - startAngle) / count;
|
|
2769
|
+
for (let i = 0; i < count; i++) {
|
|
2770
|
+
const sa = startAngle + stepAngle * i,
|
|
2771
|
+
ea = startAngle + stepAngle * (i + 1),
|
|
2772
|
+
len = 4 * Math.tan(Math.abs(stepAngle) / 4) / 3,
|
|
2773
|
+
dir = ea < sa ? -1 : 1,
|
|
2774
|
+
c1 = Math.cos(sa),
|
|
2775
|
+
s1 = Math.sin(sa),
|
|
2776
|
+
c2 = Math.cos(ea),
|
|
2777
|
+
s2 = Math.sin(ea),
|
|
2778
|
+
x1 = c1 * rx + cx,
|
|
2779
|
+
y1 = s1 * ry + cy,
|
|
2780
|
+
x4 = c2 * rx + cx,
|
|
2781
|
+
y4 = s2 * ry + cy,
|
|
2782
|
+
hx = rx * len * dir,
|
|
2783
|
+
hy = ry * len * dir;
|
|
2784
|
+
bezierPath.push(x1 - hx * s1, y1 + hy * c1, x4 + hx * s2, y4 - hy * c2, x4, y4);
|
|
2785
|
+
}
|
|
2780
2786
|
};
|
|
2781
2787
|
|
|
2782
2788
|
const commandFuncs = [(command, context, x, y, sx, sy, z) => context.arc(command[1] * sx + x, command[2] * sy + y, command[3] * (sx + sy) / 2, command[4], command[5], command[6], z), (command, context, x, y, sx, sy, z) => context.arcTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * (sx + sy) / 2, z), (command, context, x, y, sx, sy, z) => context.bezierCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * sx + x, command[6] * sy + y, z), (command, context, x, y) => context.closePath(), (command, context, x, y, sx, sy) => context.ellipse(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, command[5], command[6], command[7], command[8]), (command, context, x, y, sx, sy, z) => context.lineTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.moveTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.quadraticCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, z), (command, context, x, y, sx, sy, z) => context.rect(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, z)];
|
|
@@ -11243,6 +11249,7 @@
|
|
|
11243
11249
|
validCheck(attribute, theme, aabbBounds, graphic) {
|
|
11244
11250
|
if (!graphic) return !0;
|
|
11245
11251
|
if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
|
|
11252
|
+
if (graphic.shadowRoot) return !0;
|
|
11246
11253
|
if (!graphic.valid) return aabbBounds.clear(), !1;
|
|
11247
11254
|
const {
|
|
11248
11255
|
visible = theme.visible
|
|
@@ -14389,13 +14396,23 @@
|
|
|
14389
14396
|
if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
|
|
14390
14397
|
}
|
|
14391
14398
|
get cliped() {
|
|
14399
|
+
var _a, _b;
|
|
14392
14400
|
const textTheme = this.getGraphicTheme(),
|
|
14393
|
-
attribute = this.attribute
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
|
|
14401
|
+
attribute = this.attribute,
|
|
14402
|
+
{
|
|
14403
|
+
maxLineWidth = textTheme.maxLineWidth,
|
|
14404
|
+
text: text,
|
|
14405
|
+
whiteSpace = textTheme.whiteSpace
|
|
14406
|
+
} = attribute;
|
|
14407
|
+
if (!Number.isFinite(maxLineWidth)) return !1;
|
|
14408
|
+
if (this.tryUpdateAABBBounds(), null === (_b = null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData) || void 0 === _b ? void 0 : _b.lines) {
|
|
14409
|
+
let mergedText = "";
|
|
14410
|
+
this.cache.layoutData.lines.forEach(item => {
|
|
14411
|
+
mergedText += item.str;
|
|
14412
|
+
});
|
|
14413
|
+
return (Array.isArray(text) ? text.join("") : text) !== mergedText;
|
|
14414
|
+
}
|
|
14415
|
+
return "vertical" === attribute.direction && this.cache.verticalList && this.cache.verticalList[0] ? this.cache.verticalList[0].map(item => item.text).join("") !== attribute.text.toString() : null != this.clipedText && this.clipedText !== attribute.text.toString();
|
|
14399
14416
|
}
|
|
14400
14417
|
get multilineLayout() {
|
|
14401
14418
|
if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
|
|
@@ -16296,10 +16313,22 @@
|
|
|
16296
16313
|
}
|
|
16297
16314
|
draw(ctx, lastLine, x, y, drawEllipsis, drawIcon) {
|
|
16298
16315
|
if (drawEllipsis && (lastLine || this.paragraphs.some(p => p.overflow))) {
|
|
16299
|
-
let
|
|
16316
|
+
let emptyOverflow = !0,
|
|
16317
|
+
skipEllipsis = !1;
|
|
16300
16318
|
for (let i = this.paragraphs.length - 1; i >= 0; i--) {
|
|
16301
16319
|
const paragraph = this.paragraphs[i];
|
|
16302
|
-
if (paragraph.overflow)
|
|
16320
|
+
if (paragraph.overflow) emptyOverflow = emptyOverflow && "" === paragraph.text;else if (emptyOverflow) {
|
|
16321
|
+
skipEllipsis = !0;
|
|
16322
|
+
break;
|
|
16323
|
+
}
|
|
16324
|
+
}
|
|
16325
|
+
let otherParagraphWidth = 0;
|
|
16326
|
+
if (!skipEllipsis) for (let i = this.paragraphs.length - 1; i >= 0; i--) {
|
|
16327
|
+
const paragraph = this.paragraphs[i];
|
|
16328
|
+
if (paragraph.overflow) {
|
|
16329
|
+
if ("" === paragraph.text) break;
|
|
16330
|
+
continue;
|
|
16331
|
+
}
|
|
16303
16332
|
if (paragraph instanceof RichTextIcon) break;
|
|
16304
16333
|
if ("vertical" === this.direction && "vertical" !== paragraph.direction) {
|
|
16305
16334
|
paragraph.verticalEllipsis = !0;
|
|
@@ -16393,7 +16422,13 @@
|
|
|
16393
16422
|
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
16394
16423
|
class RichText extends Graphic {
|
|
16395
16424
|
constructor(params) {
|
|
16396
|
-
super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE
|
|
16425
|
+
super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE, this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
16426
|
+
for (const key in val) if ("hoverIconId" === key) {
|
|
16427
|
+
if (val[key] === attributes[key]) continue;
|
|
16428
|
+
const icon = this._frameCache.icons.get(val[key]);
|
|
16429
|
+
this.updateHoverIconState(icon);
|
|
16430
|
+
}
|
|
16431
|
+
};
|
|
16397
16432
|
}
|
|
16398
16433
|
get width() {
|
|
16399
16434
|
var _a;
|
|
@@ -16518,6 +16553,21 @@
|
|
|
16518
16553
|
getFrameCache() {
|
|
16519
16554
|
return this.shouldUpdateShape() && (this.doUpdateFrameCache(), this.clearUpdateShapeTag()), this._frameCache;
|
|
16520
16555
|
}
|
|
16556
|
+
get cliped() {
|
|
16557
|
+
const frameCache = this.getFrameCache();
|
|
16558
|
+
if (frameCache.actualHeight > frameCache.height) return !0;
|
|
16559
|
+
const {
|
|
16560
|
+
disableAutoWrapLine: disableAutoWrapLine
|
|
16561
|
+
} = this.attribute;
|
|
16562
|
+
if (disableAutoWrapLine) for (let i = 0; i < frameCache.lines.length; i++) {
|
|
16563
|
+
const l = frameCache.lines[i];
|
|
16564
|
+
for (let j = 0; j < l.paragraphs.length; j++) {
|
|
16565
|
+
const p = l.paragraphs[j];
|
|
16566
|
+
if (p.overflow && "" !== p.text) return !0;
|
|
16567
|
+
}
|
|
16568
|
+
}
|
|
16569
|
+
return !1;
|
|
16570
|
+
}
|
|
16521
16571
|
combinedStyleToCharacter(config) {
|
|
16522
16572
|
const {
|
|
16523
16573
|
fill: fill,
|
|
@@ -16564,8 +16614,9 @@
|
|
|
16564
16614
|
paragraphs = [],
|
|
16565
16615
|
textConfig = null != tc ? tc : _tc;
|
|
16566
16616
|
for (let i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
|
|
16567
|
-
const config = this.combinedStyleToCharacter(textConfig[i])
|
|
16568
|
-
|
|
16617
|
+
const config = this.combinedStyleToCharacter(textConfig[i]);
|
|
16618
|
+
config.lineWidth = void 0;
|
|
16619
|
+
const iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
|
|
16569
16620
|
if (iconCache) paragraphs.push(iconCache);else {
|
|
16570
16621
|
const icon = new RichTextIcon(config);
|
|
16571
16622
|
icon.successCallback = () => {
|
|
@@ -16615,14 +16666,16 @@
|
|
|
16615
16666
|
}
|
|
16616
16667
|
bindIconEvent() {
|
|
16617
16668
|
this.addEventListener("pointermove", e => {
|
|
16618
|
-
var _a, _b, _c, _d, _e;
|
|
16619
16669
|
const pickedIcon = this.pickIcon(e.global);
|
|
16620
|
-
pickedIcon && pickedIcon === this._currentHoverIcon || (pickedIcon ?
|
|
16670
|
+
pickedIcon && pickedIcon === this._currentHoverIcon || (pickedIcon ? this.setAttribute("hoverIconId", pickedIcon.richtextId) : !pickedIcon && this._currentHoverIcon && this.setAttribute("hoverIconId", void 0));
|
|
16621
16671
|
}), this.addEventListener("pointerleave", e => {
|
|
16622
|
-
|
|
16623
|
-
this._currentHoverIcon && (this._currentHoverIcon.setHoverState(!1), this._currentHoverIcon = null, null === (_a = this.stage) || void 0 === _a || _a.setCursor(), null === (_b = this.stage) || void 0 === _b || _b.renderNextFrame());
|
|
16672
|
+
this._currentHoverIcon && this.setAttribute("hoverIconId", void 0);
|
|
16624
16673
|
});
|
|
16625
16674
|
}
|
|
16675
|
+
updateHoverIconState(pickedIcon) {
|
|
16676
|
+
var _a, _b, _c, _d, _e;
|
|
16677
|
+
pickedIcon ? (null === (_a = this._currentHoverIcon) || void 0 === _a || _a.setHoverState(!1), this._currentHoverIcon = pickedIcon, this._currentHoverIcon.setHoverState(!0), null === (_b = this.stage) || void 0 === _b || _b.setCursor(pickedIcon.attribute.cursor), null === (_c = this.stage) || void 0 === _c || _c.renderNextFrame()) : (this._currentHoverIcon.setHoverState(!1), this._currentHoverIcon = null, null === (_d = this.stage) || void 0 === _d || _d.setCursor(), null === (_e = this.stage) || void 0 === _e || _e.renderNextFrame());
|
|
16678
|
+
}
|
|
16626
16679
|
pickIcon(point) {
|
|
16627
16680
|
const frameCache = this.getFrameCache(),
|
|
16628
16681
|
{
|
|
@@ -16630,7 +16683,7 @@
|
|
|
16630
16683
|
f: y
|
|
16631
16684
|
} = this.globalTransMatrix;
|
|
16632
16685
|
let pickIcon;
|
|
16633
|
-
return frameCache.icons.forEach(icon => {
|
|
16686
|
+
return frameCache.icons.forEach((icon, key) => {
|
|
16634
16687
|
var _a, _b;
|
|
16635
16688
|
const bounds = icon.AABBBounds.clone();
|
|
16636
16689
|
bounds.translate(icon._marginArray[3], icon._marginArray[0]), bounds.containsPoint({
|
|
@@ -18284,7 +18337,8 @@
|
|
|
18284
18337
|
});
|
|
18285
18338
|
}
|
|
18286
18339
|
pauseRender() {
|
|
18287
|
-
|
|
18340
|
+
let sr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
18341
|
+
this._skipRender = sr;
|
|
18288
18342
|
}
|
|
18289
18343
|
resumeRender() {
|
|
18290
18344
|
this._skipRender = 0;
|
|
@@ -18591,8 +18645,7 @@
|
|
|
18591
18645
|
}
|
|
18592
18646
|
pick(x, y) {
|
|
18593
18647
|
if ("released" === this.releaseStatus) return;
|
|
18594
|
-
this.
|
|
18595
|
-
const result = this.pickerService.pick(this.children, new Point(x, y), {
|
|
18648
|
+
const result = this.getPickerService().pick(this.children, new Point(x, y), {
|
|
18596
18649
|
bounds: this.AABBBounds
|
|
18597
18650
|
});
|
|
18598
18651
|
return !(!(null == result ? void 0 : result.graphic) && !(null == result ? void 0 : result.group)) && result;
|
|
@@ -18677,6 +18730,9 @@
|
|
|
18677
18730
|
resumeTriggerEvent() {
|
|
18678
18731
|
this._eventSystem && this._eventSystem.resumeTriggerEvent();
|
|
18679
18732
|
}
|
|
18733
|
+
getPickerService() {
|
|
18734
|
+
return this.pickerService || (this.pickerService = container.get(PickerService)), this.pickerService;
|
|
18735
|
+
}
|
|
18680
18736
|
}
|
|
18681
18737
|
|
|
18682
18738
|
function createStage(params) {
|
|
@@ -28279,7 +28335,7 @@
|
|
|
28279
28335
|
|
|
28280
28336
|
const roughModule = _roughModule;
|
|
28281
28337
|
|
|
28282
|
-
const version = "0.20.
|
|
28338
|
+
const version = "0.20.5";
|
|
28283
28339
|
preLoadAllModule();
|
|
28284
28340
|
if (isBrowserEnv()) {
|
|
28285
28341
|
loadBrowserEnv(container);
|