@visactor/vrender 0.22.0-vstory.2 → 0.22.0-vstory.3
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 +37 -8
- package/dist/index.js +37 -8
- 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 +5 -5
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.3", (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,iBAAiB,CAAC;AAEzC,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,iBAAiB,CAAC;AAEzC,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.3\";\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
|
@@ -13915,7 +13915,8 @@ class Paragraph {
|
|
|
13915
13915
|
} = measureTextCanvas(this.text, this.character);
|
|
13916
13916
|
this.width = width, "vertical" === this.direction && (this.widthOrigin = this.width, this.width = this.heightOrigin, this.height = this.widthOrigin);
|
|
13917
13917
|
}
|
|
13918
|
-
|
|
13918
|
+
drawBackground(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
13919
|
+
if (!this.character.background || this.character.backgroundOpacity && !(this.character.backgroundOpacity > 0)) return;
|
|
13919
13920
|
let baseline = top + ascent,
|
|
13920
13921
|
text = this.text,
|
|
13921
13922
|
left = this.left + deltaLeft;
|
|
@@ -13940,13 +13941,39 @@ class Paragraph {
|
|
|
13940
13941
|
case "sub":
|
|
13941
13942
|
baseline += this.descent / 2;
|
|
13942
13943
|
}
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13944
|
+
"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);
|
|
13945
|
+
const fillStyle = ctx.fillStyle,
|
|
13946
|
+
globalAlpha = ctx.globalAlpha;
|
|
13947
|
+
ctx.fillStyle = this.character.background, void 0 !== this.character.backgroundOpacity && (ctx.globalAlpha = this.character.backgroundOpacity);
|
|
13948
|
+
const lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + lineHeight);
|
|
13949
|
+
ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top), ctx.fillStyle = fillStyle, ctx.globalAlpha = globalAlpha;
|
|
13950
|
+
}
|
|
13951
|
+
draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
13952
|
+
let baseline = top + ascent,
|
|
13953
|
+
text = this.text,
|
|
13954
|
+
left = this.left + deltaLeft;
|
|
13955
|
+
baseline += this.top;
|
|
13956
|
+
let direction = this.direction;
|
|
13957
|
+
if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
|
|
13958
|
+
if ("hide" === this.ellipsis) return;
|
|
13959
|
+
if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
|
|
13960
|
+
const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
|
|
13961
|
+
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
|
|
13962
|
+
const {
|
|
13963
|
+
width: width
|
|
13964
|
+
} = measureTextCanvas(this.text.slice(index), this.character);
|
|
13965
|
+
"vertical" === direction || (left -= this.ellipsisWidth - width);
|
|
13966
|
+
}
|
|
13967
|
+
}
|
|
13968
|
+
}
|
|
13969
|
+
switch (this.character.script) {
|
|
13970
|
+
case "super":
|
|
13971
|
+
baseline -= this.ascent * (1 / 3);
|
|
13972
|
+
break;
|
|
13973
|
+
case "sub":
|
|
13974
|
+
baseline += this.descent / 2;
|
|
13949
13975
|
}
|
|
13976
|
+
"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);
|
|
13950
13977
|
const {
|
|
13951
13978
|
lineWidth = 1
|
|
13952
13979
|
} = this.character;
|
|
@@ -14194,6 +14221,8 @@ class Line {
|
|
|
14194
14221
|
}
|
|
14195
14222
|
}
|
|
14196
14223
|
this.paragraphs.forEach((paragraph, index) => {
|
|
14224
|
+
paragraph instanceof RichTextIcon || paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height);
|
|
14225
|
+
}), this.paragraphs.forEach((paragraph, index) => {
|
|
14197
14226
|
if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
|
|
14198
14227
|
x: x + paragraph._x,
|
|
14199
14228
|
y: y + paragraph._y
|
|
@@ -30430,7 +30459,7 @@ const registerWrapText = _registerWrapText;
|
|
|
30430
30459
|
|
|
30431
30460
|
const roughModule = _roughModule;
|
|
30432
30461
|
|
|
30433
|
-
const version = "0.22.0-vstory.
|
|
30462
|
+
const version = "0.22.0-vstory.3";
|
|
30434
30463
|
preLoadAllModule();
|
|
30435
30464
|
if (isBrowserEnv()) {
|
|
30436
30465
|
loadBrowserEnv(container);
|
package/dist/index.js
CHANGED
|
@@ -13921,7 +13921,8 @@
|
|
|
13921
13921
|
} = measureTextCanvas(this.text, this.character);
|
|
13922
13922
|
this.width = width, "vertical" === this.direction && (this.widthOrigin = this.width, this.width = this.heightOrigin, this.height = this.widthOrigin);
|
|
13923
13923
|
}
|
|
13924
|
-
|
|
13924
|
+
drawBackground(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
13925
|
+
if (!this.character.background || this.character.backgroundOpacity && !(this.character.backgroundOpacity > 0)) return;
|
|
13925
13926
|
let baseline = top + ascent,
|
|
13926
13927
|
text = this.text,
|
|
13927
13928
|
left = this.left + deltaLeft;
|
|
@@ -13946,13 +13947,39 @@
|
|
|
13946
13947
|
case "sub":
|
|
13947
13948
|
baseline += this.descent / 2;
|
|
13948
13949
|
}
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
13950
|
+
"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);
|
|
13951
|
+
const fillStyle = ctx.fillStyle,
|
|
13952
|
+
globalAlpha = ctx.globalAlpha;
|
|
13953
|
+
ctx.fillStyle = this.character.background, void 0 !== this.character.backgroundOpacity && (ctx.globalAlpha = this.character.backgroundOpacity);
|
|
13954
|
+
const lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + lineHeight);
|
|
13955
|
+
ctx.fillRect(lrtb.left, lrtb.top, lrtb.right - lrtb.left, lrtb.bottom - lrtb.top), ctx.fillStyle = fillStyle, ctx.globalAlpha = globalAlpha;
|
|
13956
|
+
}
|
|
13957
|
+
draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
13958
|
+
let baseline = top + ascent,
|
|
13959
|
+
text = this.text,
|
|
13960
|
+
left = this.left + deltaLeft;
|
|
13961
|
+
baseline += this.top;
|
|
13962
|
+
let direction = this.direction;
|
|
13963
|
+
if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
|
|
13964
|
+
if ("hide" === this.ellipsis) return;
|
|
13965
|
+
if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
|
|
13966
|
+
const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
|
|
13967
|
+
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
|
|
13968
|
+
const {
|
|
13969
|
+
width: width
|
|
13970
|
+
} = measureTextCanvas(this.text.slice(index), this.character);
|
|
13971
|
+
"vertical" === direction || (left -= this.ellipsisWidth - width);
|
|
13972
|
+
}
|
|
13973
|
+
}
|
|
13974
|
+
}
|
|
13975
|
+
switch (this.character.script) {
|
|
13976
|
+
case "super":
|
|
13977
|
+
baseline -= this.ascent * (1 / 3);
|
|
13978
|
+
break;
|
|
13979
|
+
case "sub":
|
|
13980
|
+
baseline += this.descent / 2;
|
|
13955
13981
|
}
|
|
13982
|
+
"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);
|
|
13956
13983
|
const {
|
|
13957
13984
|
lineWidth = 1
|
|
13958
13985
|
} = this.character;
|
|
@@ -14200,6 +14227,8 @@
|
|
|
14200
14227
|
}
|
|
14201
14228
|
}
|
|
14202
14229
|
this.paragraphs.forEach((paragraph, index) => {
|
|
14230
|
+
paragraph instanceof RichTextIcon || paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height);
|
|
14231
|
+
}), this.paragraphs.forEach((paragraph, index) => {
|
|
14203
14232
|
if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
|
|
14204
14233
|
x: x + paragraph._x,
|
|
14205
14234
|
y: y + paragraph._y
|
|
@@ -30436,7 +30465,7 @@
|
|
|
30436
30465
|
|
|
30437
30466
|
const roughModule = _roughModule;
|
|
30438
30467
|
|
|
30439
|
-
const version = "0.22.0-vstory.
|
|
30468
|
+
const version = "0.22.0-vstory.3";
|
|
30440
30469
|
preLoadAllModule();
|
|
30441
30470
|
if (isBrowserEnv()) {
|
|
30442
30471
|
loadBrowserEnv(container);
|