@visactor/vrender 0.22.0-vstory.6 → 0.22.0-vstory.7
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 +102 -90
- package/dist/index.js +102 -90
- 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.7", (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.7\";\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
|
@@ -10912,7 +10912,7 @@ class Group extends Graphic {
|
|
|
10912
10912
|
application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
10913
10913
|
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
10914
10914
|
bounds = this.doUpdateAABBBounds();
|
|
10915
|
-
return this.addUpdateLayoutTag(), application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), bounds;
|
|
10915
|
+
return this.addUpdateLayoutTag(), application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
10916
10916
|
}
|
|
10917
10917
|
doUpdateLocalMatrix() {
|
|
10918
10918
|
const {
|
|
@@ -13882,15 +13882,11 @@ class Frame {
|
|
|
13882
13882
|
}
|
|
13883
13883
|
|
|
13884
13884
|
function getFixedLRTB(left, right, top, bottom) {
|
|
13885
|
-
const leftInt = Math.round(left),
|
|
13886
|
-
topInt = Math.round(top),
|
|
13887
|
-
rightInt = Math.round(right),
|
|
13888
|
-
bottomInt = Math.round(bottom);
|
|
13889
13885
|
return {
|
|
13890
|
-
left: left
|
|
13891
|
-
top: top
|
|
13892
|
-
right:
|
|
13893
|
-
bottom:
|
|
13886
|
+
left: Math.round(left),
|
|
13887
|
+
top: Math.round(top),
|
|
13888
|
+
right: Math.round(right),
|
|
13889
|
+
bottom: Math.round(bottom)
|
|
13894
13890
|
};
|
|
13895
13891
|
}
|
|
13896
13892
|
class Paragraph {
|
|
@@ -14384,7 +14380,13 @@ class RichText extends Graphic {
|
|
|
14384
14380
|
}
|
|
14385
14381
|
return cache.every(item => item.isComposing || !(item.text && isString$1(item.text) && RichText.splitText(item.text).length > 1));
|
|
14386
14382
|
}
|
|
14383
|
+
static splitEmoji(text) {
|
|
14384
|
+
return [...new Intl.Segmenter().segment(text)].map(x => x.segment);
|
|
14385
|
+
}
|
|
14387
14386
|
static splitText(text) {
|
|
14387
|
+
try {
|
|
14388
|
+
return this.splitEmoji(text);
|
|
14389
|
+
} catch (e) {}
|
|
14388
14390
|
return Array.from(text);
|
|
14389
14391
|
}
|
|
14390
14392
|
static TransformTextConfig2SingleCharacter(textConfig) {
|
|
@@ -18430,7 +18432,7 @@ let DefaultDrawContribution = class {
|
|
|
18430
18432
|
renderGroup(group, drawContext, parentMatrix, skipSort) {
|
|
18431
18433
|
if (drawContext.break || !1 === group.attribute.visibleAll) return;
|
|
18432
18434
|
if (group.incremental && (null == drawContext.startAtId || drawContext.startAtId === group._uid)) return drawContext.break = !0, void this._increaseRender(group, drawContext);
|
|
18433
|
-
if (this.useDirtyBounds && !isRectIntersect(group.AABBBounds, this.dirtyBounds, !1)) return;
|
|
18435
|
+
if (this.useDirtyBounds && !isRectIntersect(group.AABBBounds, this.dirtyBounds, !1) && "empty" !== group.attribute.boundsMode) return;
|
|
18434
18436
|
let tempBounds,
|
|
18435
18437
|
nextM = parentMatrix;
|
|
18436
18438
|
if (this.useDirtyBounds) {
|
|
@@ -20425,9 +20427,9 @@ class EditModule {
|
|
|
20425
20427
|
textConfig.splice(configIdx, 1);
|
|
20426
20428
|
const text = lastConfig.text,
|
|
20427
20429
|
textList = text ? Array.from(text.toString()) : [];
|
|
20428
|
-
for (let i = 0; i < textList.length; i++) textConfig.splice(i + configIdx, 0, Object.assign(Object.assign({
|
|
20430
|
+
for (let i = 0; i < textList.length; i++) textConfig.splice(i + configIdx, 0, Object.assign(Object.assign(Object.assign(Object.assign({}, getDefaultCharacterConfig(this.currRt.attribute)), {
|
|
20429
20431
|
fill: "black"
|
|
20430
|
-
}, lastConfig), {
|
|
20432
|
+
}), lastConfig), {
|
|
20431
20433
|
isComposing: !1,
|
|
20432
20434
|
text: textList[i]
|
|
20433
20435
|
}));
|
|
@@ -20627,9 +20629,11 @@ class RichTextEditPlugin {
|
|
|
20627
20629
|
const cache = currRt.getFrameCache();
|
|
20628
20630
|
if (!cache) return;
|
|
20629
20631
|
const {
|
|
20630
|
-
|
|
20631
|
-
|
|
20632
|
-
|
|
20632
|
+
lines: lines
|
|
20633
|
+
} = cache;
|
|
20634
|
+
if (0 === lines.length) return;
|
|
20635
|
+
if (!lines[0].paragraphs || 0 === lines[0].paragraphs.length) return;
|
|
20636
|
+
const totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;
|
|
20633
20637
|
return this.selectionRange(-.1, totalCursorCount + .1), e.preventDefault(), !0;
|
|
20634
20638
|
}
|
|
20635
20639
|
return !1;
|
|
@@ -20697,18 +20701,19 @@ class RichTextEditPlugin {
|
|
|
20697
20701
|
placeholderFontFamily: placeholderFontFamily,
|
|
20698
20702
|
placeholderFontSize: placeholderFontSize
|
|
20699
20703
|
} = editOptions,
|
|
20700
|
-
shadow = this.
|
|
20701
|
-
|
|
20704
|
+
shadow = this.getShadow(this.currRt),
|
|
20705
|
+
textConfigItem = Object.assign(Object.assign({}, getDefaultCharacterConfig(this.currRt.attribute)), {
|
|
20706
|
+
text: placeholder
|
|
20707
|
+
});
|
|
20708
|
+
placeholderColor && (textConfigItem.fill = placeholderColor), placeholderFontFamily && (textConfigItem.fontFamily = placeholderFontFamily), placeholderFontSize && (textConfigItem.fontSize = placeholderFontSize), this.shadowPlaceHolder = createRichText(Object.assign(Object.assign({}, this.currRt.attribute), {
|
|
20702
20709
|
x: 0,
|
|
20703
20710
|
y: 0,
|
|
20711
|
+
pickable: !1,
|
|
20712
|
+
editable: !1,
|
|
20713
|
+
editOptions: null,
|
|
20704
20714
|
angle: 0,
|
|
20705
20715
|
_debug_bounds: !1,
|
|
20706
|
-
textConfig: [
|
|
20707
|
-
text: placeholder,
|
|
20708
|
-
fill: placeholderColor,
|
|
20709
|
-
fontFamily: placeholderFontFamily,
|
|
20710
|
-
fontSize: placeholderFontSize
|
|
20711
|
-
}]
|
|
20716
|
+
textConfig: [textConfigItem]
|
|
20712
20717
|
})), shadow.add(this.shadowPlaceHolder);
|
|
20713
20718
|
}
|
|
20714
20719
|
tryShowInputBounds() {
|
|
@@ -20721,15 +20726,15 @@ class RichTextEditPlugin {
|
|
|
20721
20726
|
} = editOptions;
|
|
20722
20727
|
if (!editOptions || !boundsStrokeWhenInput) return;
|
|
20723
20728
|
const {
|
|
20724
|
-
|
|
20725
|
-
|
|
20726
|
-
|
|
20727
|
-
|
|
20729
|
+
attribute: attribute
|
|
20730
|
+
} = this.currRt;
|
|
20731
|
+
let b = this.currRt.AABBBounds,
|
|
20732
|
+
h = b.height();
|
|
20728
20733
|
if (!attribute.textConfig.length && this.editLine) {
|
|
20729
20734
|
const {
|
|
20730
20735
|
points: points
|
|
20731
20736
|
} = this.editLine.attribute;
|
|
20732
|
-
h = points[1].y - points[0].y;
|
|
20737
|
+
h = points[1].y - points[0].y, b = getRichTextBounds(Object.assign({}, this.shadowPlaceHolder.attribute));
|
|
20733
20738
|
}
|
|
20734
20739
|
this.shadowBounds = this.shadowBounds || createRect({}), this.shadowBounds.setAttributes({
|
|
20735
20740
|
x: 0,
|
|
@@ -20739,10 +20744,9 @@ class RichTextEditPlugin {
|
|
|
20739
20744
|
fill: !1,
|
|
20740
20745
|
stroke: boundsStrokeWhenInput,
|
|
20741
20746
|
lineWidth: 1,
|
|
20742
|
-
boundsMode: "empty",
|
|
20743
20747
|
zIndex: -1
|
|
20744
20748
|
});
|
|
20745
|
-
|
|
20749
|
+
this.getShadow(this.currRt).add(this.shadowBounds), this.offsetLineBgAndShadowBounds();
|
|
20746
20750
|
}
|
|
20747
20751
|
trySyncPlaceholderToTextConfig() {
|
|
20748
20752
|
if (!this.currRt) return;
|
|
@@ -20751,7 +20755,7 @@ class RichTextEditPlugin {
|
|
|
20751
20755
|
editOptions: editOptions
|
|
20752
20756
|
} = this.currRt.attribute;
|
|
20753
20757
|
if (textConfig && textConfig.length) return;
|
|
20754
|
-
if (!editOptions
|
|
20758
|
+
if (!(editOptions && editOptions.placeholder && editOptions.syncPlaceHolderToTextConfig)) return;
|
|
20755
20759
|
const {
|
|
20756
20760
|
placeholder: placeholder
|
|
20757
20761
|
} = editOptions;
|
|
@@ -20765,11 +20769,11 @@ class RichTextEditPlugin {
|
|
|
20765
20769
|
context.stage.off("pointermove", this.handleMove), context.stage.off("pointerdown", this.handlePointerDown), context.stage.off("pointerup", this.handlePointerUp), context.stage.off("pointerleave", this.handlePointerUp), context.stage.off("dblclick", this.handleDBLClick), application.global.addEventListener("keydown", this.handleKeyDown);
|
|
20766
20770
|
}
|
|
20767
20771
|
onFocus(e, data) {
|
|
20768
|
-
this.deFocus(!1), this.focusing = !0;
|
|
20772
|
+
this.updateCbs && this.updateCbs.forEach(cb => cb("beforeOnfocus", this)), this.deFocus(!1), this.focusing = !0;
|
|
20769
20773
|
const target = e.target;
|
|
20770
20774
|
if (!target || "richtext" !== target.type) return;
|
|
20771
20775
|
this.currRt = target, RichTextEditPlugin.tryUpdateRichtext(target);
|
|
20772
|
-
const shadowRoot =
|
|
20776
|
+
const shadowRoot = this.getShadow(target),
|
|
20773
20777
|
cache = target.getFrameCache();
|
|
20774
20778
|
if (cache) {
|
|
20775
20779
|
if (this.computeGlobalDelta(cache), shadowRoot.setAttributes({
|
|
@@ -20782,16 +20786,14 @@ class RichTextEditPlugin {
|
|
|
20782
20786
|
x: 0,
|
|
20783
20787
|
y: 0,
|
|
20784
20788
|
lineWidth: 1,
|
|
20785
|
-
stroke: "black"
|
|
20786
|
-
boundsMode: "empty"
|
|
20789
|
+
stroke: "black"
|
|
20787
20790
|
});
|
|
20788
20791
|
this.addAnimateToLine(line), this.editLine = line, this.ticker.start(!0);
|
|
20789
20792
|
const g = createGroup({
|
|
20790
20793
|
x: 0,
|
|
20791
20794
|
y: 0,
|
|
20792
20795
|
width: 0,
|
|
20793
|
-
height: 0
|
|
20794
|
-
boundsMode: "empty"
|
|
20796
|
+
height: 0
|
|
20795
20797
|
});
|
|
20796
20798
|
this.editBg = g, shadowRoot.add(this.editLine), shadowRoot.add(this.editBg);
|
|
20797
20799
|
}
|
|
@@ -20846,7 +20848,9 @@ class RichTextEditPlugin {
|
|
|
20846
20848
|
let trulyDeFocus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
20847
20849
|
const target = this.currRt;
|
|
20848
20850
|
if (!target) return;
|
|
20849
|
-
|
|
20851
|
+
this.updateCbs && this.updateCbs.forEach(cb => cb("beforeDefocus", this, {
|
|
20852
|
+
trulyDeFocus: trulyDeFocus
|
|
20853
|
+
})), trulyDeFocus && (this.trySyncPlaceholderToTextConfig(), target.detachShadow());
|
|
20850
20854
|
const currRt = this.currRt;
|
|
20851
20855
|
this.currRt = null, this.editLine && (this.editLine.parent && this.editLine.parent.removeChild(this.editLine), this.editLine.release(), this.editLine = null, this.editBg.parent && this.editBg.parent.removeChild(this.editBg), this.editBg.release(), this.editBg = null), trulyDeFocus && (this.shadowBounds && (this.shadowBounds.parent && this.shadowBounds.parent.removeChild(this.shadowBounds), 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;
|
|
20852
20856
|
const textConfig = currRt.attribute.textConfig;
|
|
@@ -20903,67 +20907,75 @@ class RichTextEditPlugin {
|
|
|
20903
20907
|
},
|
|
20904
20908
|
line0Info = this.getLineByPoint(cache, startCursorPos),
|
|
20905
20909
|
line1Info = this.getLineByPoint(cache, endCursorPos);
|
|
20906
|
-
if (
|
|
20907
|
-
|
|
20908
|
-
|
|
20909
|
-
width: endCursorPos.x - startCursorPos.x,
|
|
20910
|
-
height: line0Info.height,
|
|
20911
|
-
fill: "#336df4",
|
|
20912
|
-
fillOpacity: .2
|
|
20913
|
-
});else {
|
|
20914
|
-
this.editBg.setAttributes({
|
|
20915
|
-
x: 0,
|
|
20910
|
+
if (line0Info && line1Info) {
|
|
20911
|
+
if ((startCursorPos.y > endCursorPos.y || startCursorPos.y === endCursorPos.y && startCursorPos.x > endCursorPos.x) && ([startCursorPos, endCursorPos] = [endCursorPos, startCursorPos], [line1Info, line0Info] = [line0Info, line1Info]), this.hideSelection(), line0Info === line1Info) this.editBg.setAttributes({
|
|
20912
|
+
x: startCursorPos.x,
|
|
20916
20913
|
y: line0Info.top,
|
|
20917
|
-
width:
|
|
20918
|
-
height:
|
|
20919
|
-
|
|
20920
|
-
|
|
20921
|
-
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20926
|
-
|
|
20927
|
-
|
|
20928
|
-
|
|
20929
|
-
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
|
|
20944
|
-
|
|
20945
|
-
|
|
20946
|
-
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
|
|
20914
|
+
width: endCursorPos.x - startCursorPos.x,
|
|
20915
|
+
height: line0Info.height,
|
|
20916
|
+
fill: "#336df4",
|
|
20917
|
+
fillOpacity: .2
|
|
20918
|
+
});else {
|
|
20919
|
+
this.editBg.setAttributes({
|
|
20920
|
+
x: 0,
|
|
20921
|
+
y: line0Info.top,
|
|
20922
|
+
width: 0,
|
|
20923
|
+
height: 0
|
|
20924
|
+
});
|
|
20925
|
+
const startIdx = cache.lines.findIndex(item => item === line0Info),
|
|
20926
|
+
endIdx = cache.lines.findIndex(item => item === line1Info);
|
|
20927
|
+
let y = 0;
|
|
20928
|
+
for (let i = startIdx; i <= endIdx; i++) {
|
|
20929
|
+
const line = cache.lines[i];
|
|
20930
|
+
if (i === startIdx) {
|
|
20931
|
+
const p = line.paragraphs[line.paragraphs.length - 1];
|
|
20932
|
+
this.editBg.add(createRect({
|
|
20933
|
+
x: startCursorPos.x,
|
|
20934
|
+
y: y,
|
|
20935
|
+
width: p.left + p.width - startCursorPos.x,
|
|
20936
|
+
height: line.height,
|
|
20937
|
+
fill: "#336df4",
|
|
20938
|
+
fillOpacity: .2
|
|
20939
|
+
}));
|
|
20940
|
+
} else if (i === endIdx) {
|
|
20941
|
+
const p = line.paragraphs[0];
|
|
20942
|
+
this.editBg.add(createRect({
|
|
20943
|
+
x: p.left,
|
|
20944
|
+
y: y,
|
|
20945
|
+
width: endCursorPos.x - p.left,
|
|
20946
|
+
height: line.height,
|
|
20947
|
+
fill: "#336df4",
|
|
20948
|
+
fillOpacity: .2
|
|
20949
|
+
}));
|
|
20950
|
+
} else {
|
|
20951
|
+
const p0 = line.paragraphs[0],
|
|
20952
|
+
p1 = line.paragraphs[line.paragraphs.length - 1];
|
|
20953
|
+
this.editBg.add(createRect({
|
|
20954
|
+
x: p0.left,
|
|
20955
|
+
y: y,
|
|
20956
|
+
width: p1.left + p1.width - p0.left,
|
|
20957
|
+
height: line.height,
|
|
20958
|
+
fill: "#336df4",
|
|
20959
|
+
fillOpacity: .2
|
|
20960
|
+
}));
|
|
20961
|
+
}
|
|
20962
|
+
y += line.height;
|
|
20956
20963
|
}
|
|
20957
|
-
y += line.height;
|
|
20958
20964
|
}
|
|
20965
|
+
this.setCursorAndTextArea(currCursorData.x, currCursorData.y1, currCursorData.y2, this.currRt), this.triggerRender(), this.updateCbs.forEach(cb => cb("selection", this));
|
|
20959
20966
|
}
|
|
20960
|
-
this.setCursorAndTextArea(currCursorData.x, currCursorData.y1, currCursorData.y2, this.currRt), this.triggerRender(), this.updateCbs.forEach(cb => cb("selection", this));
|
|
20961
20967
|
}
|
|
20962
20968
|
hideSelection() {
|
|
20963
20969
|
this.editBg && (this.editBg.removeAllChild(), this.editBg.setAttributes({
|
|
20964
20970
|
fill: "transparent"
|
|
20965
20971
|
}));
|
|
20966
20972
|
}
|
|
20973
|
+
getShadow(rt) {
|
|
20974
|
+
const sr = rt.shadowRoot || rt.attachShadow();
|
|
20975
|
+
return sr.setAttributes({
|
|
20976
|
+
boundsMode: "empty"
|
|
20977
|
+
}), sr;
|
|
20978
|
+
}
|
|
20967
20979
|
getLineByPoint(cache, p1) {
|
|
20968
20980
|
let lineInfo = cache.lines[0];
|
|
20969
20981
|
for (let i = 0; i < cache.lines.length && !(lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y); i++) lineInfo = cache.lines[i + 1];
|
|
@@ -30459,7 +30471,7 @@ const registerWrapText = _registerWrapText;
|
|
|
30459
30471
|
|
|
30460
30472
|
const roughModule = _roughModule;
|
|
30461
30473
|
|
|
30462
|
-
const version = "0.22.0-vstory.
|
|
30474
|
+
const version = "0.22.0-vstory.7";
|
|
30463
30475
|
preLoadAllModule();
|
|
30464
30476
|
if (isBrowserEnv()) {
|
|
30465
30477
|
loadBrowserEnv(container);
|