@visactor/vrender 0.22.0-vstory.15 → 0.22.0-vstory.16
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 +129 -87
- package/dist/index.js +129 -87
- 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 +3 -3
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.22.0-vstory.
|
|
24
|
+
exports.version = "0.22.0-vstory.16", (0, vrender_core_1.preLoadAllModule)(), (0,
|
|
25
25
|
vrender_core_1.isBrowserEnv)() ? (0, vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0,
|
|
26
26
|
vrender_core_1.isNodeEnv)() && (0, vrender_kits_1.loadNodeEnv)(vrender_core_1.container),
|
|
27
27
|
(0, vrender_kits_2.registerArc)(), (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(),
|
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,kBAAkB,CAAC;AAE1C,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.22.0-vstory.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAWgC;AAChC,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,kBAAkB,CAAC;AAE1C,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.22.0-vstory.16\";\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
|
@@ -3918,10 +3918,10 @@ class CustomPath2D extends CurvePath {
|
|
|
3918
3918
|
x = current[5], y = current[6], controlX = current[3], controlY = current[4], this.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t);
|
|
3919
3919
|
break;
|
|
3920
3920
|
case "s":
|
|
3921
|
-
tempX = x + current[3], tempY = y + current[4], controlX = 2 * x - controlX, controlY = 2 * y - controlY, this.bezierCurveTo(controlX + l, controlY + t,
|
|
3921
|
+
tempX = x + current[3], tempY = y + current[4], null === previous[0].match(/[CcSs]/) ? (controlX = x, controlY = y) : (controlX = 2 * x - controlX, controlY = 2 * y - controlY), tempControlX = x + current[1], tempControlY = y + current[2], this.bezierCurveTo(controlX + l, controlY + t, tempControlX + l, tempControlY + t, tempX + l, tempY + t), controlX = tempControlX, controlY = tempControlY, x = tempX, y = tempY;
|
|
3922
3922
|
break;
|
|
3923
3923
|
case "S":
|
|
3924
|
-
tempX = current[3], tempY = current[4], controlX = 2 * x - controlX, controlY = 2 * y - controlY, this.bezierCurveTo(controlX + l, controlY + t,
|
|
3924
|
+
tempX = current[3], tempY = current[4], null === previous[0].match(/[CcSs]/) ? (controlX = x, controlY = y) : (controlX = 2 * x - controlX, controlY = 2 * y - controlY), tempControlX = current[1], tempControlY = current[2], this.bezierCurveTo(controlX + l, controlY + t, tempControlX + l, tempControlY + t, tempX + l, tempY + t), controlX = tempControlX, controlY = tempControlY, x = tempX, y = tempY;
|
|
3925
3925
|
break;
|
|
3926
3926
|
case "q":
|
|
3927
3927
|
tempX = x + current[3], tempY = y + current[4], controlX = x + current[1], controlY = y + current[2], this.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t), x = tempX, y = tempY;
|
|
@@ -4312,6 +4312,7 @@ const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, Defau
|
|
|
4312
4312
|
keepDirIn3d: !0
|
|
4313
4313
|
});
|
|
4314
4314
|
const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), {
|
|
4315
|
+
upgradeAttrs: null,
|
|
4315
4316
|
editable: !1,
|
|
4316
4317
|
editOptions: null,
|
|
4317
4318
|
ascentDescentMode: "actual",
|
|
@@ -10148,7 +10149,7 @@ class Graphic extends Node {
|
|
|
10148
10149
|
null != onStart && animate.onStart(onStart), null != onFrame && animate.onFrame(onFrame), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove), animate.interpolateFunc = params.interpolate;
|
|
10149
10150
|
}
|
|
10150
10151
|
return this.animates.set(animate.id, animate), animate.onRemove(() => {
|
|
10151
|
-
this.animates.delete(animate.id);
|
|
10152
|
+
animate.stop(), this.animates.delete(animate.id);
|
|
10152
10153
|
}), animate;
|
|
10153
10154
|
}
|
|
10154
10155
|
onAttributeUpdate(context) {
|
|
@@ -10352,7 +10353,7 @@ class Graphic extends Node {
|
|
|
10352
10353
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
10353
10354
|
const timeline = stage.getTimeline();
|
|
10354
10355
|
this.animates.forEach(a => {
|
|
10355
|
-
a.setTimeline(timeline);
|
|
10356
|
+
a.timeline === defaultTimeline && a.setTimeline(timeline);
|
|
10356
10357
|
});
|
|
10357
10358
|
}
|
|
10358
10359
|
this._onSetStage && this._onSetStage(this, stage, layer), application.graphicService.onSetStage(this, stage);
|
|
@@ -10456,7 +10457,7 @@ class Graphic extends Node {
|
|
|
10456
10457
|
return shadowRoot && (shadowRoot.shadowHost = this), this.shadowRoot = null != shadowRoot ? shadowRoot : application.graphicService.creator.shadowRoot(this), this.addUpdateBoundTag(), this.shadowRoot.setStage(this.stage, this.layer), this.shadowRoot;
|
|
10457
10458
|
}
|
|
10458
10459
|
detachShadow() {
|
|
10459
|
-
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot = null);
|
|
10460
|
+
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot.release(!0), this.shadowRoot = null);
|
|
10460
10461
|
}
|
|
10461
10462
|
toJson() {
|
|
10462
10463
|
return {
|
|
@@ -10508,7 +10509,7 @@ class Graphic extends Node {
|
|
|
10508
10509
|
});
|
|
10509
10510
|
}
|
|
10510
10511
|
release() {
|
|
10511
|
-
this.releaseStatus = "released", application.graphicService.onRelease(this);
|
|
10512
|
+
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
|
|
10512
10513
|
}
|
|
10513
10514
|
_emitCustomEvent(type, context) {
|
|
10514
10515
|
var _a, _b;
|
|
@@ -11084,6 +11085,11 @@ class Group extends Graphic {
|
|
|
11084
11085
|
getNoWorkAnimateAttr() {
|
|
11085
11086
|
return Group.NOWORK_ANIMATE_ATTR;
|
|
11086
11087
|
}
|
|
11088
|
+
release(all) {
|
|
11089
|
+
all && this.forEachChildren(g => {
|
|
11090
|
+
g.release(all);
|
|
11091
|
+
}), super.release();
|
|
11092
|
+
}
|
|
11087
11093
|
}
|
|
11088
11094
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
11089
11095
|
function createGroup(attributes) {
|
|
@@ -13951,7 +13957,7 @@ class Paragraph {
|
|
|
13951
13957
|
this.width = width, "vertical" === this.direction && (this.widthOrigin = this.width, this.width = this.heightOrigin, this.height = this.widthOrigin);
|
|
13952
13958
|
}
|
|
13953
13959
|
drawBackground(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
13954
|
-
if (!this.character.background || this.character.backgroundOpacity && !(this.character.backgroundOpacity > 0)) return;
|
|
13960
|
+
if ("" === this.text || "\n" === this.text || !this.character.background || this.character.backgroundOpacity && !(this.character.backgroundOpacity > 0)) return;
|
|
13955
13961
|
let baseline = top + ascent,
|
|
13956
13962
|
text = this.text,
|
|
13957
13963
|
left = this.left + deltaLeft;
|
|
@@ -13969,19 +13975,11 @@ class Paragraph {
|
|
|
13969
13975
|
}
|
|
13970
13976
|
}
|
|
13971
13977
|
}
|
|
13972
|
-
switch (this.character.script) {
|
|
13973
|
-
case "super":
|
|
13974
|
-
baseline -= this.ascent * (1 / 3);
|
|
13975
|
-
break;
|
|
13976
|
-
case "sub":
|
|
13977
|
-
baseline += this.descent / 2;
|
|
13978
|
-
}
|
|
13979
|
-
"vertical" === direction && (ctx.save(), ctx.rotateAbout(Math.PI / 2, left, baseline), ctx.translate(-this.heightOrigin || -this.lineHeight / 2, -this.descent / 2), ctx.translate(left, baseline), left = 0, baseline = 0);
|
|
13980
|
-
const fillStyle = ctx.fillStyle,
|
|
13981
|
-
globalAlpha = ctx.globalAlpha;
|
|
13982
|
-
ctx.fillStyle = this.character.background, void 0 !== this.character.backgroundOpacity && (ctx.globalAlpha = this.character.backgroundOpacity);
|
|
13983
13978
|
const lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + lineHeight);
|
|
13984
|
-
|
|
13979
|
+
return Object.assign(Object.assign({}, lrtb), {
|
|
13980
|
+
fillStyle: this.character.background,
|
|
13981
|
+
globalAlpha: this.character.backgroundOpacity
|
|
13982
|
+
});
|
|
13985
13983
|
}
|
|
13986
13984
|
draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
13987
13985
|
let baseline = top + ascent,
|
|
@@ -14255,8 +14253,19 @@ class Line {
|
|
|
14255
14253
|
paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
|
|
14256
14254
|
}
|
|
14257
14255
|
}
|
|
14256
|
+
let fillStyle = "",
|
|
14257
|
+
globalAlpha = -1,
|
|
14258
|
+
currBgList = [];
|
|
14259
|
+
const bgList = [currBgList];
|
|
14258
14260
|
this.paragraphs.forEach((paragraph, index) => {
|
|
14259
|
-
paragraph instanceof RichTextIcon
|
|
14261
|
+
if (paragraph instanceof RichTextIcon) return;
|
|
14262
|
+
const data = paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height);
|
|
14263
|
+
data && (fillStyle === data.fillStyle && globalAlpha === data.globalAlpha || (currBgList = [], bgList.push(currBgList), fillStyle = data.fillStyle, globalAlpha = data.globalAlpha), currBgList.push(data));
|
|
14264
|
+
}), bgList.forEach(bg => {
|
|
14265
|
+
if (0 === bg.length) return;
|
|
14266
|
+
const data = bg[0],
|
|
14267
|
+
end = bg[bg.length - 1];
|
|
14268
|
+
ctx.fillStyle = data.fillStyle, ctx.globalAlpha = data.globalAlpha, ctx.fillRect(data.left, data.top, end.right - data.left, end.bottom - data.top);
|
|
14260
14269
|
}), this.paragraphs.forEach((paragraph, index) => {
|
|
14261
14270
|
if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
|
|
14262
14271
|
x: x + paragraph._x,
|
|
@@ -14522,48 +14531,53 @@ class RichText extends Graphic {
|
|
|
14522
14531
|
}
|
|
14523
14532
|
combinedStyleToCharacter(config) {
|
|
14524
14533
|
const {
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14534
|
+
fill: fill,
|
|
14535
|
+
stroke: stroke,
|
|
14536
|
+
fontSize: fontSize,
|
|
14537
|
+
fontFamily: fontFamily,
|
|
14538
|
+
fontStyle: fontStyle,
|
|
14539
|
+
fontWeight: fontWeight,
|
|
14540
|
+
lineWidth: lineWidth,
|
|
14541
|
+
opacity: opacity,
|
|
14542
|
+
fillOpacity: fillOpacity,
|
|
14543
|
+
lineHeight: lineHeight,
|
|
14544
|
+
strokeOpacity: strokeOpacity,
|
|
14545
|
+
upgradeAttrs: upgradeAttrs
|
|
14546
|
+
} = this.attribute,
|
|
14547
|
+
out = Object.assign({
|
|
14548
|
+
fill: fill,
|
|
14549
|
+
stroke: stroke,
|
|
14550
|
+
fontSize: fontSize,
|
|
14551
|
+
fontFamily: fontFamily,
|
|
14552
|
+
fontStyle: fontStyle,
|
|
14553
|
+
fontWeight: fontWeight,
|
|
14554
|
+
lineWidth: lineWidth,
|
|
14555
|
+
opacity: opacity,
|
|
14556
|
+
fillOpacity: fillOpacity,
|
|
14557
|
+
strokeOpacity: strokeOpacity
|
|
14558
|
+
}, config);
|
|
14559
|
+
return (null == upgradeAttrs ? void 0 : upgradeAttrs.lineHeight) && (out.lineHeight = lineHeight), out;
|
|
14548
14560
|
}
|
|
14549
14561
|
doUpdateFrameCache(tc) {
|
|
14550
14562
|
var _a;
|
|
14551
14563
|
const {
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14564
|
+
maxWidth: maxWidth,
|
|
14565
|
+
maxHeight: maxHeight,
|
|
14566
|
+
width: width,
|
|
14567
|
+
height: height,
|
|
14568
|
+
ellipsis: ellipsis,
|
|
14569
|
+
wordBreak: wordBreak,
|
|
14570
|
+
verticalDirection: verticalDirection,
|
|
14571
|
+
textAlign: textAlign,
|
|
14572
|
+
textBaseline: textBaseline,
|
|
14573
|
+
layoutDirection: layoutDirection,
|
|
14574
|
+
singleLine: singleLine,
|
|
14575
|
+
disableAutoWrapLine: disableAutoWrapLine,
|
|
14576
|
+
editable: editable,
|
|
14577
|
+
ascentDescentMode: ascentDescentMode,
|
|
14578
|
+
upgradeAttrs: upgradeAttrs
|
|
14579
|
+
} = this.attribute,
|
|
14580
|
+
enableMultiBreakLine = upgradeAttrs && upgradeAttrs.multiBreakLine;
|
|
14567
14581
|
let {
|
|
14568
14582
|
textConfig: _tc = []
|
|
14569
14583
|
} = this.attribute;
|
|
@@ -14585,7 +14599,10 @@ class RichText extends Graphic {
|
|
|
14585
14599
|
const richTextConfig = this.combinedStyleToCharacter(textConfig[i]);
|
|
14586
14600
|
if (isNumber$1(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
|
|
14587
14601
|
const textParts = richTextConfig.text.split("\n");
|
|
14588
|
-
for (let j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j],
|
|
14602
|
+
for (let j = 0; j < textParts.length; j++) if (0 === j) paragraphs.push(new Paragraph(textParts[j], !1, richTextConfig, ascentDescentMode));else if (textParts[j] || i === textConfig.length - 1) paragraphs.push(new Paragraph(textParts[j], !0, richTextConfig, ascentDescentMode));else {
|
|
14603
|
+
const nextRichTextConfig = this.combinedStyleToCharacter(textConfig[i + 1]);
|
|
14604
|
+
paragraphs.push(new Paragraph(textParts[j], !0, nextRichTextConfig, ascentDescentMode));
|
|
14605
|
+
}
|
|
14589
14606
|
} else richTextConfig.text && paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig, ascentDescentMode));
|
|
14590
14607
|
}
|
|
14591
14608
|
const maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
|
|
@@ -14594,7 +14611,7 @@ class RichText extends Graphic {
|
|
|
14594
14611
|
richTextHeightEnable = "number" == typeof height && Number.isFinite(height) && height > 0 && (!maxHeightFinite || height <= maxHeight),
|
|
14595
14612
|
frame = new Frame(0, 0, (richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0) || 0, (richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0) || 0, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection || "horizontal", !richTextWidthEnable && maxWidthFinite, !richTextHeightEnable && maxHeightFinite, singleLine || !1, null === (_a = this._frameCache) || void 0 === _a ? void 0 : _a.icons),
|
|
14596
14613
|
wrapper = new Wrapper(frame);
|
|
14597
|
-
if (wrapper.newLine =
|
|
14614
|
+
if (wrapper.newLine = enableMultiBreakLine, disableAutoWrapLine) {
|
|
14598
14615
|
let lineCount = 0,
|
|
14599
14616
|
skip = !1;
|
|
14600
14617
|
for (let i = 0; i < paragraphs.length; i++) {
|
|
@@ -14610,7 +14627,7 @@ class RichText extends Graphic {
|
|
|
14610
14627
|
l.calcOffset(offsetSize, !1);
|
|
14611
14628
|
});
|
|
14612
14629
|
}
|
|
14613
|
-
|
|
14630
|
+
enableMultiBreakLine && frame.lines.forEach(item => {
|
|
14614
14631
|
const lastParagraphs = item.paragraphs;
|
|
14615
14632
|
item.paragraphs = item.paragraphs.filter(p => "" !== p.text), 0 === item.paragraphs.length && lastParagraphs.length && (lastParagraphs[0].text = "\n", item.paragraphs.push(lastParagraphs[0]));
|
|
14616
14633
|
}), this._frameCache = frame;
|
|
@@ -20268,6 +20285,7 @@ function getDefaultCharacterConfig(attribute) {
|
|
|
20268
20285
|
fill = "black",
|
|
20269
20286
|
stroke = !1,
|
|
20270
20287
|
fontWeight = "normal",
|
|
20288
|
+
lineHeight: lineHeight,
|
|
20271
20289
|
fontFamily = "Arial"
|
|
20272
20290
|
} = attribute;
|
|
20273
20291
|
let {
|
|
@@ -20278,7 +20296,8 @@ function getDefaultCharacterConfig(attribute) {
|
|
|
20278
20296
|
stroke: stroke,
|
|
20279
20297
|
fontSize: fontSize,
|
|
20280
20298
|
fontWeight: fontWeight,
|
|
20281
|
-
fontFamily: fontFamily
|
|
20299
|
+
fontFamily: fontFamily,
|
|
20300
|
+
lineHeight: lineHeight
|
|
20282
20301
|
};
|
|
20283
20302
|
}
|
|
20284
20303
|
function findConfigIndexByCursorIdx(textConfig, cursorIndex) {
|
|
@@ -20527,15 +20546,15 @@ class RichTextEditPlugin {
|
|
|
20527
20546
|
}, this.handleFocusOut = () => {
|
|
20528
20547
|
throw new Error("不会走到这里 handleFocusOut");
|
|
20529
20548
|
}, this.handleMove = e => {
|
|
20530
|
-
this.
|
|
20549
|
+
this.currRt && !this.currRt.attribute.editable && this.deFocus(!0), this.isEditableRichtext(e) ? (this.handleEnter(), e.target.once("pointerleave", this.handleLeave, {
|
|
20531
20550
|
capture: !0
|
|
20532
|
-
}), this.tryShowSelection(e, !1));
|
|
20533
|
-
}, this.handleEnter =
|
|
20551
|
+
}), this.tryShowSelection(e, !1)) : this.handleLeave();
|
|
20552
|
+
}, this.handleEnter = () => {
|
|
20534
20553
|
this.editing = !0, this.pluginService.stage.setCursor("text");
|
|
20535
|
-
}, this.handleLeave =
|
|
20554
|
+
}, this.handleLeave = () => {
|
|
20536
20555
|
this.editing = !1, this.pluginService.stage.setCursor("default");
|
|
20537
20556
|
}, this.handlePointerDown = e => {
|
|
20538
|
-
this.editing ? this.onFocus(e) : this.deFocus(!0), this.triggerRender(), this.pointerDown = !0, this.updateCbs.forEach(cb => cb(this.editing ? "onfocus" : "defocus", this));
|
|
20557
|
+
this.editing && this.isEditableRichtext(e) ? this.onFocus(e) : this.deFocus(!0), this.triggerRender(), this.pointerDown = !0, this.updateCbs.forEach(cb => cb(this.editing ? "onfocus" : "defocus", this));
|
|
20539
20558
|
}, this.handlePointerUp = e => {
|
|
20540
20559
|
this.pointerDown = !1;
|
|
20541
20560
|
}, this.handleDBLClick = e => {
|
|
@@ -20643,7 +20662,7 @@ class RichTextEditPlugin {
|
|
|
20643
20662
|
} = cache,
|
|
20644
20663
|
totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;
|
|
20645
20664
|
if (x) {
|
|
20646
|
-
x > 0 && columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 2] && this.curCursorIdx < Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx + .2 : x > 0 && columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 1] && this.curCursorIdx > Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx + 1 - .2 : x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx > Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx - .2 : x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx < Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx - 1 + .2 : this.curCursorIdx += x, this.curCursorIdx < -.1 ? this.curCursorIdx = -.1 : this.curCursorIdx > totalCursorCount + .1 && (this.curCursorIdx = totalCursorCount + .1);
|
|
20665
|
+
x > 0 && columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 2] && this.curCursorIdx < Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx + .2 : x > 0 && columnInfo === lineInfo.paragraphs[lineInfo.paragraphs.length - 1] && this.curCursorIdx > Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx + 1 - .2 : x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx > Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx - .2 : x < 0 && columnInfo === lineInfo.paragraphs[0] && this.curCursorIdx < Math.round(this.curCursorIdx) ? this.curCursorIdx = this.curCursorIdx - 1 + .2 : this.curCursorIdx += x, this.curCursorIdx < -.1 ? this.curCursorIdx = -.1 : this.curCursorIdx > totalCursorCount + .1 && (this.curCursorIdx = totalCursorCount + .1), this.selectionStartCursorIdx = this.curCursorIdx;
|
|
20647
20666
|
const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);
|
|
20648
20667
|
this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt), this.hideSelection();
|
|
20649
20668
|
}
|
|
@@ -20736,7 +20755,8 @@ class RichTextEditPlugin {
|
|
|
20736
20755
|
lineWidth: 1,
|
|
20737
20756
|
zIndex: -1
|
|
20738
20757
|
});
|
|
20739
|
-
this.getShadow(this.currRt)
|
|
20758
|
+
const shadow = this.getShadow(this.currRt);
|
|
20759
|
+
this.addEditLineOrBgOrBounds(this.shadowBounds, shadow), this.offsetLineBgAndShadowBounds(), this.offsetShadowRoot();
|
|
20740
20760
|
}
|
|
20741
20761
|
trySyncPlaceholderToTextConfig() {
|
|
20742
20762
|
if (!this.currRt) return;
|
|
@@ -20771,8 +20791,22 @@ class RichTextEditPlugin {
|
|
|
20771
20791
|
stopPropagation(e) {
|
|
20772
20792
|
e.stopPropagation();
|
|
20773
20793
|
}
|
|
20794
|
+
addEditLineOrBgOrBounds(graphic, shadowRoot) {
|
|
20795
|
+
let group = shadowRoot.getElementById("emptyBoundsContainer");
|
|
20796
|
+
group || (group = createGroup({
|
|
20797
|
+
x: 0,
|
|
20798
|
+
y: 0,
|
|
20799
|
+
width: 0,
|
|
20800
|
+
height: 0,
|
|
20801
|
+
boundsMode: "empty"
|
|
20802
|
+
}), group.id = "emptyBoundsContainer", shadowRoot.add(group)), group.add(graphic);
|
|
20803
|
+
}
|
|
20804
|
+
removeEditLineOrBgOrBounds(graphic, shadowRoot) {
|
|
20805
|
+
const group = shadowRoot.getElementById("emptyBoundsContainer");
|
|
20806
|
+
group && group.removeChild(graphic);
|
|
20807
|
+
}
|
|
20774
20808
|
onFocus(e, data) {
|
|
20775
|
-
this.updateCbs && this.updateCbs.forEach(cb => cb("beforeOnfocus", this)), this.deFocus(!1), this.focusing = !0;
|
|
20809
|
+
this.updateCbs && this.updateCbs.forEach(cb => cb("beforeOnfocus", this)), this.deFocus(!1), this.focusing = !0, this.editing = !0;
|
|
20776
20810
|
const target = e.target;
|
|
20777
20811
|
if (!target || "richtext" !== target.type) return;
|
|
20778
20812
|
this.currRt = target, RichTextEditPlugin.tryUpdateRichtext(target);
|
|
@@ -20796,7 +20830,7 @@ class RichTextEditPlugin {
|
|
|
20796
20830
|
width: 0,
|
|
20797
20831
|
height: 0
|
|
20798
20832
|
});
|
|
20799
|
-
this.editBg = g,
|
|
20833
|
+
this.editBg = g, this.addEditLineOrBgOrBounds(this.editLine, shadowRoot), this.addEditLineOrBgOrBounds(this.editBg, shadowRoot);
|
|
20800
20834
|
}
|
|
20801
20835
|
if (data = data || this.computedCursorPosByEvent(e, cache)) {
|
|
20802
20836
|
const {
|
|
@@ -20861,27 +20895,29 @@ class RichTextEditPlugin {
|
|
|
20861
20895
|
}
|
|
20862
20896
|
deFocus() {
|
|
20863
20897
|
let trulyDeFocus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
20864
|
-
this.updateCbs && this.updateCbs.forEach(cb => cb("beforeDefocus", this, {
|
|
20898
|
+
this.editing = !1, this.updateCbs && this.updateCbs.forEach(cb => cb("beforeDefocus", this, {
|
|
20865
20899
|
trulyDeFocus: trulyDeFocus
|
|
20866
20900
|
}));
|
|
20867
|
-
const
|
|
20868
|
-
if (!
|
|
20901
|
+
const currRt = this.currRt;
|
|
20902
|
+
if (!currRt) return;
|
|
20869
20903
|
const {
|
|
20870
20904
|
editOptions = {}
|
|
20871
|
-
} =
|
|
20872
|
-
editOptions.stopPropagation &&
|
|
20873
|
-
const
|
|
20874
|
-
this.
|
|
20905
|
+
} = currRt.attribute;
|
|
20906
|
+
editOptions.stopPropagation && currRt.removeEventListener("*", this.stopPropagation), trulyDeFocus && (this.trySyncPlaceholderToTextConfig(), currRt.detachShadow()), this.currRt = null;
|
|
20907
|
+
const shadowRoot = this.getShadow(currRt);
|
|
20908
|
+
this.editLine && (this.removeEditLineOrBgOrBounds(this.editLine, shadowRoot), this.editLine.release(), this.editLine = null, this.removeEditLineOrBgOrBounds(this.editBg, shadowRoot), this.editBg.release(), this.editBg = null), trulyDeFocus && (this.shadowBounds && (this.removeEditLineOrBgOrBounds(this.shadowBounds, shadowRoot), this.shadowBounds.release(), this.shadowBounds = null), this.shadowPlaceHolder && (this.shadowPlaceHolder.parent && this.shadowPlaceHolder.parent.removeChild(this.shadowPlaceHolder), this.shadowPlaceHolder.release(), this.shadowPlaceHolder = null)), this.focusing = !1;
|
|
20875
20909
|
const textConfig = currRt.attribute.textConfig;
|
|
20876
20910
|
let lastConfig = textConfig[textConfig.length - 1],
|
|
20877
20911
|
cleared = !1;
|
|
20878
20912
|
for (; lastConfig && "\n" === lastConfig.text;) textConfig.pop(), lastConfig = textConfig[textConfig.length - 1], cleared = !0;
|
|
20879
20913
|
cleared && currRt.setAttributes({
|
|
20880
20914
|
textConfig: textConfig
|
|
20881
|
-
});
|
|
20915
|
+
}), currRt.removeEventListener("pointerleave", this.handleLeave);
|
|
20882
20916
|
}
|
|
20883
20917
|
addAnimateToLine(line) {
|
|
20884
|
-
line.
|
|
20918
|
+
line.setAttributes({
|
|
20919
|
+
opacity: 1
|
|
20920
|
+
}), line.animates && line.animates.forEach(animate => {
|
|
20885
20921
|
animate.stop(), animate.release();
|
|
20886
20922
|
});
|
|
20887
20923
|
line.animate({
|
|
@@ -20990,7 +21026,8 @@ class RichTextEditPlugin {
|
|
|
20990
21026
|
getShadow(rt) {
|
|
20991
21027
|
const sr = rt.shadowRoot || rt.attachShadow();
|
|
20992
21028
|
return sr.setAttributes({
|
|
20993
|
-
|
|
21029
|
+
width: 1,
|
|
21030
|
+
height: 1
|
|
20994
21031
|
}), sr;
|
|
20995
21032
|
}
|
|
20996
21033
|
getLineByPoint(cache, p1) {
|
|
@@ -21024,7 +21061,10 @@ class RichTextEditPlugin {
|
|
|
21024
21061
|
return -1;
|
|
21025
21062
|
}
|
|
21026
21063
|
isRichtext(e) {
|
|
21027
|
-
return !(!e.target || "richtext" !== e.target.type
|
|
21064
|
+
return !(!e.target || "richtext" !== e.target.type);
|
|
21065
|
+
}
|
|
21066
|
+
isEditableRichtext(e) {
|
|
21067
|
+
return this.isRichtext(e) && !!e.target.attribute.editable;
|
|
21028
21068
|
}
|
|
21029
21069
|
triggerRender() {
|
|
21030
21070
|
this.pluginService.stage.renderNextFrame();
|
|
@@ -21170,7 +21210,7 @@ class RichTextEditPlugin {
|
|
|
21170
21210
|
target && (this.currRt = target, e ? this._forceFocusByEvent(e) : this._forceFocusByCursorIndex(null != cursorIndex ? cursorIndex : -.1));
|
|
21171
21211
|
}
|
|
21172
21212
|
_forceFocusByEvent(e) {
|
|
21173
|
-
this.handleEnter(
|
|
21213
|
+
this.handleEnter(), this.handlePointerDown(e), this.handlePointerUp(e);
|
|
21174
21214
|
}
|
|
21175
21215
|
_forceFocusByCursorIndex(cursorIndex) {
|
|
21176
21216
|
const richtext = this.currRt;
|
|
@@ -27491,13 +27531,15 @@ let NodeWindowHandlerContribution = class extends BaseWindowHandlerContribution
|
|
|
27491
27531
|
this.canvas = new NodeCanvas(options);
|
|
27492
27532
|
}
|
|
27493
27533
|
createWindowByCanvas(params) {
|
|
27494
|
-
|
|
27534
|
+
var _a;
|
|
27535
|
+
const canvas = params.canvas,
|
|
27536
|
+
dpr = null !== (_a = params.dpr) && void 0 !== _a ? _a : 1;
|
|
27495
27537
|
let width = params.width,
|
|
27496
27538
|
height = params.height;
|
|
27497
|
-
null != width && null != height && params.canvasControled || (width = canvas.width, height = canvas.height), this.canvas = new NodeCanvas({
|
|
27539
|
+
null != width && null != height && params.canvasControled || (width = canvas.width / dpr, height = canvas.height / dpr), this.canvas = new NodeCanvas({
|
|
27498
27540
|
width: width,
|
|
27499
27541
|
height: height,
|
|
27500
|
-
dpr:
|
|
27542
|
+
dpr: dpr,
|
|
27501
27543
|
nativeCanvas: canvas,
|
|
27502
27544
|
canvasControled: params.canvasControled
|
|
27503
27545
|
});
|
|
@@ -31237,7 +31279,7 @@ const registerWrapText = _registerWrapText;
|
|
|
31237
31279
|
|
|
31238
31280
|
const roughModule = _roughModule;
|
|
31239
31281
|
|
|
31240
|
-
const version = "0.22.0-vstory.
|
|
31282
|
+
const version = "0.22.0-vstory.16";
|
|
31241
31283
|
preLoadAllModule();
|
|
31242
31284
|
if (isBrowserEnv()) {
|
|
31243
31285
|
loadBrowserEnv(container);
|