@visactor/vrender 0.19.13-alpha.1 → 0.19.13-beta.0
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 +23 -375
- package/dist/index.js +28 -378
- 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/dist/index.js
CHANGED
|
@@ -12920,10 +12920,10 @@
|
|
|
12920
12920
|
strokeOpacity: strokeOpacity
|
|
12921
12921
|
}, config);
|
|
12922
12922
|
}
|
|
12923
|
-
doUpdateFrameCache(
|
|
12923
|
+
doUpdateFrameCache() {
|
|
12924
12924
|
var _a;
|
|
12925
12925
|
const {
|
|
12926
|
-
textConfig
|
|
12926
|
+
textConfig = [],
|
|
12927
12927
|
maxWidth: maxWidth,
|
|
12928
12928
|
maxHeight: maxHeight,
|
|
12929
12929
|
width: width,
|
|
@@ -12937,8 +12937,7 @@
|
|
|
12937
12937
|
singleLine: singleLine,
|
|
12938
12938
|
disableAutoWrapLine: disableAutoWrapLine
|
|
12939
12939
|
} = this.attribute,
|
|
12940
|
-
paragraphs = []
|
|
12941
|
-
textConfig = null != tc ? tc : _tc;
|
|
12940
|
+
paragraphs = [];
|
|
12942
12941
|
for (let i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
|
|
12943
12942
|
const config = this.combinedStyleToCharacter(textConfig[i]),
|
|
12944
12943
|
iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
|
|
@@ -17071,10 +17070,10 @@
|
|
|
17071
17070
|
this.order = 1;
|
|
17072
17071
|
}
|
|
17073
17072
|
afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
17074
|
-
return
|
|
17073
|
+
return (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
|
|
17075
17074
|
}
|
|
17076
17075
|
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
17077
|
-
return
|
|
17076
|
+
return graphic.attribute.shadowRootIdx < 0 && this.drawItem(graphic, renderService, drawContext, drawContribution, params), !1;
|
|
17078
17077
|
}
|
|
17079
17078
|
drawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
17080
17079
|
if (!graphic.shadowRoot) return !1;
|
|
@@ -19406,6 +19405,7 @@
|
|
|
19406
19405
|
throw new Error("暂不支持");
|
|
19407
19406
|
}
|
|
19408
19407
|
createLayer(canvasId, layerMode) {
|
|
19408
|
+
if ("released" === this.releaseStatus) return;
|
|
19409
19409
|
const layer = this.layerService.createLayer(this, {
|
|
19410
19410
|
main: !1,
|
|
19411
19411
|
layerMode: layerMode,
|
|
@@ -19423,12 +19423,13 @@
|
|
|
19423
19423
|
return this.removeChild(this.findChildByUid(ILayerId));
|
|
19424
19424
|
}
|
|
19425
19425
|
tryInitInteractiveLayer() {
|
|
19426
|
-
this.supportInteractiveLayer && !this.interactiveLayer && (this.interactiveLayer = this.createLayer(), this.interactiveLayer.name = "_builtin_interactive", this.interactiveLayer.attribute.pickable = !1, this.nextFrameRenderLayerSet.add(this.interactiveLayer));
|
|
19426
|
+
"released" !== this.releaseStatus && this.supportInteractiveLayer && !this.interactiveLayer && (this.interactiveLayer = this.createLayer(), this.interactiveLayer.name = "_builtin_interactive", this.interactiveLayer.attribute.pickable = !1, this.nextFrameRenderLayerSet.add(this.interactiveLayer));
|
|
19427
19427
|
}
|
|
19428
19428
|
clearViewBox(color) {
|
|
19429
19429
|
this.window.clearViewBox(color);
|
|
19430
19430
|
}
|
|
19431
19431
|
render(layers, params) {
|
|
19432
|
+
if ("released" === this.releaseStatus) return;
|
|
19432
19433
|
this.ticker.start(), this.timeline.resume();
|
|
19433
19434
|
const state = this.state;
|
|
19434
19435
|
this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
|
|
@@ -19452,6 +19453,7 @@
|
|
|
19452
19453
|
}));
|
|
19453
19454
|
}
|
|
19454
19455
|
_doRenderInThisFrame() {
|
|
19456
|
+
if ("released" === this.releaseStatus) return;
|
|
19455
19457
|
this.timeline.resume(), this.ticker.start();
|
|
19456
19458
|
const state = this.state;
|
|
19457
19459
|
this.state = "rendering", this.layerService.prepareStageLayer(this), this.nextFrameRenderLayerSet.size && !this._skipRender && (this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {}), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
|
|
@@ -19487,18 +19489,18 @@
|
|
|
19487
19489
|
}
|
|
19488
19490
|
resize(w, h) {
|
|
19489
19491
|
let rerender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
19490
|
-
this.window.hasSubView() || this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h), this.window.resize(w, h), this.forEachChildren(c => {
|
|
19492
|
+
"released" !== this.releaseStatus && (this.window.hasSubView() || this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h), this.window.resize(w, h), this.forEachChildren(c => {
|
|
19491
19493
|
c.resize(w, h);
|
|
19492
|
-
}), this.camera && this.option3d && this.set3dOptions(this.option3d), rerender && this.render();
|
|
19494
|
+
}), this.camera && this.option3d && this.set3dOptions(this.option3d), rerender && this.render());
|
|
19493
19495
|
}
|
|
19494
19496
|
resizeView(w, h) {
|
|
19495
19497
|
let rerender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
19496
|
-
this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h), this.forEachChildren(c => {
|
|
19498
|
+
"released" !== this.releaseStatus && (this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h), this.forEachChildren(c => {
|
|
19497
19499
|
c.resizeView(w, h);
|
|
19498
19500
|
}), this.camera && (this.camera.params = Object.assign(Object.assign({}, this.camera.params), {
|
|
19499
19501
|
right: this.width,
|
|
19500
19502
|
bottom: this.height
|
|
19501
|
-
})), rerender && this.render();
|
|
19503
|
+
})), rerender && this.render());
|
|
19502
19504
|
}
|
|
19503
19505
|
setViewBox(x, y, w, h, rerender) {
|
|
19504
19506
|
let isRerender = !0;
|
|
@@ -19519,6 +19521,7 @@
|
|
|
19519
19521
|
throw new Error("暂不支持");
|
|
19520
19522
|
}
|
|
19521
19523
|
pick(x, y) {
|
|
19524
|
+
if ("released" === this.releaseStatus) return;
|
|
19522
19525
|
this.pickerService || (this.pickerService = container.get(PickerService));
|
|
19523
19526
|
const result = this.pickerService.pick(this.children, new Point(x, y), {
|
|
19524
19527
|
bounds: this.AABBBounds
|
|
@@ -19538,13 +19541,13 @@
|
|
|
19538
19541
|
}
|
|
19539
19542
|
setStage(stage) {}
|
|
19540
19543
|
dirty(b, matrix) {
|
|
19541
|
-
matrix && b.transformWithMatrix(matrix), this.dirtyBounds.empty() && this.dirtyBounds.setValue(b.x1, b.y1, b.x2, b.y2), this.dirtyBounds.union(b);
|
|
19544
|
+
"released" !== this.releaseStatus && (matrix && b.transformWithMatrix(matrix), this.dirtyBounds.empty() && this.dirtyBounds.setValue(b.x1, b.y1, b.x2, b.y2), this.dirtyBounds.union(b));
|
|
19542
19545
|
}
|
|
19543
19546
|
getLayer(name) {
|
|
19544
19547
|
return this.children.filter(layer => layer.name === name)[0];
|
|
19545
19548
|
}
|
|
19546
19549
|
renderTo(window) {
|
|
19547
|
-
this.forEachChildren((layer, i) => {
|
|
19550
|
+
"released" !== this.releaseStatus && this.forEachChildren((layer, i) => {
|
|
19548
19551
|
layer.drawTo(window, {
|
|
19549
19552
|
renderService: this.renderService,
|
|
19550
19553
|
viewBox: window.getViewBox(),
|
|
@@ -19557,6 +19560,7 @@
|
|
|
19557
19560
|
}
|
|
19558
19561
|
renderToNewWindow() {
|
|
19559
19562
|
let viewBox = arguments.length > 1 ? arguments[1] : undefined;
|
|
19563
|
+
if ("released" === this.releaseStatus) return;
|
|
19560
19564
|
const window = container.get(VWindow),
|
|
19561
19565
|
x1 = viewBox ? -viewBox.x1 : 0,
|
|
19562
19566
|
y1 = viewBox ? -viewBox.y1 : 0,
|
|
@@ -19582,6 +19586,7 @@
|
|
|
19582
19586
|
toCanvas() {
|
|
19583
19587
|
let fullImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
19584
19588
|
let viewBox = arguments.length > 1 ? arguments[1] : undefined;
|
|
19589
|
+
if ("released" === this.releaseStatus) return;
|
|
19585
19590
|
const c = this.renderToNewWindow(fullImage, viewBox).getNativeHandler();
|
|
19586
19591
|
return c.nativeCanvas ? c.nativeCanvas : null;
|
|
19587
19592
|
}
|
|
@@ -20285,356 +20290,6 @@
|
|
|
20285
20290
|
return points = simplifyDouglasPeucker(points = highestQuality ? points : simplifyRadialDist(points, sqTolerance), sqTolerance);
|
|
20286
20291
|
}
|
|
20287
20292
|
|
|
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
|
-
|
|
20638
20293
|
class DefaultGraphicAllocate {
|
|
20639
20294
|
constructor() {
|
|
20640
20295
|
this.pools = [];
|
|
@@ -24881,7 +24536,7 @@
|
|
|
24881
24536
|
};
|
|
24882
24537
|
});
|
|
24883
24538
|
}
|
|
24884
|
-
|
|
24539
|
+
exports.BrowserEnvContribution = class BrowserEnvContribution extends exports.BaseEnvContribution {
|
|
24885
24540
|
constructor() {
|
|
24886
24541
|
super(), this.type = "browser", this.supportEvent = !0;
|
|
24887
24542
|
try {
|
|
@@ -25035,10 +24690,10 @@
|
|
|
25035
24690
|
};
|
|
25036
24691
|
}
|
|
25037
24692
|
};
|
|
25038
|
-
BrowserEnvContribution = __decorate$U([injectable(), __metadata$J("design:paramtypes", [])], BrowserEnvContribution);
|
|
24693
|
+
exports.BrowserEnvContribution = __decorate$U([injectable(), __metadata$J("design:paramtypes", [])], exports.BrowserEnvContribution);
|
|
25039
24694
|
|
|
25040
24695
|
const browserEnvModule = new ContainerModule(bind => {
|
|
25041
|
-
browserEnvModule.isBrowserBound || (browserEnvModule.isBrowserBound = !0, bind(BrowserEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(BrowserEnvContribution));
|
|
24696
|
+
browserEnvModule.isBrowserBound || (browserEnvModule.isBrowserBound = !0, bind(exports.BrowserEnvContribution).toSelf().inSingletonScope(), bind(EnvContribution).toService(exports.BrowserEnvContribution));
|
|
25042
24697
|
});
|
|
25043
24698
|
browserEnvModule.isBrowserBound = !1;
|
|
25044
24699
|
function loadBrowserEnv(container) {
|
|
@@ -26272,20 +25927,13 @@
|
|
|
26272
25927
|
} catch (err) {}
|
|
26273
25928
|
function makeUpCanvas$3(domref, canvasIdLists, canvasMap, freeCanvasIdx, freeCanvasList, offscreen, pixelRatio) {
|
|
26274
25929
|
const dpr = null != pixelRatio ? pixelRatio : SystemInfo.pixelRatio;
|
|
26275
|
-
|
|
25930
|
+
canvasIdLists.forEach((id, i) => {
|
|
26276
25931
|
let _canvas;
|
|
26277
25932
|
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;
|
|
26278
25933
|
const ctx = _canvas.getContext("2d"),
|
|
26279
25934
|
canvas = new CanvasWrapEnableWH(_canvas, ctx, dpr, domref.width, domref.height, id);
|
|
26280
|
-
canvasMap.set(id, canvas), i
|
|
26281
|
-
})
|
|
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
|
-
}
|
|
25935
|
+
canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
|
|
25936
|
+
});
|
|
26289
25937
|
}
|
|
26290
25938
|
function createImageElement(src) {
|
|
26291
25939
|
let isSvg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
@@ -28952,7 +28600,7 @@
|
|
|
28952
28600
|
|
|
28953
28601
|
const roughModule = _roughModule;
|
|
28954
28602
|
|
|
28955
|
-
const version = "0.19.13-
|
|
28603
|
+
const version = "0.19.13-beta.0";
|
|
28956
28604
|
preLoadAllModule();
|
|
28957
28605
|
if (isBrowserEnv()) {
|
|
28958
28606
|
loadBrowserEnv(container);
|
|
@@ -29129,6 +28777,7 @@
|
|
|
29129
28777
|
exports.GroupFadeOut = GroupFadeOut;
|
|
29130
28778
|
exports.GroupRender = GroupRender;
|
|
29131
28779
|
exports.GroupRenderContribution = GroupRenderContribution;
|
|
28780
|
+
exports.HtmlAttributePlugin = HtmlAttributePlugin;
|
|
29132
28781
|
exports.IMAGE_NUMBER_TYPE = IMAGE_NUMBER_TYPE;
|
|
29133
28782
|
exports.Image = Image;
|
|
29134
28783
|
exports.ImageRender = ImageRender;
|
|
@@ -29191,6 +28840,7 @@
|
|
|
29191
28840
|
exports.RECT_NUMBER_TYPE = RECT_NUMBER_TYPE;
|
|
29192
28841
|
exports.RICHTEXT_NUMBER_TYPE = RICHTEXT_NUMBER_TYPE;
|
|
29193
28842
|
exports.RafBasedSTO = RafBasedSTO;
|
|
28843
|
+
exports.ReactAttributePlugin = ReactAttributePlugin;
|
|
29194
28844
|
exports.Rect = Rect;
|
|
29195
28845
|
exports.Rect3DRender = Rect3DRender;
|
|
29196
28846
|
exports.Rect3d = Rect3d;
|
|
@@ -29201,7 +28851,6 @@
|
|
|
29201
28851
|
exports.RenderService = RenderService;
|
|
29202
28852
|
exports.ResourceLoader = ResourceLoader;
|
|
29203
28853
|
exports.RichText = RichText;
|
|
29204
|
-
exports.RichTextEditPlugin = RichTextEditPlugin;
|
|
29205
28854
|
exports.RichTextRender = RichTextRender;
|
|
29206
28855
|
exports.RotateBySphereAnimate = RotateBySphereAnimate;
|
|
29207
28856
|
exports.SVG_ATTRIBUTE_MAP = SVG_ATTRIBUTE_MAP;
|
|
@@ -29301,6 +28950,7 @@
|
|
|
29301
28950
|
exports.createGlyph = createGlyph;
|
|
29302
28951
|
exports.createGroup = createGroup;
|
|
29303
28952
|
exports.createImage = createImage;
|
|
28953
|
+
exports.createImageElement = createImageElement$1;
|
|
29304
28954
|
exports.createLine = createLine;
|
|
29305
28955
|
exports.createMat4 = createMat4;
|
|
29306
28956
|
exports.createPath = createPath;
|