@visactor/vrender 0.19.12 → 0.19.13-alpha.1
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 +11 -10
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +368 -10
- package/dist/index.js +371 -15
- 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
|
@@ -12920,10 +12920,10 @@
|
|
|
12920
12920
|
strokeOpacity: strokeOpacity
|
|
12921
12921
|
}, config);
|
|
12922
12922
|
}
|
|
12923
|
-
doUpdateFrameCache() {
|
|
12923
|
+
doUpdateFrameCache(tc) {
|
|
12924
12924
|
var _a;
|
|
12925
12925
|
const {
|
|
12926
|
-
textConfig = [],
|
|
12926
|
+
textConfig: _tc = [],
|
|
12927
12927
|
maxWidth: maxWidth,
|
|
12928
12928
|
maxHeight: maxHeight,
|
|
12929
12929
|
width: width,
|
|
@@ -12937,7 +12937,8 @@
|
|
|
12937
12937
|
singleLine: singleLine,
|
|
12938
12938
|
disableAutoWrapLine: disableAutoWrapLine
|
|
12939
12939
|
} = this.attribute,
|
|
12940
|
-
paragraphs = []
|
|
12940
|
+
paragraphs = [],
|
|
12941
|
+
textConfig = null != tc ? tc : _tc;
|
|
12941
12942
|
for (let i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
|
|
12942
12943
|
const config = this.combinedStyleToCharacter(textConfig[i]),
|
|
12943
12944
|
iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
|
|
@@ -17070,10 +17071,10 @@
|
|
|
17070
17071
|
this.order = 1;
|
|
17071
17072
|
}
|
|
17072
17073
|
afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
17073
|
-
return (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
|
|
17074
|
+
return null == graphic.attribute.shadowRootIdx && graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx < 0 || (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx || graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx > 0) && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
|
|
17074
17075
|
}
|
|
17075
17076
|
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
17076
|
-
return graphic.attribute.shadowRootIdx < 0 && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
|
|
17077
|
+
return null == graphic.attribute.shadowRootIdx && graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx > 0 || (graphic.attribute.shadowRootIdx < 0 || graphic.shadowRoot && graphic.shadowRoot.attribute.shadowRootIdx < 0) && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
|
|
17077
17078
|
}
|
|
17078
17079
|
drawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
17079
17080
|
if (!graphic.shadowRoot) return !1;
|
|
@@ -20284,6 +20285,356 @@
|
|
|
20284
20285
|
return points = simplifyDouglasPeucker(points = highestQuality ? points : simplifyRadialDist(points, sqTolerance), sqTolerance);
|
|
20285
20286
|
}
|
|
20286
20287
|
|
|
20288
|
+
class EditModule {
|
|
20289
|
+
constructor(container) {
|
|
20290
|
+
this.handleKeyDown = e => {
|
|
20291
|
+
"Delete" !== e.key && "Backspace" !== e.key || this.handleInput({
|
|
20292
|
+
data: null,
|
|
20293
|
+
type: "Backspace"
|
|
20294
|
+
});
|
|
20295
|
+
}, this.handleCompositionStart = () => {
|
|
20296
|
+
const {
|
|
20297
|
+
textConfig = []
|
|
20298
|
+
} = this.currRt.attribute,
|
|
20299
|
+
lastConfig = textConfig[this.cursorIndex];
|
|
20300
|
+
textConfig.splice(this.cursorIndex + 1, 0, Object.assign(Object.assign({}, lastConfig), {
|
|
20301
|
+
text: ""
|
|
20302
|
+
})), this.isComposing = !0;
|
|
20303
|
+
}, this.handleCompositionEnd = () => {
|
|
20304
|
+
this.isComposing = !1;
|
|
20305
|
+
const curIdx = this.cursorIndex + 1,
|
|
20306
|
+
{
|
|
20307
|
+
textConfig = []
|
|
20308
|
+
} = this.currRt.attribute,
|
|
20309
|
+
lastConfig = textConfig[curIdx];
|
|
20310
|
+
textConfig.splice(curIdx, 1);
|
|
20311
|
+
const text = lastConfig.text,
|
|
20312
|
+
textList = Array.from(text.toString());
|
|
20313
|
+
for (let i = 0; i < textList.length; i++) textConfig.splice(i + curIdx, 0, Object.assign(Object.assign({}, lastConfig), {
|
|
20314
|
+
text: textList[i]
|
|
20315
|
+
}));
|
|
20316
|
+
this.currRt.setAttributes({
|
|
20317
|
+
textConfig: textConfig
|
|
20318
|
+
}), this.onChangeCbList.forEach(cb => {
|
|
20319
|
+
cb(text, this.isComposing, this.cursorIndex + textList.length, this.currRt);
|
|
20320
|
+
});
|
|
20321
|
+
}, this.handleInput = ev => {
|
|
20322
|
+
if (!this.currRt) return;
|
|
20323
|
+
const str = ev.data || "\n",
|
|
20324
|
+
{
|
|
20325
|
+
textConfig = []
|
|
20326
|
+
} = this.currRt.attribute;
|
|
20327
|
+
let startIdx = this.selectionStartCursorIdx,
|
|
20328
|
+
endIdx = this.cursorIndex;
|
|
20329
|
+
startIdx > endIdx && ([startIdx, endIdx] = [endIdx, startIdx]), this.selectionStartCursorIdx = startIdx, this.cursorIndex = startIdx;
|
|
20330
|
+
const lastConfig = textConfig[startIdx + (this.isComposing ? 1 : 0)];
|
|
20331
|
+
let currConfig = lastConfig;
|
|
20332
|
+
"Backspace" !== ev.type || this.isComposing ? (startIdx !== endIdx && textConfig.splice(startIdx + 1, endIdx - startIdx), this.isComposing || (currConfig = Object.assign(Object.assign({}, lastConfig), {
|
|
20333
|
+
text: ""
|
|
20334
|
+
}), startIdx += 1, textConfig.splice(startIdx, 0, currConfig)), currConfig.text = str) : startIdx !== endIdx ? textConfig.splice(startIdx + 1, endIdx - startIdx) : (textConfig.splice(startIdx, 1), startIdx -= 1), this.currRt.setAttributes({
|
|
20335
|
+
textConfig: textConfig
|
|
20336
|
+
}), this.isComposing ? this.onInputCbList.forEach(cb => {
|
|
20337
|
+
cb(str, this.isComposing, startIdx, this.currRt);
|
|
20338
|
+
}) : this.onChangeCbList.forEach(cb => {
|
|
20339
|
+
cb(str, this.isComposing, startIdx, this.currRt);
|
|
20340
|
+
});
|
|
20341
|
+
}, this.container = null != container ? container : document.body;
|
|
20342
|
+
const textAreaDom = document.createElement("textarea");
|
|
20343
|
+
textAreaDom.autocomplete = "off", textAreaDom.innerText = "", this.applyStyle(textAreaDom), this.container.append(textAreaDom), this.textAreaDom = textAreaDom, this.isComposing = !1, this.onInputCbList = [], this.onChangeCbList = [];
|
|
20344
|
+
}
|
|
20345
|
+
onInput(cb) {
|
|
20346
|
+
this.onInputCbList.push(cb);
|
|
20347
|
+
}
|
|
20348
|
+
onChange(cb) {
|
|
20349
|
+
this.onChangeCbList.push(cb);
|
|
20350
|
+
}
|
|
20351
|
+
applyStyle(textAreaDom) {
|
|
20352
|
+
textAreaDom.setAttribute("style", "width: 100px; height: 30px; left: 0; position: absolute; z-index: -1; outline: none; resize: none; border: none; overflow: hidden; color: transparent; user-select: none; caret-color: transparent;background-color: transparent;"), textAreaDom.addEventListener("input", this.handleInput), textAreaDom.addEventListener("compositionstart", this.handleCompositionStart), textAreaDom.addEventListener("compositionend", this.handleCompositionEnd), window.addEventListener("keydown", this.handleKeyDown);
|
|
20353
|
+
}
|
|
20354
|
+
moveTo(x, y, rt, cursorIndex, selectionStartCursorIdx) {
|
|
20355
|
+
this.textAreaDom.style.left = `${x}px`, this.textAreaDom.style.top = `${y}px`, setTimeout(() => {
|
|
20356
|
+
this.textAreaDom.focus(), this.textAreaDom.setSelectionRange(0, 0);
|
|
20357
|
+
}), this.currRt = rt, this.cursorIndex = cursorIndex, this.selectionStartCursorIdx = selectionStartCursorIdx;
|
|
20358
|
+
}
|
|
20359
|
+
release() {
|
|
20360
|
+
this.textAreaDom.removeEventListener("input", this.handleInput), this.textAreaDom.removeEventListener("compositionstart", this.handleCompositionStart), this.textAreaDom.removeEventListener("compositionend", this.handleCompositionEnd), window.removeEventListener("keydown", this.handleKeyDown);
|
|
20361
|
+
}
|
|
20362
|
+
}
|
|
20363
|
+
|
|
20364
|
+
class RichTextEditPlugin {
|
|
20365
|
+
constructor() {
|
|
20366
|
+
this.name = "RichTextEditPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.editing = !1, this.pointerDown = !1, this.handleInput = (text, isComposing, cursorIdx, rt) => {
|
|
20367
|
+
const p = this.getPointByColumnIdx(cursorIdx, rt);
|
|
20368
|
+
this.hideSelection(), this.setCursor(p.x, p.y1, p.y2);
|
|
20369
|
+
}, this.handleChange = (text, isComposing, cursorIdx, rt) => {
|
|
20370
|
+
const p = this.getPointByColumnIdx(cursorIdx, rt);
|
|
20371
|
+
this.curCursorIdx = cursorIdx, this.selectionStartCursorIdx = cursorIdx, this.setCursorAndTextArea(p.x, p.y1, p.y2, rt), this.hideSelection();
|
|
20372
|
+
}, this.handleMove = e => {
|
|
20373
|
+
this.isRichtext(e) && (this.handleEnter(e), e.target.once("pointerleave", this.handleLeave), this.showSelection(e));
|
|
20374
|
+
}, this.handlePointerDown = e => {
|
|
20375
|
+
this.editing ? this.onFocus(e) : this.deFocus(e), this.applyUpdate(), this.pointerDown = !0;
|
|
20376
|
+
}, this.handlePointerUp = e => {
|
|
20377
|
+
this.pointerDown = !1;
|
|
20378
|
+
}, this.handleEnter = e => {
|
|
20379
|
+
this.editing = !0, this.pluginService.stage.setCursor("text");
|
|
20380
|
+
}, this.handleLeave = e => {
|
|
20381
|
+
this.editing = !1, this.pluginService.stage.setCursor("default");
|
|
20382
|
+
};
|
|
20383
|
+
}
|
|
20384
|
+
activate(context) {
|
|
20385
|
+
this.pluginService = context, this.editModule = new EditModule(), context.stage.on("pointermove", this.handleMove), context.stage.on("pointerdown", this.handlePointerDown), context.stage.on("pointerup", this.handlePointerUp), context.stage.on("pointerleave", this.handlePointerUp), this.editModule.onInput(this.handleInput), this.editModule.onChange(this.handleChange);
|
|
20386
|
+
}
|
|
20387
|
+
showSelection(e) {
|
|
20388
|
+
const cache = e.target.getFrameCache();
|
|
20389
|
+
if (cache && this.editBg) {
|
|
20390
|
+
if (this.pointerDown) {
|
|
20391
|
+
let p0 = this.lastPoint,
|
|
20392
|
+
p1 = this.getEventPosition(e),
|
|
20393
|
+
line1Info = this.getLineByPoint(cache, p1);
|
|
20394
|
+
const column1 = this.getColumnByLinePoint(line1Info, p1),
|
|
20395
|
+
y1 = line1Info.top,
|
|
20396
|
+
y2 = line1Info.top + line1Info.height;
|
|
20397
|
+
let x = column1.left + column1.width,
|
|
20398
|
+
cursorIndex = this.getColumnIndex(cache, column1);
|
|
20399
|
+
p1.x < column1.left + column1.width / 2 && (x = column1.left, cursorIndex -= 1), p1.x = x, p1.y = (y1 + y2) / 2;
|
|
20400
|
+
let line0Info = this.getLineByPoint(cache, p0);
|
|
20401
|
+
if ((p0.y > p1.y || p0.y === p1.y && p0.x > p1.x) && ([p0, p1] = [p1, p0], [line1Info, line0Info] = [line0Info, line1Info]), this.editBg.removeAllChild(), line0Info === line1Info) {
|
|
20402
|
+
const column0 = this.getColumnByLinePoint(line0Info, p0);
|
|
20403
|
+
this.editBg.setAttributes({
|
|
20404
|
+
x: p0.x,
|
|
20405
|
+
y: line0Info.top,
|
|
20406
|
+
width: p1.x - p0.x,
|
|
20407
|
+
height: column0.height,
|
|
20408
|
+
fill: "#336df4",
|
|
20409
|
+
fillOpacity: .2
|
|
20410
|
+
});
|
|
20411
|
+
} else {
|
|
20412
|
+
this.editBg.setAttributes({
|
|
20413
|
+
x: 0,
|
|
20414
|
+
y: line0Info.top,
|
|
20415
|
+
width: 0,
|
|
20416
|
+
height: 0
|
|
20417
|
+
});
|
|
20418
|
+
const startIdx = cache.lines.findIndex(item => item === line0Info),
|
|
20419
|
+
endIdx = cache.lines.findIndex(item => item === line1Info);
|
|
20420
|
+
let y = 0;
|
|
20421
|
+
for (let i = startIdx; i <= endIdx; i++) {
|
|
20422
|
+
const line = cache.lines[i];
|
|
20423
|
+
if (i === startIdx) {
|
|
20424
|
+
const p = line.paragraphs[line.paragraphs.length - 1];
|
|
20425
|
+
this.editBg.add(createRect({
|
|
20426
|
+
x: p0.x,
|
|
20427
|
+
y: y,
|
|
20428
|
+
width: p.left + p.width - p0.x,
|
|
20429
|
+
height: line.height,
|
|
20430
|
+
fill: "#336df4",
|
|
20431
|
+
fillOpacity: .2
|
|
20432
|
+
}));
|
|
20433
|
+
} else if (i === endIdx) {
|
|
20434
|
+
const p = line.paragraphs[0];
|
|
20435
|
+
this.editBg.add(createRect({
|
|
20436
|
+
x: p.left,
|
|
20437
|
+
y: y,
|
|
20438
|
+
width: p1.x - p.left,
|
|
20439
|
+
height: line.height,
|
|
20440
|
+
fill: "#336df4",
|
|
20441
|
+
fillOpacity: .2
|
|
20442
|
+
}));
|
|
20443
|
+
} else {
|
|
20444
|
+
const p0 = line.paragraphs[0],
|
|
20445
|
+
p1 = line.paragraphs[line.paragraphs.length - 1];
|
|
20446
|
+
this.editBg.add(createRect({
|
|
20447
|
+
x: p0.left,
|
|
20448
|
+
y: y,
|
|
20449
|
+
width: p1.left + p1.width - p0.left,
|
|
20450
|
+
height: line.height,
|
|
20451
|
+
fill: "#336df4",
|
|
20452
|
+
fillOpacity: .2
|
|
20453
|
+
}));
|
|
20454
|
+
}
|
|
20455
|
+
y += line.height;
|
|
20456
|
+
}
|
|
20457
|
+
}
|
|
20458
|
+
this.curCursorIdx = cursorIndex, this.setCursorAndTextArea(x, y1 + 2, y2 - 2, e.target);
|
|
20459
|
+
}
|
|
20460
|
+
this.applyUpdate();
|
|
20461
|
+
}
|
|
20462
|
+
}
|
|
20463
|
+
hideSelection() {
|
|
20464
|
+
this.editBg && (this.editBg.removeAllChild(), this.editBg.setAttributes({
|
|
20465
|
+
fill: "transparent"
|
|
20466
|
+
}));
|
|
20467
|
+
}
|
|
20468
|
+
isRichtext(e) {
|
|
20469
|
+
return !(!e.target || "richtext" !== e.target.type);
|
|
20470
|
+
}
|
|
20471
|
+
getEventPosition(e) {
|
|
20472
|
+
const p = this.pluginService.stage.eventPointTransform(e),
|
|
20473
|
+
p1 = {
|
|
20474
|
+
x: 0,
|
|
20475
|
+
y: 0
|
|
20476
|
+
};
|
|
20477
|
+
return e.target.globalTransMatrix.transformPoint(p, p1), p1;
|
|
20478
|
+
}
|
|
20479
|
+
getLineByPoint(cache, p1) {
|
|
20480
|
+
let lineInfo = cache.lines[0];
|
|
20481
|
+
for (let i = 0; i < cache.lines.length && !(lineInfo.top <= p1.y && lineInfo.top + lineInfo.height >= p1.y); i++) lineInfo = cache.lines[i + 1];
|
|
20482
|
+
return lineInfo;
|
|
20483
|
+
}
|
|
20484
|
+
getColumnByLinePoint(lineInfo, p1) {
|
|
20485
|
+
let columnInfo = lineInfo.paragraphs[0];
|
|
20486
|
+
for (let i = 0; i < lineInfo.paragraphs.length && !(columnInfo.left <= p1.x && columnInfo.left + columnInfo.width >= p1.x); i++) columnInfo = lineInfo.paragraphs[i];
|
|
20487
|
+
return columnInfo;
|
|
20488
|
+
}
|
|
20489
|
+
onFocus(e) {
|
|
20490
|
+
this.deFocus(e);
|
|
20491
|
+
const target = e.target;
|
|
20492
|
+
this.tryUpdateRichtext(target);
|
|
20493
|
+
const shadowRoot = target.attachShadow();
|
|
20494
|
+
shadowRoot.setAttributes({
|
|
20495
|
+
shadowRootIdx: -1
|
|
20496
|
+
});
|
|
20497
|
+
const cache = target.getFrameCache();
|
|
20498
|
+
if (!cache) return;
|
|
20499
|
+
if (!this.editLine) {
|
|
20500
|
+
const line = createLine({
|
|
20501
|
+
x: 0,
|
|
20502
|
+
y: 0,
|
|
20503
|
+
lineWidth: 1,
|
|
20504
|
+
stroke: "black"
|
|
20505
|
+
});
|
|
20506
|
+
line.animate().to({
|
|
20507
|
+
opacity: 1
|
|
20508
|
+
}, 10, "linear").wait(700).to({
|
|
20509
|
+
opacity: 0
|
|
20510
|
+
}, 10, "linear").wait(700).loop(1 / 0), this.editLine = line;
|
|
20511
|
+
const g = createGroup({
|
|
20512
|
+
x: 0,
|
|
20513
|
+
y: 0,
|
|
20514
|
+
width: 0,
|
|
20515
|
+
height: 0
|
|
20516
|
+
});
|
|
20517
|
+
this.editBg = g, shadowRoot.add(this.editLine), shadowRoot.add(this.editBg);
|
|
20518
|
+
}
|
|
20519
|
+
const p1 = this.getEventPosition(e),
|
|
20520
|
+
lineInfo = this.getLineByPoint(cache, p1);
|
|
20521
|
+
if (lineInfo) {
|
|
20522
|
+
const columnInfo = this.getColumnByLinePoint(lineInfo, p1);
|
|
20523
|
+
if (!columnInfo) return;
|
|
20524
|
+
let y1 = lineInfo.top,
|
|
20525
|
+
y2 = lineInfo.top + lineInfo.height,
|
|
20526
|
+
x = columnInfo.left + columnInfo.width;
|
|
20527
|
+
y1 += 2, y2 -= 2;
|
|
20528
|
+
let cursorIndex = this.getColumnIndex(cache, columnInfo);
|
|
20529
|
+
p1.x < columnInfo.left + columnInfo.width / 2 && (x = columnInfo.left, cursorIndex -= 1), this.lastPoint = {
|
|
20530
|
+
x: x,
|
|
20531
|
+
y: (y1 + y2) / 2
|
|
20532
|
+
}, this.curCursorIdx = cursorIndex, this.selectionStartCursorIdx = cursorIndex, this.setCursorAndTextArea(x, y1, y2, target);
|
|
20533
|
+
}
|
|
20534
|
+
}
|
|
20535
|
+
getPointByColumnIdx(idx, rt) {
|
|
20536
|
+
const cache = rt.getFrameCache(),
|
|
20537
|
+
{
|
|
20538
|
+
lineInfo: lineInfo,
|
|
20539
|
+
columnInfo: columnInfo
|
|
20540
|
+
} = this.getColumnByIndex(cache, idx);
|
|
20541
|
+
let y1 = lineInfo.top,
|
|
20542
|
+
y2 = lineInfo.top + lineInfo.height;
|
|
20543
|
+
return y1 += 2, y2 -= 2, {
|
|
20544
|
+
x: columnInfo.left + columnInfo.width,
|
|
20545
|
+
y1: y1,
|
|
20546
|
+
y2: y2
|
|
20547
|
+
};
|
|
20548
|
+
}
|
|
20549
|
+
getColumnIndex(cache, cInfo) {
|
|
20550
|
+
let inputIndex = -1;
|
|
20551
|
+
for (let i = 0; i < cache.lines.length; i++) {
|
|
20552
|
+
const line = cache.lines[i];
|
|
20553
|
+
for (let j = 0; j < line.paragraphs.length; j++) if (inputIndex++, cInfo === line.paragraphs[j]) return inputIndex;
|
|
20554
|
+
}
|
|
20555
|
+
return -1;
|
|
20556
|
+
}
|
|
20557
|
+
getColumnByIndex(cache, index) {
|
|
20558
|
+
let inputIndex = -1;
|
|
20559
|
+
for (let i = 0; i < cache.lines.length; i++) {
|
|
20560
|
+
const lineInfo = cache.lines[i];
|
|
20561
|
+
for (let j = 0; j < lineInfo.paragraphs.length; j++) {
|
|
20562
|
+
const columnInfo = lineInfo.paragraphs[j];
|
|
20563
|
+
if (inputIndex++, inputIndex === index) return {
|
|
20564
|
+
lineInfo: lineInfo,
|
|
20565
|
+
columnInfo: columnInfo
|
|
20566
|
+
};
|
|
20567
|
+
}
|
|
20568
|
+
}
|
|
20569
|
+
return null;
|
|
20570
|
+
}
|
|
20571
|
+
setCursorAndTextArea(x, y1, y2, rt) {
|
|
20572
|
+
this.editLine.setAttributes({
|
|
20573
|
+
points: [{
|
|
20574
|
+
x: x,
|
|
20575
|
+
y: y1
|
|
20576
|
+
}, {
|
|
20577
|
+
x: x,
|
|
20578
|
+
y: y2
|
|
20579
|
+
}]
|
|
20580
|
+
});
|
|
20581
|
+
const out = {
|
|
20582
|
+
x: 0,
|
|
20583
|
+
y: 0
|
|
20584
|
+
};
|
|
20585
|
+
rt.globalTransMatrix.getInverse().transformPoint({
|
|
20586
|
+
x: x,
|
|
20587
|
+
y: y1
|
|
20588
|
+
}, out);
|
|
20589
|
+
const {
|
|
20590
|
+
left: left,
|
|
20591
|
+
top: top
|
|
20592
|
+
} = this.pluginService.stage.window.getBoundingClientRect();
|
|
20593
|
+
out.x += left, out.y += top, this.editModule.moveTo(out.x, out.y, rt, this.curCursorIdx, this.selectionStartCursorIdx);
|
|
20594
|
+
}
|
|
20595
|
+
setCursor(x, y1, y2) {
|
|
20596
|
+
this.editLine.setAttributes({
|
|
20597
|
+
points: [{
|
|
20598
|
+
x: x,
|
|
20599
|
+
y: y1
|
|
20600
|
+
}, {
|
|
20601
|
+
x: x,
|
|
20602
|
+
y: y2
|
|
20603
|
+
}]
|
|
20604
|
+
});
|
|
20605
|
+
}
|
|
20606
|
+
applyUpdate() {
|
|
20607
|
+
this.pluginService.stage.renderNextFrame();
|
|
20608
|
+
}
|
|
20609
|
+
deFocus(e) {
|
|
20610
|
+
e.target.detachShadow(), this.editLine && (this.editLine.parent.removeChild(this.editLine), this.editLine.release(), this.editLine = null, this.editBg.parent.removeChild(this.editBg), this.editBg.release(), this.editBg = null);
|
|
20611
|
+
}
|
|
20612
|
+
splitText(text) {
|
|
20613
|
+
return Array.from(text);
|
|
20614
|
+
}
|
|
20615
|
+
tryUpdateRichtext(richtext) {
|
|
20616
|
+
if (!richtext.getFrameCache().lines.every(line => line.paragraphs.every(item => !(item.text && isString$1(item.text) && this.splitText(item.text).length > 1)))) {
|
|
20617
|
+
const tc = [];
|
|
20618
|
+
richtext.attribute.textConfig.forEach(item => {
|
|
20619
|
+
const textList = this.splitText(item.text.toString());
|
|
20620
|
+
if (isString$1(item.text) && textList.length > 1) for (let i = 0; i < textList.length; i++) {
|
|
20621
|
+
const t = textList[i];
|
|
20622
|
+
tc.push(Object.assign(Object.assign({}, item), {
|
|
20623
|
+
text: t
|
|
20624
|
+
}));
|
|
20625
|
+
} else tc.push(item);
|
|
20626
|
+
}), richtext.doUpdateFrameCache(tc);
|
|
20627
|
+
}
|
|
20628
|
+
}
|
|
20629
|
+
onSelect() {}
|
|
20630
|
+
deactivate(context) {
|
|
20631
|
+
context.stage.off("pointermove", this.handleMove), context.stage.off("pointerdown", this.handlePointerDown), context.stage.off("pointerup", this.handlePointerUp), context.stage.off("pointerleave", this.handlePointerUp);
|
|
20632
|
+
}
|
|
20633
|
+
release() {
|
|
20634
|
+
this.editModule.release();
|
|
20635
|
+
}
|
|
20636
|
+
}
|
|
20637
|
+
|
|
20287
20638
|
class DefaultGraphicAllocate {
|
|
20288
20639
|
constructor() {
|
|
20289
20640
|
this.pools = [];
|
|
@@ -24530,7 +24881,7 @@
|
|
|
24530
24881
|
};
|
|
24531
24882
|
});
|
|
24532
24883
|
}
|
|
24533
|
-
|
|
24884
|
+
let BrowserEnvContribution = class extends exports.BaseEnvContribution {
|
|
24534
24885
|
constructor() {
|
|
24535
24886
|
super(), this.type = "browser", this.supportEvent = !0;
|
|
24536
24887
|
try {
|
|
@@ -24684,10 +25035,10 @@
|
|
|
24684
25035
|
};
|
|
24685
25036
|
}
|
|
24686
25037
|
};
|
|
24687
|
-
|
|
25038
|
+
BrowserEnvContribution = __decorate$U([injectable(), __metadata$J("design:paramtypes", [])], BrowserEnvContribution);
|
|
24688
25039
|
|
|
24689
25040
|
const browserEnvModule = new ContainerModule(bind => {
|
|
24690
|
-
browserEnvModule.isBrowserBound || (browserEnvModule.isBrowserBound = !0, bind(
|
|
25041
|
+
browserEnvModule.isBrowserBound || (browserEnvModule.isBrowserBound = !0, bind(BrowserEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(BrowserEnvContribution));
|
|
24691
25042
|
});
|
|
24692
25043
|
browserEnvModule.isBrowserBound = !1;
|
|
24693
25044
|
function loadBrowserEnv(container) {
|
|
@@ -25921,13 +26272,20 @@
|
|
|
25921
26272
|
} catch (err) {}
|
|
25922
26273
|
function makeUpCanvas$3(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, offscreen, pixelRatio) {
|
|
25923
26274
|
const dpr = null != pixelRatio ? pixelRatio : SystemInfo.pixelRatio;
|
|
25924
|
-
canvasIdLists.forEach((id, i) => {
|
|
26275
|
+
if (canvasIdLists.forEach((id, i) => {
|
|
25925
26276
|
let _canvas;
|
|
25926
26277
|
offscreen ? _canvas = lynx.createOffscreenCanvas() : (_canvas = ng ? lynx.createCanvasNG(id) : lynx.createCanvas(id), ng && _canvas.attachToCanvasView(id)), _canvas.width = domref.width * dpr, _canvas.height = domref.height * dpr;
|
|
25927
26278
|
const ctx = _canvas.getContext("2d"),
|
|
25928
26279
|
canvas = new CanvasWrapEnableWH(_canvas, ctx, dpr, domref.width, domref.height, id);
|
|
25929
|
-
canvasMap.set(id, canvas), i
|
|
25930
|
-
})
|
|
26280
|
+
canvasMap.set(id, canvas), i > freeCanvasIdx && freeCanvasList.push(canvas);
|
|
26281
|
+
}), !freeCanvasList.length && lynx.createOffscreenCanvas) {
|
|
26282
|
+
const _canvas = lynx.createOffscreenCanvas();
|
|
26283
|
+
_canvas.width = domref.width * dpr, _canvas.height = domref.height * dpr;
|
|
26284
|
+
const ctx = _canvas.getContext("2d"),
|
|
26285
|
+
id = Math.random().toString(),
|
|
26286
|
+
canvas = new CanvasWrapEnableWH(_canvas, ctx, dpr, domref.width, domref.height, id);
|
|
26287
|
+
canvasMap.set(id, canvas), freeCanvasList.push(canvas);
|
|
26288
|
+
}
|
|
25931
26289
|
}
|
|
25932
26290
|
function createImageElement(src) {
|
|
25933
26291
|
let isSvg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
@@ -28594,7 +28952,7 @@
|
|
|
28594
28952
|
|
|
28595
28953
|
const roughModule = _roughModule;
|
|
28596
28954
|
|
|
28597
|
-
const version = "0.19.
|
|
28955
|
+
const version = "0.19.13-alpha.1";
|
|
28598
28956
|
preLoadAllModule();
|
|
28599
28957
|
if (isBrowserEnv()) {
|
|
28600
28958
|
loadBrowserEnv(container);
|
|
@@ -28771,7 +29129,6 @@
|
|
|
28771
29129
|
exports.GroupFadeOut = GroupFadeOut;
|
|
28772
29130
|
exports.GroupRender = GroupRender;
|
|
28773
29131
|
exports.GroupRenderContribution = GroupRenderContribution;
|
|
28774
|
-
exports.HtmlAttributePlugin = HtmlAttributePlugin;
|
|
28775
29132
|
exports.IMAGE_NUMBER_TYPE = IMAGE_NUMBER_TYPE;
|
|
28776
29133
|
exports.Image = Image;
|
|
28777
29134
|
exports.ImageRender = ImageRender;
|
|
@@ -28834,7 +29191,6 @@
|
|
|
28834
29191
|
exports.RECT_NUMBER_TYPE = RECT_NUMBER_TYPE;
|
|
28835
29192
|
exports.RICHTEXT_NUMBER_TYPE = RICHTEXT_NUMBER_TYPE;
|
|
28836
29193
|
exports.RafBasedSTO = RafBasedSTO;
|
|
28837
|
-
exports.ReactAttributePlugin = ReactAttributePlugin;
|
|
28838
29194
|
exports.Rect = Rect;
|
|
28839
29195
|
exports.Rect3DRender = Rect3DRender;
|
|
28840
29196
|
exports.Rect3d = Rect3d;
|
|
@@ -28845,6 +29201,7 @@
|
|
|
28845
29201
|
exports.RenderService = RenderService;
|
|
28846
29202
|
exports.ResourceLoader = ResourceLoader;
|
|
28847
29203
|
exports.RichText = RichText;
|
|
29204
|
+
exports.RichTextEditPlugin = RichTextEditPlugin;
|
|
28848
29205
|
exports.RichTextRender = RichTextRender;
|
|
28849
29206
|
exports.RotateBySphereAnimate = RotateBySphereAnimate;
|
|
28850
29207
|
exports.SVG_ATTRIBUTE_MAP = SVG_ATTRIBUTE_MAP;
|
|
@@ -28944,7 +29301,6 @@
|
|
|
28944
29301
|
exports.createGlyph = createGlyph;
|
|
28945
29302
|
exports.createGroup = createGroup;
|
|
28946
29303
|
exports.createImage = createImage;
|
|
28947
|
-
exports.createImageElement = createImageElement$1;
|
|
28948
29304
|
exports.createLine = createLine;
|
|
28949
29305
|
exports.createMat4 = createMat4;
|
|
28950
29306
|
exports.createPath = createPath;
|