@hailin-zheng/editor-core 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controls/ScrollView.d.ts +1 -0
- package/controls/ViewPaint.d.ts +2 -2
- package/index-cjs.js +153 -61
- package/index-cjs.js.map +1 -1
- package/index.js +153 -62
- package/index.js.map +1 -1
- package/med_editor/framework/element-define.d.ts +3 -0
- package/med_editor/framework/event-subject.d.ts +3 -1
- package/med_editor/framework/impl/data-element/data-element-base-impl.d.ts +5 -0
- package/med_editor/framework/impl/data-element/data-element-group-impl.d.ts +1 -2
- package/med_editor/framework/paragraph-arrange.d.ts +1 -0
- package/med_editor/framework/render-context.d.ts +3 -2
- package/med_editor/framework/render-define.d.ts +1 -0
- package/med_editor/texteditor.d.ts +3 -1
- package/package.json +1 -1
package/controls/ScrollView.d.ts
CHANGED
@@ -18,6 +18,7 @@ export declare class ScrollView extends NodeItems {
|
|
18
18
|
get scrollY(): number;
|
19
19
|
set scrollY(value: number);
|
20
20
|
constructor();
|
21
|
+
scrollTo(x: number, y: number): void;
|
21
22
|
measureOverride(e: IMeasureEvent, availableSize: Size): Size;
|
22
23
|
getRenderItems(): Array<NodeCore>;
|
23
24
|
protected arrangeOverride(e: IArrangeEvent, finalSize: Size): Size;
|
package/controls/ViewPaint.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
import { TextProps } from "../med_editor/framework/element-props";
|
2
2
|
import { Position, Rect } from "../med_editor/framework/element-define";
|
3
3
|
import { ISetCanvasPageProps, TextUnits } from "../med_editor/framework/render-context";
|
4
|
-
import {
|
4
|
+
import { OnceSubject } from "../med_editor/framework/event-subject";
|
5
5
|
export declare class ViewPaint {
|
6
6
|
ctx: CanvasRenderingContext2D;
|
7
|
-
onRenderCompleted:
|
7
|
+
onRenderCompleted: OnceSubject<ViewPaint>;
|
8
8
|
pageSetting: ISetCanvasPageProps;
|
9
9
|
pageRect: Rect;
|
10
10
|
constructor(ctx: CanvasRenderingContext2D);
|
package/index-cjs.js
CHANGED
@@ -394,6 +394,7 @@ class BlockContentRenderObject extends BranchRenderObject {
|
|
394
394
|
}
|
395
395
|
}
|
396
396
|
class InlineGroupRenderObject extends BranchRenderObject {
|
397
|
+
paintPos;
|
397
398
|
}
|
398
399
|
/**
|
399
400
|
* 包含块级渲染元素的容器元素,例如body、table-cell等
|
@@ -935,8 +936,10 @@ class Subject$1 extends EventSourceCore$1 {
|
|
935
936
|
this.addSub(sub);
|
936
937
|
return sub;
|
937
938
|
}
|
938
|
-
|
939
|
-
|
939
|
+
}
|
940
|
+
class OnceSubject extends Subject$1 {
|
941
|
+
subscribe(listener) {
|
942
|
+
const sub = super.subscribe(listener);
|
940
943
|
sub.once = true;
|
941
944
|
return sub;
|
942
945
|
}
|
@@ -1323,13 +1326,23 @@ class BranchElement extends Element {
|
|
1323
1326
|
}
|
1324
1327
|
else {
|
1325
1328
|
this.modifyFlag = exports.ModifyFlag.Modify;
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
+
clearChildrenRenderCache(this);
|
1330
|
+
// for (let i = 0; i < this.length; i++) {
|
1331
|
+
// this.getChild(i).pubOnChange('to-child')
|
1332
|
+
// }
|
1329
1333
|
}
|
1330
1334
|
this._onChangeEvent.next();
|
1331
1335
|
}
|
1332
1336
|
}
|
1337
|
+
function clearChildrenRenderCache(ele) {
|
1338
|
+
for (let i = 0; i < ele.length; i++) {
|
1339
|
+
const curr = ele.getChild(i);
|
1340
|
+
curr.cacheRender = null;
|
1341
|
+
if (curr instanceof BranchElement) {
|
1342
|
+
clearChildrenRenderCache(curr);
|
1343
|
+
}
|
1344
|
+
}
|
1345
|
+
}
|
1333
1346
|
/**
|
1334
1347
|
* 行内编组元素
|
1335
1348
|
*/
|
@@ -1443,6 +1456,8 @@ class ViewOptions {
|
|
1443
1456
|
defaultColor = "rgb(0,0,0)";
|
1444
1457
|
selectionOverlaysColor = 'rgb(131,175,155,0.5)';
|
1445
1458
|
dataEleOverlaysColor = 'rgb(131,175,155,0.5)';
|
1459
|
+
dataEleFocusedBgColor = 'rgb(131,175,155,0.8)';
|
1460
|
+
dataEleErrorBgColor = '#ff4d4f';
|
1446
1461
|
dataEleReadOnlyOverlayColor = '#d9d9d9';
|
1447
1462
|
dataEleOutlineColor = 'rgb(131,175,155,0.7)';
|
1448
1463
|
viewBackcolor = 'rgb(230,230,230)';
|
@@ -1474,6 +1489,8 @@ class ViewOptions {
|
|
1474
1489
|
enableDyExpression = false;
|
1475
1490
|
//是否显示标尺
|
1476
1491
|
showRule = true;
|
1492
|
+
//是否开启数据元输入验证功能
|
1493
|
+
enableDataEleInputValidate = false;
|
1477
1494
|
//整页模式,不分页
|
1478
1495
|
_fullPageView = false;
|
1479
1496
|
get fullPageView() {
|
@@ -3678,8 +3695,12 @@ class InlineGroupInputElement extends InlineGroupElement {
|
|
3678
3695
|
}
|
3679
3696
|
}
|
3680
3697
|
class DataElementInlineGroup extends InlineGroupInputElement {
|
3698
|
+
errorTip;
|
3681
3699
|
constructor(type) {
|
3682
3700
|
super(type);
|
3701
|
+
this.onChangeSubject.subscribe(() => {
|
3702
|
+
this.onChangedValidate();
|
3703
|
+
});
|
3683
3704
|
this.addEvent('ElementMousemove', (evt) => {
|
3684
3705
|
this.isMouseenter = true;
|
3685
3706
|
this.refreshView();
|
@@ -3743,6 +3764,21 @@ class DataElementInlineGroup extends InlineGroupInputElement {
|
|
3743
3764
|
this.expressFn = new Function();
|
3744
3765
|
}
|
3745
3766
|
}
|
3767
|
+
/**
|
3768
|
+
* 数据元发生更改后,进行数据验证
|
3769
|
+
*/
|
3770
|
+
onChangedValidate() {
|
3771
|
+
this.errorTip = '';
|
3772
|
+
const options = getCurrOptions(this);
|
3773
|
+
if (!options || !options.enableDataEleInputValidate) {
|
3774
|
+
return;
|
3775
|
+
}
|
3776
|
+
this.errorTip = this.validate();
|
3777
|
+
}
|
3778
|
+
}
|
3779
|
+
function getCurrOptions(ele) {
|
3780
|
+
const doc = ElementUtil.getParent(ele, item => item.type === 'doc');
|
3781
|
+
return doc?.viewOptions;
|
3746
3782
|
}
|
3747
3783
|
class DataElementRenderObject extends InlineGroupRenderObject {
|
3748
3784
|
render(e) {
|
@@ -3753,9 +3789,18 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
3753
3789
|
}
|
3754
3790
|
render.contentContext.tran(() => {
|
3755
3791
|
//绘制数据元区域底色
|
3792
|
+
let bgColor = '';
|
3756
3793
|
if (this.element.isMouseenter) {
|
3757
|
-
|
3758
|
-
|
3794
|
+
bgColor = this.element.props.editable ? viewOptions.dataEleOverlaysColor : viewOptions.dataEleReadOnlyOverlayColor;
|
3795
|
+
}
|
3796
|
+
if (this.element.isFocused) {
|
3797
|
+
bgColor = e.docCtx.viewOptions.dataEleFocusedBgColor;
|
3798
|
+
}
|
3799
|
+
if (this.element.errorTip) {
|
3800
|
+
bgColor = viewOptions.dataEleErrorBgColor;
|
3801
|
+
}
|
3802
|
+
if (bgColor) {
|
3803
|
+
render.overlaysContext.fillRect(position.x, position.y - 2, this.rect.width, this.rect.height + 4, bgColor);
|
3759
3804
|
}
|
3760
3805
|
if (this.element.props.secretBrowse && viewOptions.secretBrowse) {
|
3761
3806
|
render.contentContext.ctx.filter = "blur(10px)";
|
@@ -3777,23 +3822,25 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
3777
3822
|
* @private
|
3778
3823
|
*/
|
3779
3824
|
drawCaption(e) {
|
3780
|
-
|
3781
|
-
|
3782
|
-
|
3783
|
-
|
3784
|
-
|
3785
|
-
|
3825
|
+
e.render.onRenderCompleted.subscribe(() => {
|
3826
|
+
const { render, position, docCtx: { viewOptions } } = e;
|
3827
|
+
//获取到焦点时,绘制数据元标题
|
3828
|
+
if (render.drawMode === 'view' && this.element.isFocused && this.element.paintRenders.indexOf(this) === 0) {
|
3829
|
+
const { caption } = this.element.props;
|
3830
|
+
if (!caption) {
|
3831
|
+
return;
|
3832
|
+
}
|
3833
|
+
const textProps = new TextProps();
|
3834
|
+
textProps.fontSize = 16;
|
3835
|
+
textProps.fontName = viewOptions.defaultFontName;
|
3836
|
+
textProps.color = '#fff';
|
3837
|
+
const titleWidth = render.contentContext.measureText(caption, textProps).width;
|
3838
|
+
const x = position.x;
|
3839
|
+
const y = position.y - 20;
|
3840
|
+
render.contentContext.fillRect(x, y, titleWidth + 10, 20, 'blue');
|
3841
|
+
render.contentContext.drawText(caption, textProps, x + 5, y, titleWidth, 20);
|
3786
3842
|
}
|
3787
|
-
|
3788
|
-
textProps.fontSize = 16;
|
3789
|
-
textProps.fontName = viewOptions.defaultFontName;
|
3790
|
-
textProps.color = '#fff';
|
3791
|
-
const titleWidth = render.contentContext.measureText(caption, textProps).width;
|
3792
|
-
const x = position.x;
|
3793
|
-
const y = position.y - 20;
|
3794
|
-
render.contentContext.fillRect(x, y, titleWidth + 10, 20, 'blue');
|
3795
|
-
render.contentContext.drawText(caption, textProps, x + 5, y, titleWidth, 20);
|
3796
|
-
}
|
3843
|
+
});
|
3797
3844
|
}
|
3798
3845
|
}
|
3799
3846
|
const validateDataEle = (ele) => {
|
@@ -4578,6 +4625,9 @@ class TableCellElement extends BlockContainerElement {
|
|
4578
4625
|
throw new Error('row is null');
|
4579
4626
|
}
|
4580
4627
|
const table = row.parent;
|
4628
|
+
if (!table) {
|
4629
|
+
debugger;
|
4630
|
+
}
|
4581
4631
|
const cellIndex = row.getChildIndex(this);
|
4582
4632
|
let cellWidth = table.getCellWidth(cellIndex);
|
4583
4633
|
const cellOffset = table.getCellOffsetX(cellIndex);
|
@@ -7623,8 +7673,7 @@ class RenderContext {
|
|
7623
7673
|
drawMode = 'view';
|
7624
7674
|
contentOffCanvas;
|
7625
7675
|
overlayOffCanvas;
|
7626
|
-
|
7627
|
-
onRenderCompleted = new Subject$1();
|
7676
|
+
onRenderCompleted = new OnceSubject();
|
7628
7677
|
constructor(mainContext) {
|
7629
7678
|
this.mainContext = mainContext;
|
7630
7679
|
}
|
@@ -7646,7 +7695,6 @@ class RenderContext {
|
|
7646
7695
|
this.pageRect = { x: 0, y: 0, width: pageSetting.width, height: pageSetting.height };
|
7647
7696
|
ElementUtil.setCanvasProps(this.contentOffCanvas, this.contentContext.ctx, pageSetting);
|
7648
7697
|
ElementUtil.setCanvasProps(this.overlayOffCanvas, this.overlaysContext.ctx, pageSetting);
|
7649
|
-
//ElementUtil.setCanvasProps(this.mainContext.ctx.canvas, this.mainContext.ctx, pageSetting)
|
7650
7698
|
}
|
7651
7699
|
clear() {
|
7652
7700
|
this.contentContext.clear();
|
@@ -8685,7 +8733,7 @@ class DataElementDate extends DataElementInlineGroup {
|
|
8685
8733
|
this.props.valueTextProps.clone(valueText.props);
|
8686
8734
|
valueText.text = formatStr;
|
8687
8735
|
this.addChild(valueText, this.length - 1);
|
8688
|
-
|
8736
|
+
this.onChangedValidate();
|
8689
8737
|
}
|
8690
8738
|
getValue() {
|
8691
8739
|
return ElementSerialize.serializeString(this);
|
@@ -8775,9 +8823,9 @@ class DataElementGroupElement extends InlineGroupInputElement {
|
|
8775
8823
|
}
|
8776
8824
|
}
|
8777
8825
|
class DataElementGroupRenderObject extends InlineGroupRenderObject {
|
8778
|
-
paintPos;
|
8779
8826
|
render(e) {
|
8780
8827
|
this.paintPos = e.position;
|
8828
|
+
e.render.onRenderCompleted.subscribe(() => { this.paintDecorate(e); });
|
8781
8829
|
}
|
8782
8830
|
getCurrentParaGroupRenders() {
|
8783
8831
|
const renders = [];
|
@@ -8790,7 +8838,7 @@ class DataElementGroupRenderObject extends InlineGroupRenderObject {
|
|
8790
8838
|
}
|
8791
8839
|
return renders;
|
8792
8840
|
}
|
8793
|
-
|
8841
|
+
paintDecorate(e) {
|
8794
8842
|
const { render, docCtx: { viewOptions } } = e;
|
8795
8843
|
const canPaint = this.element.isMouseenter || this.element.isFocused;
|
8796
8844
|
if (canPaint && this.element.paintRenders.indexOf(this) === 0) {
|
@@ -9051,6 +9099,7 @@ class DataElementList extends DataElementInlineGroup {
|
|
9051
9099
|
this.addChild(valueText, this.length - 1);
|
9052
9100
|
}
|
9053
9101
|
}
|
9102
|
+
this.onChangedValidate();
|
9054
9103
|
}
|
9055
9104
|
getValue() {
|
9056
9105
|
const values = ElementSerialize.serializeString(this);
|
@@ -9144,6 +9193,7 @@ class DataElementText extends DataElementInlineGroup {
|
|
9144
9193
|
valueText.text = val + '';
|
9145
9194
|
this.addChild(valueText, this.length - 1);
|
9146
9195
|
}
|
9196
|
+
this.onChangedValidate();
|
9147
9197
|
}
|
9148
9198
|
getValue() {
|
9149
9199
|
return ElementSerialize.serializeString(this, { all: false });
|
@@ -10980,8 +11030,6 @@ class ElementPaint {
|
|
10980
11030
|
}
|
10981
11031
|
paintPagePos;
|
10982
11032
|
drawPages(docContainer, selectedSets) {
|
10983
|
-
// this.rePaint = rePaint;
|
10984
|
-
//this.measureCommContainer = measureCommContainer;
|
10985
11033
|
this.selectedSets = selectedSets;
|
10986
11034
|
const pageCount = docContainer.length;
|
10987
11035
|
const containerPos = { x: docContainer.rect.x - this.viewOptions.pageOffset.x, y: docContainer.rect.y - this.viewOptions.pageOffset.y };
|
@@ -11007,13 +11055,13 @@ class ElementPaint {
|
|
11007
11055
|
});
|
11008
11056
|
nextRenderFn();
|
11009
11057
|
const { scale, viewSettings: { width, height } } = this.viewOptions;
|
11058
|
+
while (this.renderCtx.onRenderCompleted.subs.length > 0) {
|
11059
|
+
this.renderCtx.onRenderCompleted.next();
|
11060
|
+
}
|
11010
11061
|
this.renderCtx.commit({ width, height, scale }, this.viewOptions.pageOffset);
|
11011
11062
|
}
|
11012
11063
|
drawRenderObject(renderObject, parent, parentInViewPort = false) {
|
11013
11064
|
const element = renderObject.element;
|
11014
|
-
// if (this.rePaint && element) {
|
11015
|
-
// //element.paintRenders.push(renderObject);
|
11016
|
-
// }
|
11017
11065
|
const { x: rx, y: ry, width: rw, height: rh } = renderObject.rect;
|
11018
11066
|
const currPosition = { x: rx + parent.x, y: ry + parent.y };
|
11019
11067
|
//判断当前绘制元素是否在视窗内
|
@@ -11053,18 +11101,6 @@ class ElementPaint {
|
|
11053
11101
|
};
|
11054
11102
|
renderObject.render(renderData);
|
11055
11103
|
}
|
11056
|
-
// //审阅信息
|
11057
|
-
// if (this.viewOptions.showReviewWindow && element && element.type === 'comm') {
|
11058
|
-
// const commElement = element as CommentElement;
|
11059
|
-
// if (commElement.props.markType === 'start') {
|
11060
|
-
// //获取当前绘制元素相对于当前页的坐标
|
11061
|
-
// this.paintCommMap.push({
|
11062
|
-
// ele: commElement,
|
11063
|
-
// render: renderObject,
|
11064
|
-
// pos: { x: currPosition.x - this.paintPagePos.x, y: currPosition.y - this.paintPagePos.y }
|
11065
|
-
// });
|
11066
|
-
// }
|
11067
|
-
// }
|
11068
11104
|
}
|
11069
11105
|
//处理选中拖蓝
|
11070
11106
|
if (inViewPort && this.selectedSets.has(element)) {
|
@@ -11500,6 +11536,7 @@ class EditorContext {
|
|
11500
11536
|
this.clearPrevDocCb?.();
|
11501
11537
|
//this.ele_types_handlers.length = 0;
|
11502
11538
|
this.imageLoader.clear();
|
11539
|
+
this._document = null;
|
11503
11540
|
}
|
11504
11541
|
/**
|
11505
11542
|
* 切换行打印模式
|
@@ -11879,6 +11916,8 @@ class DynamicContextParser {
|
|
11879
11916
|
TableData(tableId, startRow, startCol, endRow, endCol) {
|
11880
11917
|
const tb = this.doc.treeFind(item => item instanceof TableElement && item.props.id === tableId);
|
11881
11918
|
const res = [];
|
11919
|
+
startRow = startRow < 0 ? tb.length + startRow : startRow;
|
11920
|
+
startCol = startCol < 0 ? tb.length + startCol : startCol;
|
11882
11921
|
endRow = endRow < 0 ? tb.length + endRow : endRow;
|
11883
11922
|
endCol = endCol < 0 ? tb.length + endCol : endCol;
|
11884
11923
|
for (let i = startRow; i <= endRow; i++) {
|
@@ -12256,8 +12295,15 @@ class ParagraphMeasure {
|
|
12256
12295
|
}
|
12257
12296
|
}
|
12258
12297
|
}
|
12259
|
-
|
12260
|
-
|
12298
|
+
this.arrangeInlineItems(data, ele.getChild(i));
|
12299
|
+
}
|
12300
|
+
}
|
12301
|
+
arrangeInlineItems(parentLine, ele) {
|
12302
|
+
if (ele instanceof InlineGroupElement) {
|
12303
|
+
this.arrangeInlineGroupElement(parentLine, ele);
|
12304
|
+
}
|
12305
|
+
else {
|
12306
|
+
this.arrange(parentLine, ele);
|
12261
12307
|
}
|
12262
12308
|
}
|
12263
12309
|
arrangeLeafElement(parentLine, ele) {
|
@@ -12634,7 +12680,9 @@ class DocumentArrange {
|
|
12634
12680
|
continue;
|
12635
12681
|
}
|
12636
12682
|
if (Array.isArray(childRender)) {
|
12637
|
-
|
12683
|
+
if (childRender.length > 1) {
|
12684
|
+
element.cacheRender = null;
|
12685
|
+
}
|
12638
12686
|
for (let j = 0; j < childRender.length; j++) {
|
12639
12687
|
if (j > 0) {
|
12640
12688
|
render = this.createRenderObject(element);
|
@@ -18306,7 +18354,6 @@ function getCurrentActiveAppContext() {
|
|
18306
18354
|
function setCurrentActiveAppContext(ctx) {
|
18307
18355
|
currentActiveAppContext = ctx;
|
18308
18356
|
}
|
18309
|
-
let taskId;
|
18310
18357
|
function renderApp(root, renderCtx, nodeEvent) {
|
18311
18358
|
window['root'] = root;
|
18312
18359
|
// const nodeEvent = new NodeEvent(root, renderCtx.mainContext.ctx.canvas);
|
@@ -18316,15 +18363,13 @@ function renderApp(root, renderCtx, nodeEvent) {
|
|
18316
18363
|
return;
|
18317
18364
|
}
|
18318
18365
|
delayTask = true;
|
18319
|
-
|
18320
|
-
console.log(taskId + "正在运行中");
|
18366
|
+
setTimeout(() => {
|
18321
18367
|
currentActiveAppContext = { root, render: flushTask };
|
18322
18368
|
delayTask = false;
|
18323
18369
|
root.clearPopNodes();
|
18324
18370
|
prepareRender(root, renderCtx, nodeEvent.appState);
|
18325
18371
|
updateCursor(nodeEvent, renderCtx);
|
18326
18372
|
currentActiveAppContext = null;
|
18327
|
-
console.log(taskId + "运行完成");
|
18328
18373
|
}, 16);
|
18329
18374
|
};
|
18330
18375
|
flushTask();
|
@@ -19265,7 +19310,7 @@ function invokeNodeEvent(node, event, name, useCapture) {
|
|
19265
19310
|
|
19266
19311
|
class ViewPaint {
|
19267
19312
|
ctx;
|
19268
|
-
onRenderCompleted = new
|
19313
|
+
onRenderCompleted = new OnceSubject();
|
19269
19314
|
pageSetting;
|
19270
19315
|
pageRect;
|
19271
19316
|
constructor(ctx) {
|
@@ -20028,7 +20073,7 @@ class MenuContainer extends NodeItems {
|
|
20028
20073
|
}
|
20029
20074
|
preRender(e) {
|
20030
20075
|
const { render, renderPos, next } = e;
|
20031
|
-
e.render.onRenderCompleted.
|
20076
|
+
e.render.onRenderCompleted.subscribe((render) => {
|
20032
20077
|
e.appState.surface.registerPopNode(this);
|
20033
20078
|
const parentPos = { x: renderPos.x - this.finalRect.x, y: renderPos.y - this.finalRect.y };
|
20034
20079
|
render.tran(() => {
|
@@ -20102,11 +20147,31 @@ class ScrollView extends NodeItems {
|
|
20102
20147
|
});
|
20103
20148
|
this.addEventListener('wheel', evt => {
|
20104
20149
|
const { deltaY, deltaX } = evt;
|
20105
|
-
console.log(`deltaX:${deltaX},deltaY:${deltaY}`);
|
20106
20150
|
this.horBar.updateScrollByCurrent(deltaX / 10, deltaY / 10);
|
20107
20151
|
this.verBar.updateScrollByCurrent(deltaX / 10, deltaY / 10);
|
20108
20152
|
});
|
20109
20153
|
}
|
20154
|
+
scrollTo(x, y) {
|
20155
|
+
if (!this.content.finalRect || !this.finalRect) {
|
20156
|
+
return;
|
20157
|
+
}
|
20158
|
+
if (y > this.content.finalRect.height) {
|
20159
|
+
y = this.content.finalRect.height;
|
20160
|
+
}
|
20161
|
+
if (x > this.content.finalRect.width) {
|
20162
|
+
x = this.content.finalRect.width;
|
20163
|
+
}
|
20164
|
+
let scrollX = x - this.finalRect.width;
|
20165
|
+
let scrollY = y - this.finalRect.height;
|
20166
|
+
scrollX = scrollX < 0 ? 0 : scrollX;
|
20167
|
+
scrollY = scrollY < 0 ? 0 : scrollY;
|
20168
|
+
this.scrollX = scrollX;
|
20169
|
+
this.scrollY = scrollY;
|
20170
|
+
this.onScrollEvent.next({
|
20171
|
+
x: this.scrollX,
|
20172
|
+
y: this.scrollY
|
20173
|
+
});
|
20174
|
+
}
|
20110
20175
|
measureOverride(e, availableSize) {
|
20111
20176
|
const measureSize = availableSize;
|
20112
20177
|
this.content.measure(e, measureSize);
|
@@ -20329,10 +20394,6 @@ class ScrollBar extends NodeItems {
|
|
20329
20394
|
const x = this.orientation === 'horizontal' ? (scrollView.scrollX / scrollView.content.finalRect.width) * finalSize.width : (ScrollBarSize - this.thumbSize) / 2;
|
20330
20395
|
const y = this.orientation === 'horizontal' ? (ScrollBarSize - this.thumbSize) / 2 : (scrollView.scrollY / scrollView.content.finalRect.height) * finalSize.height;
|
20331
20396
|
this.thumb.arrange(e, { x, y, width, height });
|
20332
|
-
if (this.orientation === 'vertical') {
|
20333
|
-
console.log(y, height, finalSize.width, finalSize.height, scrollView.scrollY);
|
20334
|
-
if (scrollView.scrollY === 4.723577235772358) ;
|
20335
|
-
}
|
20336
20397
|
return super.arrangeOverride(e, finalSize);
|
20337
20398
|
}
|
20338
20399
|
render(e) {
|
@@ -20436,6 +20497,9 @@ class RuleControl extends NodeItems {
|
|
20436
20497
|
super();
|
20437
20498
|
this.docCtx = docCtx;
|
20438
20499
|
this.ss = docCtx.selectionState;
|
20500
|
+
this.bgColor = '#fff';
|
20501
|
+
this.shadowBlur = 5;
|
20502
|
+
this.shadowColor = '#000';
|
20439
20503
|
this.options = {
|
20440
20504
|
width: 0,
|
20441
20505
|
pagePL: 0,
|
@@ -21135,7 +21199,7 @@ class CanvasTextEditor extends NodeItems {
|
|
21135
21199
|
*/
|
21136
21200
|
docClickHandle(evt) {
|
21137
21201
|
this.setCursor();
|
21138
|
-
this.
|
21202
|
+
this.updateSelection();
|
21139
21203
|
this.onClickEvent.next(evt);
|
21140
21204
|
}
|
21141
21205
|
/**
|
@@ -21147,6 +21211,7 @@ class CanvasTextEditor extends NodeItems {
|
|
21147
21211
|
if (res) {
|
21148
21212
|
this.flushToSchedule();
|
21149
21213
|
}
|
21214
|
+
this.updateSelection();
|
21150
21215
|
this.onDblClickEvent.next(evt);
|
21151
21216
|
}
|
21152
21217
|
/**
|
@@ -21553,6 +21618,7 @@ class CanvasTextEditor extends NodeItems {
|
|
21553
21618
|
return;
|
21554
21619
|
}
|
21555
21620
|
//this.docScroll.scrollTo(cursorPos.rect.x, cursorPos.rect.y - this.viewOptions.translateY);
|
21621
|
+
this.scrollView.scrollTo(cursorPos.rect.x, cursorPos.rect.y + 100);
|
21556
21622
|
}
|
21557
21623
|
}
|
21558
21624
|
/**
|
@@ -21709,6 +21775,13 @@ class CanvasTextEditor extends NodeItems {
|
|
21709
21775
|
scrollView.y = 30;
|
21710
21776
|
this.scrollView = scrollView;
|
21711
21777
|
scrollView.content.addChild(this);
|
21778
|
+
const label = new LabelNode();
|
21779
|
+
label.text = '请注意了';
|
21780
|
+
label.bgColor = '#fff';
|
21781
|
+
label.padding = 2;
|
21782
|
+
label.x = 100;
|
21783
|
+
label.y = 100;
|
21784
|
+
//this.addChild(label);
|
21712
21785
|
scrollView.onScrollEvent.subscribe(data => {
|
21713
21786
|
//console.log(data);
|
21714
21787
|
this.viewOptions.pageOffset.x = data.x;
|
@@ -21812,6 +21885,24 @@ class CanvasTextEditor extends NodeItems {
|
|
21812
21885
|
appCtx.root.setInputPosition(caretPos);
|
21813
21886
|
}
|
21814
21887
|
}
|
21888
|
+
measureOverride(e, availableSize) {
|
21889
|
+
this.controls.forEach(item => {
|
21890
|
+
item.measure(e, availableSize);
|
21891
|
+
});
|
21892
|
+
return super.measureOverride(e, availableSize);
|
21893
|
+
}
|
21894
|
+
arrangeOverride(e, finalSize) {
|
21895
|
+
this.controls.forEach(item => {
|
21896
|
+
const itemRect = {
|
21897
|
+
x: item.x,
|
21898
|
+
y: item.y,
|
21899
|
+
width: item.desiredSize.width,
|
21900
|
+
height: item.desiredSize.height
|
21901
|
+
};
|
21902
|
+
item.arrange(e, itemRect);
|
21903
|
+
});
|
21904
|
+
return super.arrangeOverride(e, finalSize);
|
21905
|
+
}
|
21815
21906
|
}
|
21816
21907
|
|
21817
21908
|
/**
|
@@ -22240,6 +22331,7 @@ exports.MarginProps = MarginProps;
|
|
22240
22331
|
exports.MouseElementEvent = MouseElementEvent;
|
22241
22332
|
exports.MousedownElementEvent = MousedownElementEvent;
|
22242
22333
|
exports.MuiltBlockLineRenderObject = MuiltBlockLineRenderObject;
|
22334
|
+
exports.OnceSubject = OnceSubject;
|
22243
22335
|
exports.PSymbolElement = PSymbolElement;
|
22244
22336
|
exports.PSymbolRenderObject = PSymbolRenderObject;
|
22245
22337
|
exports.PaddingProps = PaddingProps;
|