@hailin-zheng/editor-core 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controls/Canvas.d.ts +2 -5
- package/controls/Node.d.ts +15 -0
- package/controls/Text.d.ts +3 -2
- package/controls/ViewPaint.d.ts +9 -0
- package/index-cjs.js +194 -105
- package/index-cjs.js.map +1 -1
- package/index.js +194 -105
- package/index.js.map +1 -1
- package/med_editor/framework/element-serialize.d.ts +5 -0
- package/med_editor/framework/paragraph-arrange.d.ts +4 -0
- package/med_editor/texteditor.d.ts +14 -4
- package/package.json +1 -1
- package/timeline/TimeLineControl.d.ts +46 -0
- package/timeline/TimeValueGridControl.d.ts +96 -0
- package/timeline/TimelineConfig.d.ts +67 -0
- package/timeline/TimelineScrollbar.d.ts +25 -0
- package/timeline/TimelineStatus.d.ts +61 -0
- package/timeline/TimelineTick.d.ts +63 -0
- package/timeline/example.d.ts +2 -0
- package/timeline/timezone.d.ts +0 -2
package/index.js
CHANGED
@@ -4172,15 +4172,10 @@ class TableUtil {
|
|
4172
4172
|
const vMergeEndIndex = this.getVMergeEndIndex(tb, rowIndex, i);
|
4173
4173
|
if (vMergeEndIndex > rowIndex) {
|
4174
4174
|
const nextRow = tb.getChild(rowIndex + 1);
|
4175
|
-
nextRow.getChild(i).props.vMerge = vMergeEndIndex - rowIndex >
|
4175
|
+
nextRow.getChild(i).props.vMerge = vMergeEndIndex - rowIndex > 1 ? 'restart' : null;
|
4176
4176
|
}
|
4177
4177
|
}
|
4178
4178
|
else if (cell.props.vMerge === 'continue') {
|
4179
|
-
// const vMergeEndIndex = this.getVMergeEndIndex(tb, rowIndex, i);
|
4180
|
-
// if (vMergeEndIndex > rowIndex) {
|
4181
|
-
// const nextRow = tb.getChild<TableRowElement>(rowIndex + 1);
|
4182
|
-
// nextRow.getChild<TableCellElement>(i).cellProps.vMerge = 'continue';
|
4183
|
-
// }
|
4184
4179
|
const vMergeStartIndex = this.getVMergeStartIndex(tb, rowIndex, i);
|
4185
4180
|
const vMergeEndIndex = this.getVMergeEndIndex(tb, rowIndex, i);
|
4186
4181
|
//当前单元格处于合并行的最后一行,并且合并的行数为2行
|
@@ -4232,7 +4227,6 @@ class TableUtil {
|
|
4232
4227
|
if (!ss.startControl) {
|
4233
4228
|
return;
|
4234
4229
|
}
|
4235
|
-
ss.clear();
|
4236
4230
|
const startCell = ElementUtil.getParentByType(ss.startControl, TableCellElement);
|
4237
4231
|
if (!startCell?.parent) {
|
4238
4232
|
throw new Error('parent is null');
|
@@ -4243,6 +4237,7 @@ class TableUtil {
|
|
4243
4237
|
if (tb.length === 0) {
|
4244
4238
|
tb.remove();
|
4245
4239
|
}
|
4240
|
+
ss.clear();
|
4246
4241
|
}
|
4247
4242
|
/**
|
4248
4243
|
* 移除光标所在的当前列
|
@@ -5167,6 +5162,11 @@ class TextGroupFactory extends ElementFactory {
|
|
5167
5162
|
}
|
5168
5163
|
|
5169
5164
|
class ElementSerialize {
|
5165
|
+
/**
|
5166
|
+
* 将当前文档对象构建并输出到标准的JSON对象
|
5167
|
+
* @param element
|
5168
|
+
* @param viewOptions
|
5169
|
+
*/
|
5170
5170
|
static serialize(element, viewOptions) {
|
5171
5171
|
if (element instanceof BranchElement) {
|
5172
5172
|
const result = element.serialize(viewOptions);
|
@@ -7967,7 +7967,7 @@ class DataElementDate extends DataElementInlineGroup {
|
|
7967
7967
|
return res;
|
7968
7968
|
}
|
7969
7969
|
const format = this.props.format ?? 'YYYY-MM-DD';
|
7970
|
-
const date = moment(this.getValue(), format);
|
7970
|
+
const date = moment(this.getValue(), format, true);
|
7971
7971
|
if (!date.isValid()) {
|
7972
7972
|
return '日期格式不正确';
|
7973
7973
|
}
|
@@ -11164,6 +11164,7 @@ class ParagraphMeasure {
|
|
11164
11164
|
*/
|
11165
11165
|
measureParagraph(p, limitWidth) {
|
11166
11166
|
ElementUtil.fixParagraphContent(p);
|
11167
|
+
this.verifyPara(p, limitWidth);
|
11167
11168
|
p.cacheRender = null;
|
11168
11169
|
const paraModels = [];
|
11169
11170
|
let currRenderLine;
|
@@ -11284,6 +11285,17 @@ class ParagraphMeasure {
|
|
11284
11285
|
}
|
11285
11286
|
return paraRenders;
|
11286
11287
|
}
|
11288
|
+
/**
|
11289
|
+
* 校验当前段落属性
|
11290
|
+
*/
|
11291
|
+
verifyPara(p, limitWidth) {
|
11292
|
+
if (p.props.indent > 0 && p.props.indent + 20 > limitWidth) {
|
11293
|
+
p.props.indent = limitWidth - 20;
|
11294
|
+
}
|
11295
|
+
if (p.props.hanging > 0 && p.props.hanging + 20 > limitWidth) {
|
11296
|
+
p.props.hanging = limitWidth - 20;
|
11297
|
+
}
|
11298
|
+
}
|
11287
11299
|
/**
|
11288
11300
|
* 获取段落行布局横向坐标起始位置,被段落text-align影响
|
11289
11301
|
*/
|
@@ -13670,24 +13682,6 @@ class DocumentEvent {
|
|
13670
13682
|
this.editor.addEventListener('contextmenu', evt => {
|
13671
13683
|
this.contextMenu.next(evt.sourceEvt);
|
13672
13684
|
});
|
13673
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'mousedown').subscribe((evt) => {
|
13674
|
-
// this.mousedown(evt);
|
13675
|
-
// }));
|
13676
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'mouseup').subscribe((evt) => {
|
13677
|
-
// this.mouseup(evt);
|
13678
|
-
// }));
|
13679
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'click').subscribe((evt) => {
|
13680
|
-
// this.mouseClickHandle(evt);
|
13681
|
-
// }));
|
13682
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'contextmenu').subscribe((evt) => {
|
13683
|
-
// this.contextMenu.next(evt);
|
13684
|
-
// }));
|
13685
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'mousemove').subscribe((evt) => {
|
13686
|
-
// this.mousemove(evt);
|
13687
|
-
// }));
|
13688
|
-
// this.addSubEvent(fromEvent<MouseEvent>(this.canvas, 'dblclick').subscribe((evt) => {
|
13689
|
-
// this.mouseDblClickHandle(evt);
|
13690
|
-
// }));
|
13691
13685
|
this.documentInput.onLeftEvent.subscribe(() => {
|
13692
13686
|
this.moveCursorToLeft();
|
13693
13687
|
});
|
@@ -14431,17 +14425,27 @@ class DocumentEvent {
|
|
14431
14425
|
const moveDistanceX = this.currentPos.x - mousedownPos.x;
|
14432
14426
|
const moveDistanceY = this.currentPos.y - mousedownPos.y;
|
14433
14427
|
const row = cellElement.parent;
|
14428
|
+
const minColWidth = 20;
|
14434
14429
|
const table = row?.parent;
|
14435
14430
|
if (!row || !table) {
|
14436
14431
|
throw new Error('row | table is null');
|
14437
14432
|
}
|
14438
14433
|
const cellIndex = row.getChildIndex(cellElement);
|
14439
14434
|
let cellWidth = table.getCellWidth(cellIndex);
|
14440
|
-
table.getColsCount();
|
14441
14435
|
if (['left', 'right'].includes(border)) {
|
14442
14436
|
if (cellIndex === 0 && border === 'left') {
|
14443
14437
|
return;
|
14444
14438
|
}
|
14439
|
+
//当前操作的是表格的最后一列
|
14440
|
+
if (cellIndex === table.getColsCount() - 1 && border === 'right') {
|
14441
|
+
cellWidth += moveDistanceX;
|
14442
|
+
if (cellWidth < minColWidth) {
|
14443
|
+
return;
|
14444
|
+
}
|
14445
|
+
table.setCellWidth(cellIndex, cellWidth);
|
14446
|
+
this.edgeRenderInfo.mousedownPos = this.currentPos;
|
14447
|
+
return;
|
14448
|
+
}
|
14445
14449
|
let resizeColWidth = 0;
|
14446
14450
|
let resizeColIndex = 0;
|
14447
14451
|
if (border === 'left') {
|
@@ -14459,14 +14463,13 @@ class DocumentEvent {
|
|
14459
14463
|
}
|
14460
14464
|
cellWidth += moveDistanceX;
|
14461
14465
|
}
|
14462
|
-
if (resizeColWidth <
|
14466
|
+
if (resizeColWidth < minColWidth || cellWidth < minColWidth) {
|
14463
14467
|
return;
|
14464
14468
|
}
|
14465
14469
|
console.log(resizeColWidth, cellWidth);
|
14466
14470
|
table.setCellWidth(resizeColIndex, resizeColWidth);
|
14467
14471
|
table.setCellWidth(cellIndex, cellWidth);
|
14468
14472
|
this.edgeRenderInfo.mousedownPos = this.currentPos;
|
14469
|
-
table.pubOnChange('self');
|
14470
14473
|
}
|
14471
14474
|
else if (['bottom', 'top'].includes(border)) {
|
14472
14475
|
let rowIndex = row.getIndex();
|
@@ -17120,6 +17123,10 @@ var ModifyFlag;
|
|
17120
17123
|
class NodeCore {
|
17121
17124
|
enableClip = true;
|
17122
17125
|
pointEvent = true;
|
17126
|
+
allowHitTest = false;
|
17127
|
+
hitTest(hitPos, currPos) {
|
17128
|
+
return false;
|
17129
|
+
}
|
17123
17130
|
get enable() {
|
17124
17131
|
return this._enable;
|
17125
17132
|
}
|
@@ -17449,6 +17456,9 @@ class NodeItems extends NodeCore {
|
|
17449
17456
|
eventMap = new WeakMap();
|
17450
17457
|
absoluteItems = false;
|
17451
17458
|
containerPropName;
|
17459
|
+
constructor() {
|
17460
|
+
super();
|
17461
|
+
}
|
17452
17462
|
addChild(control, index = -1) {
|
17453
17463
|
if (this.containerPropName) {
|
17454
17464
|
this[this.containerPropName].addChild(control, index);
|
@@ -17520,6 +17530,33 @@ class NodeItems extends NodeCore {
|
|
17520
17530
|
return this.controls.length;
|
17521
17531
|
}
|
17522
17532
|
}
|
17533
|
+
/**
|
17534
|
+
* 子内容采用绝对定位的容器
|
17535
|
+
*/
|
17536
|
+
class AbsolutePanel extends NodeItems {
|
17537
|
+
constructor() {
|
17538
|
+
super();
|
17539
|
+
this.absoluteItems = true;
|
17540
|
+
}
|
17541
|
+
measureOverride(e, availableSize) {
|
17542
|
+
this.controls.forEach(item => {
|
17543
|
+
item.measure(e, availableSize);
|
17544
|
+
});
|
17545
|
+
return super.measureOverride(e, availableSize);
|
17546
|
+
}
|
17547
|
+
arrangeOverride(e, finalSize) {
|
17548
|
+
this.controls.forEach(item => {
|
17549
|
+
const itemRect = {
|
17550
|
+
x: item.x,
|
17551
|
+
y: item.y,
|
17552
|
+
width: item.desiredSize.width,
|
17553
|
+
height: item.desiredSize.height
|
17554
|
+
};
|
17555
|
+
item.arrange(e, itemRect);
|
17556
|
+
});
|
17557
|
+
return super.arrangeOverride(e, finalSize);
|
17558
|
+
}
|
17559
|
+
}
|
17523
17560
|
let currentActiveAppContext = null;
|
17524
17561
|
function getCurrentActiveAppContext() {
|
17525
17562
|
return currentActiveAppContext;
|
@@ -17637,7 +17674,7 @@ function drawBorderline(node, renderCtx) {
|
|
17637
17674
|
if (!node.border) {
|
17638
17675
|
return;
|
17639
17676
|
}
|
17640
|
-
let { x, y,
|
17677
|
+
let { finalRect: { x, y, width, height } } = node;
|
17641
17678
|
const ctx = renderCtx.ctx;
|
17642
17679
|
ctx.save();
|
17643
17680
|
ctx.fillStyle = node.borderColor;
|
@@ -18201,7 +18238,7 @@ class NodeEvent {
|
|
18201
18238
|
};
|
18202
18239
|
mouseleaveRenders.forEach(item => {
|
18203
18240
|
onMouseoutEvent.target = item;
|
18204
|
-
invokeEvent(onMouseoutEvent, '
|
18241
|
+
invokeEvent(onMouseoutEvent, 'mouseout', item, false);
|
18205
18242
|
});
|
18206
18243
|
const onMouseoverEvent = {
|
18207
18244
|
pos: this.appState.pos,
|
@@ -18367,7 +18404,8 @@ class NodeEvent {
|
|
18367
18404
|
width: width,
|
18368
18405
|
height: height
|
18369
18406
|
};
|
18370
|
-
|
18407
|
+
const hitTest = node.allowHitTest ? node.hitTest(hitPos, currRect) : isInsideRectByPosition(currRect, hitPos);
|
18408
|
+
if (hitTest) {
|
18371
18409
|
//有边框和内边距,所以在计算子节点的时候,需要考虑
|
18372
18410
|
const innerPos = {
|
18373
18411
|
x: currRect.x + node.border + node.padding,
|
@@ -18529,6 +18567,13 @@ class ViewPaint {
|
|
18529
18567
|
this.drawHoriLine(x, y, width, textProps.color, 1);
|
18530
18568
|
}
|
18531
18569
|
}
|
18570
|
+
drawText2(text, textProps, x, y) {
|
18571
|
+
this.ctx.save();
|
18572
|
+
this.ctx.fillStyle = textProps.color;
|
18573
|
+
this.ctx.font = `${textProps.fontSize}px ${textProps.fontName}`;
|
18574
|
+
this.ctx.fillText(text, x, y + textProps.fontSize / 7);
|
18575
|
+
this.ctx.restore();
|
18576
|
+
}
|
18532
18577
|
fillCircular(x, y, r, color = 'black') {
|
18533
18578
|
this.ctx.save();
|
18534
18579
|
this.ctx.beginPath();
|
@@ -18543,6 +18588,10 @@ class ViewPaint {
|
|
18543
18588
|
const textMeasure = this.ctx.measureText(text);
|
18544
18589
|
return { width: textMeasure.width, height: textProps.fontSize };
|
18545
18590
|
}
|
18591
|
+
measureText2(text, font) {
|
18592
|
+
this.ctx.font = font.fontSize + 'px ' + font.fontName;
|
18593
|
+
return this.ctx.measureText(text).width;
|
18594
|
+
}
|
18546
18595
|
measureTextUnits(units, textProps) {
|
18547
18596
|
this.ctx.font = textProps.getFont();
|
18548
18597
|
const letterSpace = textProps.letterSpace ?? 0;
|
@@ -18959,6 +19008,11 @@ class SurfaceView extends NodeItems {
|
|
18959
19008
|
* 如果有默认宽度限制,而且支持换行显示,则内容高度等于多行累计高度
|
18960
19009
|
*/
|
18961
19010
|
class LabelNode extends TextBase {
|
19011
|
+
constructor() {
|
19012
|
+
super();
|
19013
|
+
this.border = 1;
|
19014
|
+
this.borderColor = '#000';
|
19015
|
+
}
|
18962
19016
|
_textWrapping = 'no';
|
18963
19017
|
get textWrapping() {
|
18964
19018
|
return this._textWrapping;
|
@@ -18968,34 +19022,54 @@ class LabelNode extends TextBase {
|
|
18968
19022
|
this._textWrapping = value;
|
18969
19023
|
}
|
18970
19024
|
cacheTextRect;
|
18971
|
-
textUnits
|
19025
|
+
//private textUnits!: Array<TextUnits>;
|
19026
|
+
lines = [];
|
18972
19027
|
measureOverride(e, availableSize) {
|
18973
|
-
|
18974
|
-
this.
|
18975
|
-
|
19028
|
+
this.getTextProps();
|
19029
|
+
this.lines = this.getMuiltLines(this.text, e);
|
19030
|
+
// this.textUnits = this.text.split('').map<TextUnits>(char => ({char, actualSize: 0, sourceSize: 0}));
|
19031
|
+
// e.render.measureTextUnits(this.textUnits, textProps);
|
18976
19032
|
//没有宽度限制,测量横向排列的尺寸大小,此时不需要考虑换行
|
18977
|
-
if (Number.isNaN(this._width)) {
|
18978
|
-
|
18979
|
-
|
18980
|
-
|
18981
|
-
|
18982
|
-
|
18983
|
-
|
18984
|
-
|
18985
|
-
|
18986
|
-
}
|
18987
|
-
|
19033
|
+
// if (Number.isNaN(this._width)) {
|
19034
|
+
// // return {
|
19035
|
+
// // width: this.lines[0].textUnits.reduce((prev, curr) => {
|
19036
|
+
// // return prev + curr.sourceSize
|
19037
|
+
// // }, 0), height: this.fontSize
|
19038
|
+
// // };
|
19039
|
+
// return this.measureTextRect(this.lines, {
|
19040
|
+
// width: availableSize.width,
|
19041
|
+
// height: this.getPercentHeight(availableSize.height)
|
19042
|
+
// });
|
19043
|
+
// }
|
19044
|
+
// if (this._textWrapping === 'no') {
|
19045
|
+
// return {width: this.getPercentWidth(availableSize.width), height: this.fontSize};
|
19046
|
+
// }
|
19047
|
+
return this.measureTextRect(this.lines, {
|
18988
19048
|
width: availableSize.width,
|
18989
19049
|
height: this.getPercentHeight(availableSize.height)
|
18990
19050
|
});
|
18991
19051
|
}
|
18992
|
-
|
18993
|
-
|
18994
|
-
|
18995
|
-
|
18996
|
-
|
18997
|
-
|
19052
|
+
getMuiltLines(text, e) {
|
19053
|
+
const lineRects = [];
|
19054
|
+
const lines = this.text.split('\r\n');
|
19055
|
+
for (let i = 0; i < lines.length; i++) {
|
19056
|
+
const units = lines[i].split('').map(char => ({ char, actualSize: 0, sourceSize: 0 }));
|
19057
|
+
e.render.measureTextUnits(units, this.getTextProps());
|
19058
|
+
lineRects.push({ textUnits: units });
|
18998
19059
|
}
|
19060
|
+
return lineRects;
|
19061
|
+
}
|
19062
|
+
arrangeOverride(e, finalSize) {
|
19063
|
+
// if (!Number.isNaN(this._width) && this._textWrapping === 'wrap') {
|
19064
|
+
// this.measureTextRect(this.lines, {
|
19065
|
+
// width: finalSize.width,
|
19066
|
+
// height: finalSize.height
|
19067
|
+
// });
|
19068
|
+
// }
|
19069
|
+
this.measureTextRect(this.lines, {
|
19070
|
+
width: finalSize.width,
|
19071
|
+
height: finalSize.height
|
19072
|
+
});
|
18999
19073
|
return super.arrangeOverride(e, finalSize);
|
19000
19074
|
}
|
19001
19075
|
getTextProps() {
|
@@ -19005,54 +19079,56 @@ class LabelNode extends TextBase {
|
|
19005
19079
|
textProps.color = this.color ?? '#000';
|
19006
19080
|
return textProps;
|
19007
19081
|
}
|
19008
|
-
measureTextRect(
|
19009
|
-
const sumWidth = textUnits.reduce((prev, curr) => {
|
19010
|
-
return curr.sourceSize + prev;
|
19011
|
-
}, 0);
|
19082
|
+
measureTextRect(lines, availableSize, final = false) {
|
19012
19083
|
//总宽度大于可用宽度,换行计算
|
19013
19084
|
const cacheLines = [];
|
19014
19085
|
const { width: limitWidth, height: limitHeight } = availableSize;
|
19015
|
-
let
|
19016
|
-
|
19017
|
-
|
19018
|
-
|
19019
|
-
|
19020
|
-
|
19021
|
-
|
19022
|
-
|
19023
|
-
|
19024
|
-
|
19025
|
-
|
19026
|
-
|
19086
|
+
for (let i = 0; i < lines.length; i++) {
|
19087
|
+
const lineText = lines[i];
|
19088
|
+
let line = { lineUnits: [], x: 0, y: 0, width: 0, height: 0 };
|
19089
|
+
cacheLines.push(line);
|
19090
|
+
for (let j = 0; j < lineText.textUnits.length; j++) {
|
19091
|
+
const unit = lineText.textUnits[j];
|
19092
|
+
//至少每行一个字符
|
19093
|
+
if (line.lineUnits.length > 0 && line.width + unit.sourceSize > limitWidth) {
|
19094
|
+
line = { lineUnits: [], x: 0, y: 0, width: 0, height: 0 };
|
19095
|
+
cacheLines.push(line);
|
19096
|
+
}
|
19097
|
+
line.lineUnits.push(unit);
|
19098
|
+
line.width += unit.sourceSize;
|
19099
|
+
line.height = this.fontSize;
|
19100
|
+
}
|
19027
19101
|
}
|
19028
19102
|
let contentHeight = 0;
|
19103
|
+
let maxLineWidth = 0;
|
19029
19104
|
cacheLines.forEach(line => {
|
19030
19105
|
line.y = contentHeight;
|
19031
19106
|
contentHeight += line.height;
|
19107
|
+
maxLineWidth = Math.max(line.width, maxLineWidth);
|
19032
19108
|
});
|
19033
19109
|
//期望高度
|
19034
19110
|
let desiredHeight = final ? limitHeight : contentHeight;
|
19035
19111
|
this.cacheTextRect = {
|
19036
19112
|
lines: cacheLines,
|
19037
|
-
width:
|
19113
|
+
width: maxLineWidth,
|
19038
19114
|
height: contentHeight,
|
19039
19115
|
desiredHeight,
|
19040
19116
|
desiredWidth: limitWidth
|
19041
19117
|
};
|
19042
19118
|
return {
|
19043
|
-
width:
|
19119
|
+
width: maxLineWidth,
|
19044
19120
|
height: desiredHeight
|
19045
19121
|
};
|
19046
19122
|
}
|
19047
19123
|
render(e) {
|
19048
|
-
const textProp = new TextProps();
|
19049
|
-
textProp.fontName = this.fontName;
|
19050
|
-
textProp.fontSize = this.fontSize;
|
19051
|
-
textProp.color = this.color;
|
19052
|
-
if (this.textWrapping === 'no' || Number.isNaN(this._width)) {
|
19053
|
-
|
19054
|
-
|
19055
|
-
}
|
19124
|
+
// const textProp = new TextProps();
|
19125
|
+
// textProp.fontName = this.fontName;
|
19126
|
+
// textProp.fontSize = this.fontSize;
|
19127
|
+
// textProp.color = this.color;
|
19128
|
+
// if (this.textWrapping === 'no' || Number.isNaN(this._width)) {
|
19129
|
+
// e.render.drawText(this.text, textProp, 0, 0, this.finalRect.width, textProp.fontSize);
|
19130
|
+
// return;
|
19131
|
+
// }
|
19056
19132
|
for (let i = 0; i < this.cacheTextRect.lines.length; i++) {
|
19057
19133
|
const line = this.cacheTextRect.lines[i];
|
19058
19134
|
this.drawLine(e, line);
|
@@ -19068,7 +19144,7 @@ class LabelNode extends TextBase {
|
|
19068
19144
|
render.tran(() => {
|
19069
19145
|
const textProps = this.getTextProps();
|
19070
19146
|
render.ctx.font = textProps.getFont();
|
19071
|
-
render.drawText(line.lineUnits.join(''), textProps, 0, line.y, line.width, line.height);
|
19147
|
+
render.drawText(line.lineUnits.map(item => item.char).join(''), textProps, 0, line.y, line.width, line.height);
|
19072
19148
|
});
|
19073
19149
|
}
|
19074
19150
|
}
|
@@ -19318,8 +19394,8 @@ class ScrollView extends NodeItems {
|
|
19318
19394
|
});
|
19319
19395
|
this.addEventListener('wheel', evt => {
|
19320
19396
|
const { deltaY, deltaX } = evt;
|
19321
|
-
this.horBar.updateScrollByCurrent(deltaX
|
19322
|
-
this.verBar.updateScrollByCurrent(deltaX
|
19397
|
+
this.horBar.updateScrollByCurrent(deltaX, deltaY);
|
19398
|
+
this.verBar.updateScrollByCurrent(deltaX, deltaY);
|
19323
19399
|
});
|
19324
19400
|
}
|
19325
19401
|
scrollTo(x, y) {
|
@@ -20038,7 +20114,7 @@ function pointInPoly(pt, poly) {
|
|
20038
20114
|
* 1.在单页模式下,文档最小宽度为单个文档宽度+合适的外边距
|
20039
20115
|
* 2.在多页模式下,文档最小宽度为单个文档宽度+合适的外边距
|
20040
20116
|
*/
|
20041
|
-
class CanvasTextEditor extends
|
20117
|
+
class CanvasTextEditor extends AbsolutePanel {
|
20042
20118
|
editCanvas;
|
20043
20119
|
editInput;
|
20044
20120
|
contentCtx;
|
@@ -20965,6 +21041,13 @@ class CanvasTextEditor extends NodeItems {
|
|
20965
21041
|
const win = new Window();
|
20966
21042
|
win.width = 1000;
|
20967
21043
|
win.height = 800;
|
21044
|
+
//win.content.addChild(timelineScrollbar)
|
21045
|
+
const rule2 = new RuleControl(this.docCtx);
|
21046
|
+
this.rule = rule2;
|
21047
|
+
rule2.width = 700;
|
21048
|
+
rule2.height = 30;
|
21049
|
+
rule2.x = 20;
|
21050
|
+
rule2.y = 500;
|
20968
21051
|
const surface = new SurfaceView(this.editCanvas, this.editInput);
|
20969
21052
|
this.surfaceView = surface;
|
20970
21053
|
surface.width = 1000;
|
@@ -20976,12 +21059,6 @@ class CanvasTextEditor extends NodeItems {
|
|
20976
21059
|
this.resetViewer();
|
20977
21060
|
});
|
20978
21061
|
surface.addChild(scrollView);
|
20979
|
-
const rule2 = new RuleControl(this.docCtx);
|
20980
|
-
this.rule = rule2;
|
20981
|
-
rule2.width = 700;
|
20982
|
-
rule2.height = 30;
|
20983
|
-
rule2.x = 20;
|
20984
|
-
rule2.y = 500;
|
20985
21062
|
surface.addChild(rule2);
|
20986
21063
|
//surface.addChild(win);
|
20987
21064
|
surface.start();
|
@@ -21056,24 +21133,36 @@ class CanvasTextEditor extends NodeItems {
|
|
21056
21133
|
appCtx.root.setInputPosition(caretPos);
|
21057
21134
|
}
|
21058
21135
|
}
|
21059
|
-
|
21060
|
-
|
21061
|
-
|
21062
|
-
|
21063
|
-
|
21136
|
+
generatorDoc(data) {
|
21137
|
+
//根据传入的参数,动态生成病情信息的结构化报告
|
21138
|
+
const para = new ParagraphElement();
|
21139
|
+
//创建患者姓名文本标签
|
21140
|
+
const patNameLabel = new TextGroupElement();
|
21141
|
+
patNameLabel.text = "患者姓名:";
|
21142
|
+
//添加到段落中
|
21143
|
+
para.addChild(patNameLabel);
|
21144
|
+
//创建患者姓名数据元
|
21145
|
+
const patNameDataEle = new DataElementText();
|
21146
|
+
patNameDataEle.props.valueTextProps = new TextProps();
|
21147
|
+
patNameDataEle.props.valueTextProps.fontName = '宋体';
|
21148
|
+
patNameDataEle.props.valueTextProps.fontSize = 16;
|
21149
|
+
//数据元赋值
|
21150
|
+
patNameDataEle.setValue(data.patName);
|
21151
|
+
//添加到段落中
|
21152
|
+
para.addChild(patNameDataEle);
|
21153
|
+
//添加到正文中
|
21154
|
+
this.docCtx.document.bodyElement.addChild(para);
|
21064
21155
|
}
|
21065
|
-
|
21066
|
-
|
21067
|
-
|
21068
|
-
|
21069
|
-
|
21070
|
-
width: item.desiredSize.width,
|
21071
|
-
height: item.desiredSize.height
|
21072
|
-
};
|
21073
|
-
item.arrange(e, itemRect);
|
21074
|
-
});
|
21075
|
-
return super.arrangeOverride(e, finalSize);
|
21156
|
+
/**
|
21157
|
+
* 设置关键字
|
21158
|
+
* 匹配用户输入的关键字,回调到应用业务中处理
|
21159
|
+
*/
|
21160
|
+
setKeywords(keys, cb) {
|
21076
21161
|
}
|
21162
|
+
/**
|
21163
|
+
* 注册编辑器格式读取器
|
21164
|
+
*/
|
21165
|
+
registerReaderFactory(handler) { }
|
21077
21166
|
}
|
21078
21167
|
|
21079
21168
|
/**
|