@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/dist/index.js
CHANGED
|
@@ -3924,10 +3924,10 @@
|
|
|
3924
3924
|
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);
|
|
3925
3925
|
break;
|
|
3926
3926
|
case "s":
|
|
3927
|
-
tempX = x + current[3], tempY = y + current[4], controlX = 2 * x - controlX, controlY = 2 * y - controlY, this.bezierCurveTo(controlX + l, controlY + t,
|
|
3927
|
+
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;
|
|
3928
3928
|
break;
|
|
3929
3929
|
case "S":
|
|
3930
|
-
tempX = current[3], tempY = current[4], controlX = 2 * x - controlX, controlY = 2 * y - controlY, this.bezierCurveTo(controlX + l, controlY + t,
|
|
3930
|
+
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;
|
|
3931
3931
|
break;
|
|
3932
3932
|
case "q":
|
|
3933
3933
|
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;
|
|
@@ -4318,6 +4318,7 @@
|
|
|
4318
4318
|
keepDirIn3d: !0
|
|
4319
4319
|
});
|
|
4320
4320
|
const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), {
|
|
4321
|
+
upgradeAttrs: null,
|
|
4321
4322
|
editable: !1,
|
|
4322
4323
|
editOptions: null,
|
|
4323
4324
|
ascentDescentMode: "actual",
|
|
@@ -10154,7 +10155,7 @@
|
|
|
10154
10155
|
null != onStart && animate.onStart(onStart), null != onFrame && animate.onFrame(onFrame), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove), animate.interpolateFunc = params.interpolate;
|
|
10155
10156
|
}
|
|
10156
10157
|
return this.animates.set(animate.id, animate), animate.onRemove(() => {
|
|
10157
|
-
this.animates.delete(animate.id);
|
|
10158
|
+
animate.stop(), this.animates.delete(animate.id);
|
|
10158
10159
|
}), animate;
|
|
10159
10160
|
}
|
|
10160
10161
|
onAttributeUpdate(context) {
|
|
@@ -10358,7 +10359,7 @@
|
|
|
10358
10359
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
10359
10360
|
const timeline = stage.getTimeline();
|
|
10360
10361
|
this.animates.forEach(a => {
|
|
10361
|
-
a.setTimeline(timeline);
|
|
10362
|
+
a.timeline === defaultTimeline && a.setTimeline(timeline);
|
|
10362
10363
|
});
|
|
10363
10364
|
}
|
|
10364
10365
|
this._onSetStage && this._onSetStage(this, stage, layer), application.graphicService.onSetStage(this, stage);
|
|
@@ -10462,7 +10463,7 @@
|
|
|
10462
10463
|
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;
|
|
10463
10464
|
}
|
|
10464
10465
|
detachShadow() {
|
|
10465
|
-
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot = null);
|
|
10466
|
+
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot.release(!0), this.shadowRoot = null);
|
|
10466
10467
|
}
|
|
10467
10468
|
toJson() {
|
|
10468
10469
|
return {
|
|
@@ -10514,7 +10515,7 @@
|
|
|
10514
10515
|
});
|
|
10515
10516
|
}
|
|
10516
10517
|
release() {
|
|
10517
|
-
this.releaseStatus = "released", application.graphicService.onRelease(this);
|
|
10518
|
+
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
|
|
10518
10519
|
}
|
|
10519
10520
|
_emitCustomEvent(type, context) {
|
|
10520
10521
|
var _a, _b;
|
|
@@ -11090,6 +11091,11 @@
|
|
|
11090
11091
|
getNoWorkAnimateAttr() {
|
|
11091
11092
|
return Group.NOWORK_ANIMATE_ATTR;
|
|
11092
11093
|
}
|
|
11094
|
+
release(all) {
|
|
11095
|
+
all && this.forEachChildren(g => {
|
|
11096
|
+
g.release(all);
|
|
11097
|
+
}), super.release();
|
|
11098
|
+
}
|
|
11093
11099
|
}
|
|
11094
11100
|
Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
|
|
11095
11101
|
function createGroup(attributes) {
|
|
@@ -13957,7 +13963,7 @@
|
|
|
13957
13963
|
this.width = width, "vertical" === this.direction && (this.widthOrigin = this.width, this.width = this.heightOrigin, this.height = this.widthOrigin);
|
|
13958
13964
|
}
|
|
13959
13965
|
drawBackground(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
13960
|
-
if (!this.character.background || this.character.backgroundOpacity && !(this.character.backgroundOpacity > 0)) return;
|
|
13966
|
+
if ("" === this.text || "\n" === this.text || !this.character.background || this.character.backgroundOpacity && !(this.character.backgroundOpacity > 0)) return;
|
|
13961
13967
|
let baseline = top + ascent,
|
|
13962
13968
|
text = this.text,
|
|
13963
13969
|
left = this.left + deltaLeft;
|
|
@@ -13975,19 +13981,11 @@
|
|
|
13975
13981
|
}
|
|
13976
13982
|
}
|
|
13977
13983
|
}
|
|
13978
|
-
switch (this.character.script) {
|
|
13979
|
-
case "super":
|
|
13980
|
-
baseline -= this.ascent * (1 / 3);
|
|
13981
|
-
break;
|
|
13982
|
-
case "sub":
|
|
13983
|
-
baseline += this.descent / 2;
|
|
13984
|
-
}
|
|
13985
|
-
"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);
|
|
13986
|
-
const fillStyle = ctx.fillStyle,
|
|
13987
|
-
globalAlpha = ctx.globalAlpha;
|
|
13988
|
-
ctx.fillStyle = this.character.background, void 0 !== this.character.backgroundOpacity && (ctx.globalAlpha = this.character.backgroundOpacity);
|
|
13989
13984
|
const lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + lineHeight);
|
|
13990
|
-
|
|
13985
|
+
return Object.assign(Object.assign({}, lrtb), {
|
|
13986
|
+
fillStyle: this.character.background,
|
|
13987
|
+
globalAlpha: this.character.backgroundOpacity
|
|
13988
|
+
});
|
|
13991
13989
|
}
|
|
13992
13990
|
draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
13993
13991
|
let baseline = top + ascent,
|
|
@@ -14261,8 +14259,19 @@
|
|
|
14261
14259
|
paragraph.ellipsis = "hide", otherParagraphWidth += paragraph.width;
|
|
14262
14260
|
}
|
|
14263
14261
|
}
|
|
14262
|
+
let fillStyle = "",
|
|
14263
|
+
globalAlpha = -1,
|
|
14264
|
+
currBgList = [];
|
|
14265
|
+
const bgList = [currBgList];
|
|
14264
14266
|
this.paragraphs.forEach((paragraph, index) => {
|
|
14265
|
-
paragraph instanceof RichTextIcon
|
|
14267
|
+
if (paragraph instanceof RichTextIcon) return;
|
|
14268
|
+
const data = paragraph.drawBackground(ctx, y, this.ascent, x, 0 === index, this.textAlign, this.height);
|
|
14269
|
+
data && (fillStyle === data.fillStyle && globalAlpha === data.globalAlpha || (currBgList = [], bgList.push(currBgList), fillStyle = data.fillStyle, globalAlpha = data.globalAlpha), currBgList.push(data));
|
|
14270
|
+
}), bgList.forEach(bg => {
|
|
14271
|
+
if (0 === bg.length) return;
|
|
14272
|
+
const data = bg[0],
|
|
14273
|
+
end = bg[bg.length - 1];
|
|
14274
|
+
ctx.fillStyle = data.fillStyle, ctx.globalAlpha = data.globalAlpha, ctx.fillRect(data.left, data.top, end.right - data.left, end.bottom - data.top);
|
|
14266
14275
|
}), this.paragraphs.forEach((paragraph, index) => {
|
|
14267
14276
|
if (paragraph instanceof RichTextIcon) return paragraph.setAttributes({
|
|
14268
14277
|
x: x + paragraph._x,
|
|
@@ -14528,48 +14537,53 @@
|
|
|
14528
14537
|
}
|
|
14529
14538
|
combinedStyleToCharacter(config) {
|
|
14530
14539
|
const {
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14540
|
+
fill: fill,
|
|
14541
|
+
stroke: stroke,
|
|
14542
|
+
fontSize: fontSize,
|
|
14543
|
+
fontFamily: fontFamily,
|
|
14544
|
+
fontStyle: fontStyle,
|
|
14545
|
+
fontWeight: fontWeight,
|
|
14546
|
+
lineWidth: lineWidth,
|
|
14547
|
+
opacity: opacity,
|
|
14548
|
+
fillOpacity: fillOpacity,
|
|
14549
|
+
lineHeight: lineHeight,
|
|
14550
|
+
strokeOpacity: strokeOpacity,
|
|
14551
|
+
upgradeAttrs: upgradeAttrs
|
|
14552
|
+
} = this.attribute,
|
|
14553
|
+
out = Object.assign({
|
|
14554
|
+
fill: fill,
|
|
14555
|
+
stroke: stroke,
|
|
14556
|
+
fontSize: fontSize,
|
|
14557
|
+
fontFamily: fontFamily,
|
|
14558
|
+
fontStyle: fontStyle,
|
|
14559
|
+
fontWeight: fontWeight,
|
|
14560
|
+
lineWidth: lineWidth,
|
|
14561
|
+
opacity: opacity,
|
|
14562
|
+
fillOpacity: fillOpacity,
|
|
14563
|
+
strokeOpacity: strokeOpacity
|
|
14564
|
+
}, config);
|
|
14565
|
+
return (null == upgradeAttrs ? void 0 : upgradeAttrs.lineHeight) && (out.lineHeight = lineHeight), out;
|
|
14554
14566
|
}
|
|
14555
14567
|
doUpdateFrameCache(tc) {
|
|
14556
14568
|
var _a;
|
|
14557
14569
|
const {
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14570
|
+
maxWidth: maxWidth,
|
|
14571
|
+
maxHeight: maxHeight,
|
|
14572
|
+
width: width,
|
|
14573
|
+
height: height,
|
|
14574
|
+
ellipsis: ellipsis,
|
|
14575
|
+
wordBreak: wordBreak,
|
|
14576
|
+
verticalDirection: verticalDirection,
|
|
14577
|
+
textAlign: textAlign,
|
|
14578
|
+
textBaseline: textBaseline,
|
|
14579
|
+
layoutDirection: layoutDirection,
|
|
14580
|
+
singleLine: singleLine,
|
|
14581
|
+
disableAutoWrapLine: disableAutoWrapLine,
|
|
14582
|
+
editable: editable,
|
|
14583
|
+
ascentDescentMode: ascentDescentMode,
|
|
14584
|
+
upgradeAttrs: upgradeAttrs
|
|
14585
|
+
} = this.attribute,
|
|
14586
|
+
enableMultiBreakLine = upgradeAttrs && upgradeAttrs.multiBreakLine;
|
|
14573
14587
|
let {
|
|
14574
14588
|
textConfig: _tc = []
|
|
14575
14589
|
} = this.attribute;
|
|
@@ -14591,7 +14605,10 @@
|
|
|
14591
14605
|
const richTextConfig = this.combinedStyleToCharacter(textConfig[i]);
|
|
14592
14606
|
if (isNumber$1(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
|
|
14593
14607
|
const textParts = richTextConfig.text.split("\n");
|
|
14594
|
-
for (let j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j],
|
|
14608
|
+
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 {
|
|
14609
|
+
const nextRichTextConfig = this.combinedStyleToCharacter(textConfig[i + 1]);
|
|
14610
|
+
paragraphs.push(new Paragraph(textParts[j], !0, nextRichTextConfig, ascentDescentMode));
|
|
14611
|
+
}
|
|
14595
14612
|
} else richTextConfig.text && paragraphs.push(new Paragraph(richTextConfig.text, !1, richTextConfig, ascentDescentMode));
|
|
14596
14613
|
}
|
|
14597
14614
|
const maxWidthFinite = "number" == typeof maxWidth && Number.isFinite(maxWidth) && maxWidth > 0,
|
|
@@ -14600,7 +14617,7 @@
|
|
|
14600
14617
|
richTextHeightEnable = "number" == typeof height && Number.isFinite(height) && height > 0 && (!maxHeightFinite || height <= maxHeight),
|
|
14601
14618
|
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),
|
|
14602
14619
|
wrapper = new Wrapper(frame);
|
|
14603
|
-
if (wrapper.newLine =
|
|
14620
|
+
if (wrapper.newLine = enableMultiBreakLine, disableAutoWrapLine) {
|
|
14604
14621
|
let lineCount = 0,
|
|
14605
14622
|
skip = !1;
|
|
14606
14623
|
for (let i = 0; i < paragraphs.length; i++) {
|
|
@@ -14616,7 +14633,7 @@
|
|
|
14616
14633
|
l.calcOffset(offsetSize, !1);
|
|
14617
14634
|
});
|
|
14618
14635
|
}
|
|
14619
|
-
|
|
14636
|
+
enableMultiBreakLine && frame.lines.forEach(item => {
|
|
14620
14637
|
const lastParagraphs = item.paragraphs;
|
|
14621
14638
|
item.paragraphs = item.paragraphs.filter(p => "" !== p.text), 0 === item.paragraphs.length && lastParagraphs.length && (lastParagraphs[0].text = "\n", item.paragraphs.push(lastParagraphs[0]));
|
|
14622
14639
|
}), this._frameCache = frame;
|
|
@@ -20274,6 +20291,7 @@
|
|
|
20274
20291
|
fill = "black",
|
|
20275
20292
|
stroke = !1,
|
|
20276
20293
|
fontWeight = "normal",
|
|
20294
|
+
lineHeight: lineHeight,
|
|
20277
20295
|
fontFamily = "Arial"
|
|
20278
20296
|
} = attribute;
|
|
20279
20297
|
let {
|
|
@@ -20284,7 +20302,8 @@
|
|
|
20284
20302
|
stroke: stroke,
|
|
20285
20303
|
fontSize: fontSize,
|
|
20286
20304
|
fontWeight: fontWeight,
|
|
20287
|
-
fontFamily: fontFamily
|
|
20305
|
+
fontFamily: fontFamily,
|
|
20306
|
+
lineHeight: lineHeight
|
|
20288
20307
|
};
|
|
20289
20308
|
}
|
|
20290
20309
|
function findConfigIndexByCursorIdx(textConfig, cursorIndex) {
|
|
@@ -20533,15 +20552,15 @@
|
|
|
20533
20552
|
}, this.handleFocusOut = () => {
|
|
20534
20553
|
throw new Error("不会走到这里 handleFocusOut");
|
|
20535
20554
|
}, this.handleMove = e => {
|
|
20536
|
-
this.
|
|
20555
|
+
this.currRt && !this.currRt.attribute.editable && this.deFocus(!0), this.isEditableRichtext(e) ? (this.handleEnter(), e.target.once("pointerleave", this.handleLeave, {
|
|
20537
20556
|
capture: !0
|
|
20538
|
-
}), this.tryShowSelection(e, !1));
|
|
20539
|
-
}, this.handleEnter =
|
|
20557
|
+
}), this.tryShowSelection(e, !1)) : this.handleLeave();
|
|
20558
|
+
}, this.handleEnter = () => {
|
|
20540
20559
|
this.editing = !0, this.pluginService.stage.setCursor("text");
|
|
20541
|
-
}, this.handleLeave =
|
|
20560
|
+
}, this.handleLeave = () => {
|
|
20542
20561
|
this.editing = !1, this.pluginService.stage.setCursor("default");
|
|
20543
20562
|
}, this.handlePointerDown = e => {
|
|
20544
|
-
this.editing ? this.onFocus(e) : this.deFocus(!0), this.triggerRender(), this.pointerDown = !0, this.updateCbs.forEach(cb => cb(this.editing ? "onfocus" : "defocus", this));
|
|
20563
|
+
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));
|
|
20545
20564
|
}, this.handlePointerUp = e => {
|
|
20546
20565
|
this.pointerDown = !1;
|
|
20547
20566
|
}, this.handleDBLClick = e => {
|
|
@@ -20649,7 +20668,7 @@
|
|
|
20649
20668
|
} = cache,
|
|
20650
20669
|
totalCursorCount = lines.reduce((total, line) => total + line.paragraphs.length, 0) - 1;
|
|
20651
20670
|
if (x) {
|
|
20652
|
-
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);
|
|
20671
|
+
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;
|
|
20653
20672
|
const pos = this.computedCursorPosByCursorIdx(this.curCursorIdx, this.currRt);
|
|
20654
20673
|
this.setCursorAndTextArea(pos.x, pos.y1, pos.y2, this.currRt), this.hideSelection();
|
|
20655
20674
|
}
|
|
@@ -20742,7 +20761,8 @@
|
|
|
20742
20761
|
lineWidth: 1,
|
|
20743
20762
|
zIndex: -1
|
|
20744
20763
|
});
|
|
20745
|
-
this.getShadow(this.currRt)
|
|
20764
|
+
const shadow = this.getShadow(this.currRt);
|
|
20765
|
+
this.addEditLineOrBgOrBounds(this.shadowBounds, shadow), this.offsetLineBgAndShadowBounds(), this.offsetShadowRoot();
|
|
20746
20766
|
}
|
|
20747
20767
|
trySyncPlaceholderToTextConfig() {
|
|
20748
20768
|
if (!this.currRt) return;
|
|
@@ -20777,8 +20797,22 @@
|
|
|
20777
20797
|
stopPropagation(e) {
|
|
20778
20798
|
e.stopPropagation();
|
|
20779
20799
|
}
|
|
20800
|
+
addEditLineOrBgOrBounds(graphic, shadowRoot) {
|
|
20801
|
+
let group = shadowRoot.getElementById("emptyBoundsContainer");
|
|
20802
|
+
group || (group = createGroup({
|
|
20803
|
+
x: 0,
|
|
20804
|
+
y: 0,
|
|
20805
|
+
width: 0,
|
|
20806
|
+
height: 0,
|
|
20807
|
+
boundsMode: "empty"
|
|
20808
|
+
}), group.id = "emptyBoundsContainer", shadowRoot.add(group)), group.add(graphic);
|
|
20809
|
+
}
|
|
20810
|
+
removeEditLineOrBgOrBounds(graphic, shadowRoot) {
|
|
20811
|
+
const group = shadowRoot.getElementById("emptyBoundsContainer");
|
|
20812
|
+
group && group.removeChild(graphic);
|
|
20813
|
+
}
|
|
20780
20814
|
onFocus(e, data) {
|
|
20781
|
-
this.updateCbs && this.updateCbs.forEach(cb => cb("beforeOnfocus", this)), this.deFocus(!1), this.focusing = !0;
|
|
20815
|
+
this.updateCbs && this.updateCbs.forEach(cb => cb("beforeOnfocus", this)), this.deFocus(!1), this.focusing = !0, this.editing = !0;
|
|
20782
20816
|
const target = e.target;
|
|
20783
20817
|
if (!target || "richtext" !== target.type) return;
|
|
20784
20818
|
this.currRt = target, RichTextEditPlugin.tryUpdateRichtext(target);
|
|
@@ -20802,7 +20836,7 @@
|
|
|
20802
20836
|
width: 0,
|
|
20803
20837
|
height: 0
|
|
20804
20838
|
});
|
|
20805
|
-
this.editBg = g,
|
|
20839
|
+
this.editBg = g, this.addEditLineOrBgOrBounds(this.editLine, shadowRoot), this.addEditLineOrBgOrBounds(this.editBg, shadowRoot);
|
|
20806
20840
|
}
|
|
20807
20841
|
if (data = data || this.computedCursorPosByEvent(e, cache)) {
|
|
20808
20842
|
const {
|
|
@@ -20867,27 +20901,29 @@
|
|
|
20867
20901
|
}
|
|
20868
20902
|
deFocus() {
|
|
20869
20903
|
let trulyDeFocus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
20870
|
-
this.updateCbs && this.updateCbs.forEach(cb => cb("beforeDefocus", this, {
|
|
20904
|
+
this.editing = !1, this.updateCbs && this.updateCbs.forEach(cb => cb("beforeDefocus", this, {
|
|
20871
20905
|
trulyDeFocus: trulyDeFocus
|
|
20872
20906
|
}));
|
|
20873
|
-
const
|
|
20874
|
-
if (!
|
|
20907
|
+
const currRt = this.currRt;
|
|
20908
|
+
if (!currRt) return;
|
|
20875
20909
|
const {
|
|
20876
20910
|
editOptions = {}
|
|
20877
|
-
} =
|
|
20878
|
-
editOptions.stopPropagation &&
|
|
20879
|
-
const
|
|
20880
|
-
this.
|
|
20911
|
+
} = currRt.attribute;
|
|
20912
|
+
editOptions.stopPropagation && currRt.removeEventListener("*", this.stopPropagation), trulyDeFocus && (this.trySyncPlaceholderToTextConfig(), currRt.detachShadow()), this.currRt = null;
|
|
20913
|
+
const shadowRoot = this.getShadow(currRt);
|
|
20914
|
+
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;
|
|
20881
20915
|
const textConfig = currRt.attribute.textConfig;
|
|
20882
20916
|
let lastConfig = textConfig[textConfig.length - 1],
|
|
20883
20917
|
cleared = !1;
|
|
20884
20918
|
for (; lastConfig && "\n" === lastConfig.text;) textConfig.pop(), lastConfig = textConfig[textConfig.length - 1], cleared = !0;
|
|
20885
20919
|
cleared && currRt.setAttributes({
|
|
20886
20920
|
textConfig: textConfig
|
|
20887
|
-
});
|
|
20921
|
+
}), currRt.removeEventListener("pointerleave", this.handleLeave);
|
|
20888
20922
|
}
|
|
20889
20923
|
addAnimateToLine(line) {
|
|
20890
|
-
line.
|
|
20924
|
+
line.setAttributes({
|
|
20925
|
+
opacity: 1
|
|
20926
|
+
}), line.animates && line.animates.forEach(animate => {
|
|
20891
20927
|
animate.stop(), animate.release();
|
|
20892
20928
|
});
|
|
20893
20929
|
line.animate({
|
|
@@ -20996,7 +21032,8 @@
|
|
|
20996
21032
|
getShadow(rt) {
|
|
20997
21033
|
const sr = rt.shadowRoot || rt.attachShadow();
|
|
20998
21034
|
return sr.setAttributes({
|
|
20999
|
-
|
|
21035
|
+
width: 1,
|
|
21036
|
+
height: 1
|
|
21000
21037
|
}), sr;
|
|
21001
21038
|
}
|
|
21002
21039
|
getLineByPoint(cache, p1) {
|
|
@@ -21030,7 +21067,10 @@
|
|
|
21030
21067
|
return -1;
|
|
21031
21068
|
}
|
|
21032
21069
|
isRichtext(e) {
|
|
21033
|
-
return !(!e.target || "richtext" !== e.target.type
|
|
21070
|
+
return !(!e.target || "richtext" !== e.target.type);
|
|
21071
|
+
}
|
|
21072
|
+
isEditableRichtext(e) {
|
|
21073
|
+
return this.isRichtext(e) && !!e.target.attribute.editable;
|
|
21034
21074
|
}
|
|
21035
21075
|
triggerRender() {
|
|
21036
21076
|
this.pluginService.stage.renderNextFrame();
|
|
@@ -21176,7 +21216,7 @@
|
|
|
21176
21216
|
target && (this.currRt = target, e ? this._forceFocusByEvent(e) : this._forceFocusByCursorIndex(null != cursorIndex ? cursorIndex : -.1));
|
|
21177
21217
|
}
|
|
21178
21218
|
_forceFocusByEvent(e) {
|
|
21179
|
-
this.handleEnter(
|
|
21219
|
+
this.handleEnter(), this.handlePointerDown(e), this.handlePointerUp(e);
|
|
21180
21220
|
}
|
|
21181
21221
|
_forceFocusByCursorIndex(cursorIndex) {
|
|
21182
21222
|
const richtext = this.currRt;
|
|
@@ -27497,13 +27537,15 @@
|
|
|
27497
27537
|
this.canvas = new NodeCanvas(options);
|
|
27498
27538
|
}
|
|
27499
27539
|
createWindowByCanvas(params) {
|
|
27500
|
-
|
|
27540
|
+
var _a;
|
|
27541
|
+
const canvas = params.canvas,
|
|
27542
|
+
dpr = null !== (_a = params.dpr) && void 0 !== _a ? _a : 1;
|
|
27501
27543
|
let width = params.width,
|
|
27502
27544
|
height = params.height;
|
|
27503
|
-
null != width && null != height && params.canvasControled || (width = canvas.width, height = canvas.height), this.canvas = new NodeCanvas({
|
|
27545
|
+
null != width && null != height && params.canvasControled || (width = canvas.width / dpr, height = canvas.height / dpr), this.canvas = new NodeCanvas({
|
|
27504
27546
|
width: width,
|
|
27505
27547
|
height: height,
|
|
27506
|
-
dpr:
|
|
27548
|
+
dpr: dpr,
|
|
27507
27549
|
nativeCanvas: canvas,
|
|
27508
27550
|
canvasControled: params.canvasControled
|
|
27509
27551
|
});
|
|
@@ -31243,7 +31285,7 @@
|
|
|
31243
31285
|
|
|
31244
31286
|
const roughModule = _roughModule;
|
|
31245
31287
|
|
|
31246
|
-
const version = "0.22.0-vstory.
|
|
31288
|
+
const version = "0.22.0-vstory.16";
|
|
31247
31289
|
preLoadAllModule();
|
|
31248
31290
|
if (isBrowserEnv()) {
|
|
31249
31291
|
loadBrowserEnv(container);
|