drawui-core 0.2.2 → 0.3.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/README.md +72 -1
- package/dist/index.cjs +21 -21
- package/dist/index.d.cts +206 -6
- package/dist/index.d.ts +206 -6
- package/dist/index.js +21 -21
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,12 @@ interface ShapeStyle {
|
|
|
13
13
|
fillColor: string;
|
|
14
14
|
strokeWidth: number;
|
|
15
15
|
strokeDash: number[] | null;
|
|
16
|
+
/** 填充色透明度(0-1),缺省为 1;与 fillColor 叠加使用 */
|
|
17
|
+
fillOpacity?: number;
|
|
18
|
+
/** 描边色透明度(0-1),缺省为 1;与 strokeColor 叠加使用 */
|
|
19
|
+
strokeOpacity?: number;
|
|
16
20
|
}
|
|
17
|
-
type ShapeType = 'rectangle' | 'rounded-rectangle' | 'circle' | 'ellipse' | 'diamond' | 'triangle' | 'hexagon' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'octagon' | 'star' | 'uml-class' | 'uml-interface' | 'mind-map' | 'line' | 'arrow' | 'text' | 'draw';
|
|
21
|
+
type ShapeType = 'rectangle' | 'rounded-rectangle' | 'circle' | 'ellipse' | 'diamond' | 'triangle' | 'hexagon' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'octagon' | 'star' | 'cylinder' | 'cloud' | 'heart' | 'block-arrow-right' | 'block-arrow-left' | 'block-arrow-up' | 'block-arrow-down' | 'block-arrow-double' | 'right-triangle' | 'cross' | 'speech-rect' | 'speech-round' | 'cube' | 'sector' | 'delay' | 'predefined-process' | 'document' | 'stadium' | 'class-catalog' | 'chevron' | 'brace-left' | 'brace-right' | 'uml-class' | 'uml-interface' | 'mind-map' | 'line' | 'arrow' | 'text' | 'draw';
|
|
18
22
|
interface BaseShape {
|
|
19
23
|
id: string;
|
|
20
24
|
type: ShapeType;
|
|
@@ -26,6 +30,8 @@ interface BaseShape {
|
|
|
26
30
|
textColor?: string;
|
|
27
31
|
fontSize?: number;
|
|
28
32
|
highlightColor?: string;
|
|
33
|
+
/** 文字高亮背景透明度(0-1),缺省为 1 */
|
|
34
|
+
highlightOpacity?: number;
|
|
29
35
|
}
|
|
30
36
|
interface RectangleShape extends BaseShape {
|
|
31
37
|
type: 'rectangle';
|
|
@@ -87,6 +93,46 @@ interface StarShape extends BaseShape {
|
|
|
87
93
|
width: number;
|
|
88
94
|
height: number;
|
|
89
95
|
}
|
|
96
|
+
/** 圆柱体(数据库):上下为椭圆端面,中间为筒身 */
|
|
97
|
+
interface CylinderShape extends BaseShape {
|
|
98
|
+
type: 'cylinder';
|
|
99
|
+
width: number;
|
|
100
|
+
height: number;
|
|
101
|
+
}
|
|
102
|
+
/** 云朵 */
|
|
103
|
+
interface CloudShape extends BaseShape {
|
|
104
|
+
type: 'cloud';
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
}
|
|
108
|
+
/** 心形 */
|
|
109
|
+
interface HeartShape extends BaseShape {
|
|
110
|
+
type: 'heart';
|
|
111
|
+
width: number;
|
|
112
|
+
height: number;
|
|
113
|
+
}
|
|
114
|
+
/** 单向块箭头(流程图中常用的实心箭头),方向由类型名区分 */
|
|
115
|
+
interface BlockArrowShape extends BaseShape {
|
|
116
|
+
type: 'block-arrow-right' | 'block-arrow-left' | 'block-arrow-up' | 'block-arrow-down';
|
|
117
|
+
width: number;
|
|
118
|
+
height: number;
|
|
119
|
+
}
|
|
120
|
+
/** 全圆角矩形(胶囊 / 体育场形):圆角半径恒为「短边的一半」,在流程图里就是「开始/结束」符 */
|
|
121
|
+
interface StadiumShape extends BaseShape {
|
|
122
|
+
type: 'stadium';
|
|
123
|
+
width: number;
|
|
124
|
+
height: number;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* 「矩形区域 + 归一化轮廓」类图形(对话框 / 立方体 / 流程图符号等)。
|
|
128
|
+
* 尺寸模型与矩形完全一致(以 (x,y) 为中心 + width/height),差异只在轮廓,
|
|
129
|
+
* 轮廓定义见 `shapePaths.ts`,canvas 与 SVG 导出共用。
|
|
130
|
+
*/
|
|
131
|
+
interface PathShape extends BaseShape {
|
|
132
|
+
type: 'block-arrow-double' | 'right-triangle' | 'cross' | 'speech-rect' | 'speech-round' | 'cube' | 'sector' | 'delay' | 'predefined-process' | 'document' | 'class-catalog' | 'chevron' | 'brace-left' | 'brace-right';
|
|
133
|
+
width: number;
|
|
134
|
+
height: number;
|
|
135
|
+
}
|
|
90
136
|
type UmlVisibility = '+' | '-' | '#' | '~';
|
|
91
137
|
interface UmlAttribute {
|
|
92
138
|
id: string;
|
|
@@ -160,7 +206,17 @@ interface ArrowBinding {
|
|
|
160
206
|
isPrecise?: boolean;
|
|
161
207
|
normalizedAnchor?: Vec2;
|
|
162
208
|
}
|
|
163
|
-
type ArrowHeadType = 'none' | 'start' | 'end' | 'both' | 'inheritance' | 'aggregation' | 'composition'
|
|
209
|
+
type ArrowHeadType = 'none' | 'start' | 'end' | 'both' | 'inheritance' | 'aggregation' | 'composition'
|
|
210
|
+
/** 依赖(UML dependency):虚线 + 开放箭头 */
|
|
211
|
+
| 'dependency'
|
|
212
|
+
/** 实现(UML realization):虚线 + 空心三角 */
|
|
213
|
+
| 'realization';
|
|
214
|
+
/** 箭头的完整样式(连线类型 + 头部 + 是否虚线):工具栏「箭头」下拉与样式面板共用 */
|
|
215
|
+
interface ArrowStyle {
|
|
216
|
+
connectionType: ConnectionType;
|
|
217
|
+
arrowHead: ArrowHeadType;
|
|
218
|
+
dashed: boolean;
|
|
219
|
+
}
|
|
164
220
|
interface ArrowShape extends BaseShape {
|
|
165
221
|
type: 'arrow';
|
|
166
222
|
points: Vec2[];
|
|
@@ -179,6 +235,10 @@ interface TextShape extends BaseShape {
|
|
|
179
235
|
}
|
|
180
236
|
interface DrawShape extends BaseShape {
|
|
181
237
|
type: 'draw';
|
|
238
|
+
/** 包围盒尺寸(含少量外扩 padding,使选中框略大于笔迹) */
|
|
239
|
+
width: number;
|
|
240
|
+
height: number;
|
|
241
|
+
/** 本地坐标点(相对包围盒中心 x/y),渲染/命中均转换到世界坐标 */
|
|
182
242
|
points: Vec2[];
|
|
183
243
|
}
|
|
184
244
|
/** 思维导图节点:可带子节点;颜色/图标/属性说明均可手动覆盖,默认取层级色 */
|
|
@@ -202,8 +262,8 @@ interface MindMapShape extends BaseShape {
|
|
|
202
262
|
height: number;
|
|
203
263
|
root: MindMapNode;
|
|
204
264
|
}
|
|
205
|
-
type Shape = RectangleShape | RoundedRectangleShape | CircleShape | EllipseShape | DiamondShape | TriangleShape | HexagonShape | ParallelogramShape | TrapezoidShape | PentagonShape | OctagonShape | StarShape | UmlClassShape | UmlInterfaceShape | LineShape | ArrowShape | TextShape | DrawShape | MindMapShape;
|
|
206
|
-
type ToolType = 'select' | 'hand' | 'rectangle' | 'rounded-rectangle' | 'circle' | 'ellipse' | 'diamond' | 'triangle' | 'hexagon' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'octagon' | 'star' | 'uml-class' | 'uml-interface' | 'line' | 'arrow' | 'text' | 'draw' | 'pen' | 'highlighter' | 'eraser' | 'mind-map';
|
|
265
|
+
type Shape = RectangleShape | RoundedRectangleShape | CircleShape | EllipseShape | DiamondShape | TriangleShape | HexagonShape | ParallelogramShape | TrapezoidShape | PentagonShape | OctagonShape | StarShape | CylinderShape | CloudShape | HeartShape | BlockArrowShape | StadiumShape | PathShape | UmlClassShape | UmlInterfaceShape | LineShape | ArrowShape | TextShape | DrawShape | MindMapShape;
|
|
266
|
+
type ToolType = 'select' | 'hand' | 'rectangle' | 'rounded-rectangle' | 'circle' | 'ellipse' | 'diamond' | 'triangle' | 'hexagon' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'octagon' | 'star' | 'cylinder' | 'cloud' | 'heart' | 'block-arrow-right' | 'block-arrow-left' | 'block-arrow-up' | 'block-arrow-down' | 'block-arrow-double' | 'right-triangle' | 'cross' | 'speech-rect' | 'speech-round' | 'cube' | 'sector' | 'delay' | 'predefined-process' | 'document' | 'stadium' | 'class-catalog' | 'chevron' | 'brace-left' | 'brace-right' | 'uml-class' | 'uml-interface' | 'line' | 'arrow' | 'text' | 'draw' | 'pen' | 'highlighter' | 'eraser' | 'mind-map';
|
|
207
267
|
interface CameraState {
|
|
208
268
|
x: number;
|
|
209
269
|
y: number;
|
|
@@ -343,6 +403,43 @@ declare const dictionaries: {
|
|
|
343
403
|
readonly 'tool.pentagon': "五边形";
|
|
344
404
|
readonly 'tool.octagon': "八边形";
|
|
345
405
|
readonly 'tool.star': "星形";
|
|
406
|
+
readonly 'tool.cylinder': "圆柱体";
|
|
407
|
+
readonly 'tool.cloud': "云形";
|
|
408
|
+
readonly 'tool.heart': "心形";
|
|
409
|
+
readonly 'tool.block-arrow-right': "右箭头";
|
|
410
|
+
readonly 'tool.block-arrow-left': "左箭头";
|
|
411
|
+
readonly 'tool.block-arrow-up': "上箭头";
|
|
412
|
+
readonly 'tool.block-arrow-down': "下箭头";
|
|
413
|
+
readonly 'tool.block-arrow-double': "双向箭头";
|
|
414
|
+
readonly 'tool.right-triangle': "直角三角形";
|
|
415
|
+
readonly 'tool.cross': "十字";
|
|
416
|
+
readonly 'tool.speech-rect': "方形对话框";
|
|
417
|
+
readonly 'tool.speech-round': "圆形对话框";
|
|
418
|
+
readonly 'tool.cube': "立方体";
|
|
419
|
+
readonly 'tool.sector': "扇形";
|
|
420
|
+
readonly 'tool.delay': "D 形";
|
|
421
|
+
readonly 'tool.predefined-process': "预定义流程";
|
|
422
|
+
readonly 'tool.document': "文档";
|
|
423
|
+
readonly 'tool.stadium': "全圆角矩形";
|
|
424
|
+
readonly 'tool.class-catalog': "类目";
|
|
425
|
+
readonly 'class.plain': "类";
|
|
426
|
+
readonly 'flow.process': "处理";
|
|
427
|
+
readonly 'flow.step': "流程";
|
|
428
|
+
readonly 'flow.startEnd': "开始/结束";
|
|
429
|
+
readonly 'flow.decision': "判定";
|
|
430
|
+
readonly 'flow.data': "数据";
|
|
431
|
+
readonly 'flow.manual': "手动操作";
|
|
432
|
+
readonly 'flow.preparation': "准备";
|
|
433
|
+
readonly 'flow.database': "数据库";
|
|
434
|
+
readonly 'flow.delay': "延时";
|
|
435
|
+
readonly 'shapeGroup.basic': "基础";
|
|
436
|
+
readonly 'shapeGroup.flowchart': "流程图";
|
|
437
|
+
readonly 'shapeGroup.other': "其他";
|
|
438
|
+
readonly 'shapeGroup.uml': "类图";
|
|
439
|
+
readonly 'shapeMenu.hint': "悬停查看名称";
|
|
440
|
+
readonly 'tool.chevron': "尖角";
|
|
441
|
+
readonly 'tool.brace-left': "左括号";
|
|
442
|
+
readonly 'tool.brace-right': "右括号";
|
|
346
443
|
readonly 'tool.uml-class': "UML 类图";
|
|
347
444
|
readonly 'tool.uml-interface': "UML 接口";
|
|
348
445
|
readonly 'tool.line': "直线";
|
|
@@ -371,14 +468,19 @@ declare const dictionaries: {
|
|
|
371
468
|
readonly 'zoom.out': "缩小";
|
|
372
469
|
readonly 'zoom.reset': "重置";
|
|
373
470
|
readonly 'style.stroke': "边框";
|
|
471
|
+
readonly 'style.line': "线条";
|
|
374
472
|
readonly 'style.fill': "填充";
|
|
375
473
|
readonly 'style.text': "文字";
|
|
376
474
|
readonly 'style.highlight': "高亮";
|
|
475
|
+
readonly 'style.prefix': "前缀符号";
|
|
476
|
+
readonly 'style.prefix.soon': "前缀符号开发中,敬请期待";
|
|
377
477
|
readonly 'style.none': "无";
|
|
478
|
+
readonly 'style.addColor': "添加颜色";
|
|
378
479
|
readonly 'style.connection': "连线";
|
|
379
480
|
readonly 'style.arrow': "箭头";
|
|
380
481
|
readonly 'style.dashed': "虚线";
|
|
381
482
|
readonly 'style.solid': "实线";
|
|
483
|
+
readonly 'style.opacity': "不透明度";
|
|
382
484
|
readonly 'style.connection.straight': "直线";
|
|
383
485
|
readonly 'style.connection.polyline': "折线";
|
|
384
486
|
readonly 'style.connection.orthogonal': "直角折线";
|
|
@@ -387,9 +489,14 @@ declare const dictionaries: {
|
|
|
387
489
|
readonly 'style.arrowhead.end': "终点箭头";
|
|
388
490
|
readonly 'style.arrowhead.start': "起点箭头";
|
|
389
491
|
readonly 'style.arrowhead.both': "双箭头";
|
|
492
|
+
readonly 'style.arrowhead.none-dashed': "无箭头虚线";
|
|
493
|
+
readonly 'style.arrowhead.both-dashed': "双箭头虚线";
|
|
494
|
+
readonly 'style.uml': "UML";
|
|
390
495
|
readonly 'style.arrowhead.inheritance': "继承";
|
|
391
496
|
readonly 'style.arrowhead.composition': "组合";
|
|
392
497
|
readonly 'style.arrowhead.aggregation': "聚合";
|
|
498
|
+
readonly 'style.arrowhead.dependency': "依赖";
|
|
499
|
+
readonly 'style.arrowhead.realization': "实现";
|
|
393
500
|
readonly 'menu.title': "选择新图形";
|
|
394
501
|
readonly 'menu.cancel': "点击空白处取消";
|
|
395
502
|
readonly 'shape.rectangle': "矩形";
|
|
@@ -460,6 +567,43 @@ declare const dictionaries: {
|
|
|
460
567
|
readonly 'tool.pentagon': "Pentagon";
|
|
461
568
|
readonly 'tool.octagon': "Octagon";
|
|
462
569
|
readonly 'tool.star': "Star";
|
|
570
|
+
readonly 'tool.cylinder': "Cylinder";
|
|
571
|
+
readonly 'tool.cloud': "Cloud";
|
|
572
|
+
readonly 'tool.heart': "Heart";
|
|
573
|
+
readonly 'tool.block-arrow-right': "Arrow right";
|
|
574
|
+
readonly 'tool.block-arrow-left': "Arrow left";
|
|
575
|
+
readonly 'tool.block-arrow-up': "Arrow up";
|
|
576
|
+
readonly 'tool.block-arrow-down': "Arrow down";
|
|
577
|
+
readonly 'tool.block-arrow-double': "Double arrow";
|
|
578
|
+
readonly 'tool.right-triangle': "Right triangle";
|
|
579
|
+
readonly 'tool.cross': "Cross";
|
|
580
|
+
readonly 'tool.speech-rect': "Speech bubble";
|
|
581
|
+
readonly 'tool.speech-round': "Round bubble";
|
|
582
|
+
readonly 'tool.cube': "Cube";
|
|
583
|
+
readonly 'tool.sector': "Sector";
|
|
584
|
+
readonly 'tool.delay': "Delay";
|
|
585
|
+
readonly 'tool.predefined-process': "Predefined process";
|
|
586
|
+
readonly 'tool.document': "Document";
|
|
587
|
+
readonly 'tool.stadium': "Stadium";
|
|
588
|
+
readonly 'tool.class-catalog': "Category";
|
|
589
|
+
readonly 'class.plain': "Class";
|
|
590
|
+
readonly 'flow.process': "Process";
|
|
591
|
+
readonly 'flow.step': "Step";
|
|
592
|
+
readonly 'flow.startEnd': "Start / End";
|
|
593
|
+
readonly 'flow.decision': "Decision";
|
|
594
|
+
readonly 'flow.data': "Data";
|
|
595
|
+
readonly 'flow.manual': "Manual operation";
|
|
596
|
+
readonly 'flow.preparation': "Preparation";
|
|
597
|
+
readonly 'flow.database': "Database";
|
|
598
|
+
readonly 'flow.delay': "Delay";
|
|
599
|
+
readonly 'shapeGroup.basic': "Basic";
|
|
600
|
+
readonly 'shapeGroup.flowchart': "Flowchart";
|
|
601
|
+
readonly 'shapeGroup.other': "Other";
|
|
602
|
+
readonly 'shapeGroup.uml': "Class diagram";
|
|
603
|
+
readonly 'shapeMenu.hint': "Hover to see name";
|
|
604
|
+
readonly 'tool.chevron': "Chevron";
|
|
605
|
+
readonly 'tool.brace-left': "Left brace";
|
|
606
|
+
readonly 'tool.brace-right': "Right brace";
|
|
463
607
|
readonly 'tool.uml-class': "UML class";
|
|
464
608
|
readonly 'tool.uml-interface': "UML interface";
|
|
465
609
|
readonly 'tool.line': "Line";
|
|
@@ -488,14 +632,19 @@ declare const dictionaries: {
|
|
|
488
632
|
readonly 'zoom.out': "Zoom out";
|
|
489
633
|
readonly 'zoom.reset': "Reset";
|
|
490
634
|
readonly 'style.stroke': "Border";
|
|
635
|
+
readonly 'style.line': "Line";
|
|
491
636
|
readonly 'style.fill': "Fill";
|
|
492
637
|
readonly 'style.text': "Text";
|
|
493
638
|
readonly 'style.highlight': "Highlight";
|
|
639
|
+
readonly 'style.prefix': "Prefix";
|
|
640
|
+
readonly 'style.prefix.soon': "Prefix symbols are coming soon";
|
|
494
641
|
readonly 'style.none': "None";
|
|
642
|
+
readonly 'style.addColor': "Add color";
|
|
495
643
|
readonly 'style.connection': "Connection";
|
|
496
644
|
readonly 'style.arrow': "Arrow head";
|
|
497
645
|
readonly 'style.dashed': "Dashed";
|
|
498
646
|
readonly 'style.solid': "Solid";
|
|
647
|
+
readonly 'style.opacity': "Opacity";
|
|
499
648
|
readonly 'style.connection.straight': "Straight";
|
|
500
649
|
readonly 'style.connection.polyline': "Polyline";
|
|
501
650
|
readonly 'style.connection.orthogonal': "Orthogonal";
|
|
@@ -504,9 +653,14 @@ declare const dictionaries: {
|
|
|
504
653
|
readonly 'style.arrowhead.end': "End";
|
|
505
654
|
readonly 'style.arrowhead.start': "Start";
|
|
506
655
|
readonly 'style.arrowhead.both': "Both";
|
|
656
|
+
readonly 'style.arrowhead.none-dashed': "Dashed";
|
|
657
|
+
readonly 'style.arrowhead.both-dashed': "Dashed both";
|
|
658
|
+
readonly 'style.uml': "UML";
|
|
507
659
|
readonly 'style.arrowhead.inheritance': "Inheritance";
|
|
508
660
|
readonly 'style.arrowhead.composition': "Composition";
|
|
509
661
|
readonly 'style.arrowhead.aggregation': "Aggregation";
|
|
662
|
+
readonly 'style.arrowhead.dependency': "Dependency";
|
|
663
|
+
readonly 'style.arrowhead.realization': "Realization";
|
|
510
664
|
readonly 'menu.title': "Create shape";
|
|
511
665
|
readonly 'menu.cancel': "Click empty space to cancel";
|
|
512
666
|
readonly 'shape.rectangle': "Rectangle";
|
|
@@ -653,6 +807,11 @@ declare class Editor {
|
|
|
653
807
|
private notifyScheduled;
|
|
654
808
|
/** 是否启用 localStorage 持久化 */
|
|
655
809
|
private persist;
|
|
810
|
+
/**
|
|
811
|
+
* 新建箭头的默认样式(工具栏「箭头」下拉里选的)。
|
|
812
|
+
* 只影响之后创建的箭头;改选中箭头的样式走 updateArrowStyle。
|
|
813
|
+
*/
|
|
814
|
+
private arrowStyle;
|
|
656
815
|
constructor(canvas: HTMLCanvasElement, options?: EditorOptions);
|
|
657
816
|
private setupEventListeners;
|
|
658
817
|
private handlePointerDown;
|
|
@@ -706,15 +865,25 @@ declare class Editor {
|
|
|
706
865
|
private emitUi;
|
|
707
866
|
/** 批量更新选中图形的样式(边框色、填充色等),提交历史记录 */
|
|
708
867
|
updateSelectedShapesStyle(updates: Partial<ShapeStyle>): void;
|
|
709
|
-
/**
|
|
868
|
+
/** 批量更新选中图形的文字颜色/高亮背景色/高亮透明度,提交历史记录 */
|
|
710
869
|
updateSelectedShapesText(updates: {
|
|
711
870
|
textColor?: string;
|
|
712
871
|
highlightColor?: string;
|
|
872
|
+
highlightOpacity?: number;
|
|
713
873
|
}): void;
|
|
714
874
|
/** 批量更新选中线条/箭头的连线类型 */
|
|
715
875
|
updateConnectionType(connectionType: ConnectionType): void;
|
|
716
876
|
/** 批量更新选中箭头的箭头类型 */
|
|
717
877
|
updateArrowHeadType(arrowHead: ArrowHeadType): void;
|
|
878
|
+
/**
|
|
879
|
+
* 批量更新选中箭头的完整样式(连线类型 / 头部 / 是否虚线),只写一条历史记录。
|
|
880
|
+
* 样式面板与工具栏下拉都走这里。
|
|
881
|
+
*/
|
|
882
|
+
updateArrowStyle(updates: Partial<ArrowStyle>): void;
|
|
883
|
+
/** 读取「新建箭头」的默认样式(工具栏下拉用) */
|
|
884
|
+
getArrowStyle(): ArrowStyle;
|
|
885
|
+
/** 修改「新建箭头」的默认样式:只影响之后画出来的箭头 */
|
|
886
|
+
setArrowStyle(updates: Partial<ArrowStyle>): void;
|
|
718
887
|
/** 批量更新选中箭头的虚线样式 */
|
|
719
888
|
updateArrowDashed(dashed: boolean): void;
|
|
720
889
|
/** 更新 UML 类图的类名、属性、方法,自动重算尺寸 */
|
|
@@ -820,6 +989,9 @@ declare class Editor {
|
|
|
820
989
|
} | null;
|
|
821
990
|
setActiveTool(tool: ToolType): void;
|
|
822
991
|
getActiveTool(): ToolType;
|
|
992
|
+
/** 设置荧光笔颜色(基础色,绘制时自动叠加固定透明度) */
|
|
993
|
+
setHighlighterColor(color: string): void;
|
|
994
|
+
getHighlighterColor(): string;
|
|
823
995
|
getShapes(): Shape[];
|
|
824
996
|
/** 导出当前数据(图形 + 相机),供外部保存/对接 */
|
|
825
997
|
getData(): EditorData;
|
|
@@ -960,6 +1132,8 @@ declare class Renderer {
|
|
|
960
1132
|
private applyStyle;
|
|
961
1133
|
private drawRectangle;
|
|
962
1134
|
private drawRoundedRectangle;
|
|
1135
|
+
/** 全圆角矩形(胶囊 / 体育场形):圆角半径恒为短边的一半 */
|
|
1136
|
+
private drawStadium;
|
|
963
1137
|
private drawCircle;
|
|
964
1138
|
private drawEllipse;
|
|
965
1139
|
private drawDiamond;
|
|
@@ -970,6 +1144,13 @@ declare class Renderer {
|
|
|
970
1144
|
private drawPentagon;
|
|
971
1145
|
private drawOctagon;
|
|
972
1146
|
private drawStar;
|
|
1147
|
+
/**
|
|
1148
|
+
* 用「归一化路径」绘制图形(圆柱体 / 云 / 心形 / 箭头 / 对话框 / 流程图符号 / 大括号…)。
|
|
1149
|
+
* 路径定义见 `shapePaths.ts`,与 SVG 导出共用,保证两端形状一致。
|
|
1150
|
+
*/
|
|
1151
|
+
private drawPathShape;
|
|
1152
|
+
/** 把归一化路径命令展开到 canvas 当前路径 */
|
|
1153
|
+
private tracePath;
|
|
973
1154
|
private drawUmlClass;
|
|
974
1155
|
/**
|
|
975
1156
|
* UML 接口:标题显示为 `<<${className}>>`,仅方法段,无属性段,只有一条分隔线。
|
|
@@ -1161,6 +1342,8 @@ interface ToolContext {
|
|
|
1161
1342
|
highlightColor?: string;
|
|
1162
1343
|
}): void;
|
|
1163
1344
|
updateConnectionType(connectionType: ConnectionType): void;
|
|
1345
|
+
/** 新建箭头的默认样式(工具栏「箭头」下拉里选的) */
|
|
1346
|
+
getArrowStyle(): ArrowStyle;
|
|
1164
1347
|
/** 光标语义命中:思维导图节点框或折叠标记内才命中(节点间空档不命中) */
|
|
1165
1348
|
getMindMapCursorHitAtPoint(point: Vec2): {
|
|
1166
1349
|
shapeId: string;
|
|
@@ -1343,6 +1526,8 @@ declare class LineTool extends Tool {
|
|
|
1343
1526
|
}
|
|
1344
1527
|
|
|
1345
1528
|
type FreehandMode = 'pen' | 'highlighter';
|
|
1529
|
+
/** 荧光笔默认颜色(黄色) */
|
|
1530
|
+
declare const DEFAULT_HIGHLIGHTER_COLOR = "#ffeb3b";
|
|
1346
1531
|
/**
|
|
1347
1532
|
* 自由绘制工具(画笔 / 荧光笔)。
|
|
1348
1533
|
*
|
|
@@ -1359,8 +1544,21 @@ declare class FreehandTool extends Tool {
|
|
|
1359
1544
|
private currentShapeId;
|
|
1360
1545
|
private committed;
|
|
1361
1546
|
private fadeTimer;
|
|
1547
|
+
/** 荧光笔基础色(实际绘制时叠加固定透明度) */
|
|
1548
|
+
private highlighterColor;
|
|
1362
1549
|
constructor(context: ToolContext, mode: FreehandMode);
|
|
1550
|
+
/** 设置荧光笔颜色(仅 highlighter 模式生效) */
|
|
1551
|
+
setHighlighterColor(color: string): void;
|
|
1552
|
+
getHighlighterColor(): string;
|
|
1553
|
+
/** 当前模式新建笔迹要用的样式 */
|
|
1554
|
+
private buildStyle;
|
|
1363
1555
|
onPointerDown(point: Vec2, _event: PointerEvent): void;
|
|
1556
|
+
/**
|
|
1557
|
+
* 由世界坐标点集计算飞书式「矩形区域」几何:
|
|
1558
|
+
* 包围盒中心作为 shape 的 (x, y),points 转为相对中心的本地坐标,
|
|
1559
|
+
* 包围盒外扩少量 padding 使选中框略大于笔迹。
|
|
1560
|
+
*/
|
|
1561
|
+
private buildGeometry;
|
|
1364
1562
|
onPointerMove(point: Vec2, _event: PointerEvent): void;
|
|
1365
1563
|
onPointerUp(_point: Vec2, _event: PointerEvent): void;
|
|
1366
1564
|
onKeyDown(_event: KeyboardEvent): void;
|
|
@@ -1373,8 +1571,10 @@ declare class ArrowTool extends Tool {
|
|
|
1373
1571
|
type: "arrow";
|
|
1374
1572
|
private isDrawing;
|
|
1375
1573
|
private startPoint;
|
|
1574
|
+
/** 真正拖出距离后才创建图形,所以这里可能为 null */
|
|
1376
1575
|
private currentShapeId;
|
|
1377
1576
|
private startBindingInfo;
|
|
1577
|
+
private startBinding;
|
|
1378
1578
|
onPointerDown(point: Vec2, _event: PointerEvent): void;
|
|
1379
1579
|
onPointerMove(point: Vec2, _event: PointerEvent): void;
|
|
1380
1580
|
onPointerUp(_point: Vec2, _event: PointerEvent): void;
|
|
@@ -1429,4 +1629,4 @@ declare function countMindMapNodes(root: MindMapNode): number;
|
|
|
1429
1629
|
*/
|
|
1430
1630
|
declare function layoutMindMap(root: MindMapNode): MindMapLayoutResult;
|
|
1431
1631
|
|
|
1432
|
-
export { type ArrowBinding, type ArrowHeadType, type ArrowShape, ArrowTool, Camera, type CameraState, type CircleShape, type ConnectionType, type DiamondShape, type DrawShape, type DrawuiTheme, type DrawuiThemeSelection, Editor, type EditorData, type EditorOptions, type EditorState, type EllipseShape, type ExportFormat, type ExportOptions, type FreehandMode, FreehandTool, type GenerationContext, HandTool, type HexagonShape, type Language, type LineShape, LineTool, MINDMAP_COLORS, MINDMAP_FONT_SIZE, MINDMAP_MAX_WIDTH, MINDMAP_MIN_WIDTH, MINDMAP_NODE_HEIGHT, Mat2d, type MessageKey, type MindMapLayoutResult, type MindMapNode, type MindMapNodePos, type MindMapShape, type OctagonShape, type ParallelogramShape, type PentagonShape, type Rect, type RectangleShape, Renderer, type RoundedRectangleShape, SelectTool, type Shape, type ShapeStyle, ShapeTool, type ShapeType, type SnapGuide, type StarShape, THEME, type TextShape, type ToolType, type TrapezoidShape, type TriangleShape, UML_FONT_SIZE, UML_HEADER_HEIGHT, UML_LINE_HEIGHT, UML_MIN_WIDTH, UML_PADDING_X, UML_PADDING_Y, type UiEvent, type UmlAttribute, type UmlClassShape, type UmlInterfaceShape, type UmlMethod, type UmlVisibility, Vec, type Vec2 as Vec2Type, calcUmlClassSize, cloneMindMapNode, countMindMapNodes, downloadBlob, exportToBlob, findMindMapNode, getContentBounds, getLanguage, getMindMapNodeDepth, getMindMapParent, getTheme, hexToRgba, layoutMindMap, mindMapNodeColor, mindMapNodeSize, renderSVGString, renderToCanvas, setLanguage, setTheme, shadeColor, subscribeLanguage, subscribeTheme, t };
|
|
1632
|
+
export { type ArrowBinding, type ArrowHeadType, type ArrowShape, type ArrowStyle, ArrowTool, Camera, type CameraState, type CircleShape, type ConnectionType, DEFAULT_HIGHLIGHTER_COLOR, type DiamondShape, type DrawShape, type DrawuiTheme, type DrawuiThemeSelection, Editor, type EditorData, type EditorOptions, type EditorState, type EllipseShape, type ExportFormat, type ExportOptions, type FreehandMode, FreehandTool, type GenerationContext, HandTool, type HexagonShape, type Language, type LineShape, LineTool, MINDMAP_COLORS, MINDMAP_FONT_SIZE, MINDMAP_MAX_WIDTH, MINDMAP_MIN_WIDTH, MINDMAP_NODE_HEIGHT, Mat2d, type MessageKey, type MindMapLayoutResult, type MindMapNode, type MindMapNodePos, type MindMapShape, type OctagonShape, type ParallelogramShape, type PentagonShape, type Rect, type RectangleShape, Renderer, type RoundedRectangleShape, SelectTool, type Shape, type ShapeStyle, ShapeTool, type ShapeType, type SnapGuide, type StarShape, THEME, type TextShape, type ToolType, type TrapezoidShape, type TriangleShape, UML_FONT_SIZE, UML_HEADER_HEIGHT, UML_LINE_HEIGHT, UML_MIN_WIDTH, UML_PADDING_X, UML_PADDING_Y, type UiEvent, type UmlAttribute, type UmlClassShape, type UmlInterfaceShape, type UmlMethod, type UmlVisibility, Vec, type Vec2 as Vec2Type, calcUmlClassSize, cloneMindMapNode, countMindMapNodes, downloadBlob, exportToBlob, findMindMapNode, getContentBounds, getLanguage, getMindMapNodeDepth, getMindMapParent, getTheme, hexToRgba, layoutMindMap, mindMapNodeColor, mindMapNodeSize, renderSVGString, renderToCanvas, setLanguage, setTheme, shadeColor, subscribeLanguage, subscribeTheme, t };
|