@hailin-zheng/editor-core 1.0.7 → 1.0.10
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/package.json +3 -4
- package/{lib/doc-ruler.js → src/med_editor/doc-ruler.ts} +101 -74
- package/src/med_editor/framework/common-util.ts +200 -0
- package/{lib/framework/document-change.js → src/med_editor/framework/document-change.ts} +308 -259
- package/{lib/framework/document-combine.js → src/med_editor/framework/document-combine.ts} +15 -11
- package/{lib/framework/document-comment.js → src/med_editor/framework/document-comment.ts} +52 -37
- package/{lib/framework/document-context.js → src/med_editor/framework/document-context.ts} +181 -101
- package/{lib/framework/document-eval-func.js → src/med_editor/framework/document-eval-func.ts} +16 -11
- package/{lib/framework/document-event.js → src/med_editor/framework/document-event.ts} +244 -216
- package/{lib/framework/document-history.js → src/med_editor/framework/document-history.ts} +25 -14
- package/{lib/framework/document-images-loader.js → src/med_editor/framework/document-images-loader.ts} +25 -17
- package/{lib/framework/document-input-cursor.js → src/med_editor/framework/document-input-cursor.ts} +76 -71
- package/{lib/framework/document-paint.js → src/med_editor/framework/document-paint.ts} +35 -28
- package/{lib/framework/document-print-offscreen.js → src/med_editor/framework/document-print-offscreen.ts} +25 -19
- package/{lib/framework/document-print.js → src/med_editor/framework/document-print.ts} +57 -41
- package/src/med_editor/framework/document-segmenter.ts +211 -0
- package/{lib/framework/document-selection.js → src/med_editor/framework/document-selection.ts} +116 -85
- package/{lib/framework/document-template.js → src/med_editor/framework/document-template.ts} +3 -3
- package/src/med_editor/framework/document-textline-mode.ts +34 -0
- package/{lib/framework/element-define.js → src/med_editor/framework/element-define.ts} +301 -206
- package/src/med_editor/framework/element-event-define.ts +141 -0
- package/{lib/framework/element-measure.js → src/med_editor/framework/element-measure.ts} +143 -121
- package/{lib/framework/element-paint.js → src/med_editor/framework/element-paint.ts} +44 -38
- package/{lib/framework/element-props.js → src/med_editor/framework/element-props.ts} +331 -202
- package/{lib/framework/element-reader.js → src/med_editor/framework/element-reader.ts} +39 -31
- package/{lib/framework/element-render-cut.js → src/med_editor/framework/element-render-cut.ts} +113 -106
- package/{lib/framework/element-serialize.js → src/med_editor/framework/element-serialize.ts} +37 -24
- package/{lib/framework/element-util.js → src/med_editor/framework/element-util.ts} +317 -216
- package/{lib/framework/impl/checkbox/checkbox-impl.js → src/med_editor/framework/impl/checkbox/checkbox-impl.ts} +27 -20
- package/{lib/framework/impl/comments/comment-content-impl.js → src/med_editor/framework/impl/comments/comment-content-impl.ts} +45 -31
- package/{lib/framework/impl/comments/comment-element-impl.js → src/med_editor/framework/impl/comments/comment-element-impl.ts} +23 -20
- package/{lib/framework/impl/comments/comments-container-impl.js → src/med_editor/framework/impl/comments/comments-container-impl.ts} +22 -16
- package/{lib/framework/impl/comments/comments-util.js → src/med_editor/framework/impl/comments/comments-util.ts} +34 -17
- package/{lib/framework/impl/comments/validate-msg-impl.js → src/med_editor/framework/impl/comments/validate-msg-impl.ts} +28 -17
- package/{lib/framework/impl/data-element/data-decorate-impl.js → src/med_editor/framework/impl/data-element/data-decorate-impl.ts} +26 -22
- package/{lib/framework/impl/data-element/data-element-barcode.js → src/med_editor/framework/impl/data-element/data-element-barcode.ts} +41 -29
- package/{lib/framework/impl/data-element/data-element-base-impl.js → src/med_editor/framework/impl/data-element/data-element-base-impl.ts} +73 -44
- package/{lib/framework/impl/data-element/data-element-check-impl.js → src/med_editor/framework/impl/data-element/data-element-check-impl.ts} +48 -35
- package/{lib/framework/impl/data-element/data-element-date-impl.js → src/med_editor/framework/impl/data-element/data-element-date-impl.ts} +41 -24
- package/{lib/framework/impl/data-element/data-element-group-impl.js → src/med_editor/framework/impl/data-element/data-element-group-impl.ts} +52 -32
- package/{lib/framework/impl/data-element/data-element-image-impl.js → src/med_editor/framework/impl/data-element/data-element-image-impl.ts} +38 -28
- package/{lib/framework/impl/data-element/data-element-list-impl.js → src/med_editor/framework/impl/data-element/data-element-list-impl.ts} +42 -31
- package/{lib/framework/impl/data-element/data-element-text-impl.js → src/med_editor/framework/impl/data-element/data-element-text-impl.ts} +36 -22
- package/{lib/framework/impl/decorate/fill-null-space-imple.js → src/med_editor/framework/impl/decorate/fill-null-space-imple.ts} +15 -10
- package/{lib/framework/impl/document/doc-body-impl.js → src/med_editor/framework/impl/document/doc-body-impl.ts} +32 -16
- package/{lib/framework/impl/document/doc-body-part-impl.js → src/med_editor/framework/impl/document/doc-body-part-impl.ts} +27 -17
- package/src/med_editor/framework/impl/document/doc-container-impl.ts +24 -0
- package/{lib/framework/impl/document/doc-footer-impl.js → src/med_editor/framework/impl/document/doc-footer-impl.ts} +30 -19
- package/{lib/framework/impl/document/doc-header-impl.js → src/med_editor/framework/impl/document/doc-header-impl.ts} +34 -17
- package/{lib/framework/impl/document/doc-impl.js → src/med_editor/framework/impl/document/doc-impl.ts} +62 -45
- package/{lib/framework/impl/media-formula/menstrual-history.js → src/med_editor/framework/impl/media-formula/menstrual-history.ts} +58 -36
- package/{lib/framework/impl/paragraph/p-impl.js → src/med_editor/framework/impl/paragraph/p-impl.ts} +64 -30
- package/{lib/framework/impl/picture/image-impl.js → src/med_editor/framework/impl/picture/image-impl.ts} +37 -25
- package/{lib/framework/impl/radio/radio-impl.js → src/med_editor/framework/impl/radio/radio-impl.ts} +28 -21
- package/{lib/framework/impl/symbol/br-symbol-impl.js → src/med_editor/framework/impl/symbol/br-symbol-impl.ts} +21 -15
- package/{lib/framework/impl/symbol/p-symbol-impl.js → src/med_editor/framework/impl/symbol/p-symbol-impl.ts} +15 -12
- package/{lib/framework/impl/table/table-cell-impl.js → src/med_editor/framework/impl/table/table-cell-impl.ts} +41 -30
- package/{lib/framework/impl/table/table-impl.js → src/med_editor/framework/impl/table/table-impl.ts} +122 -84
- package/{lib/framework/impl/table/table-row-impl.js → src/med_editor/framework/impl/table/table-row-impl.ts} +26 -18
- package/{lib/framework/impl/table/table-split-cell-patch.js → src/med_editor/framework/impl/table/table-split-cell-patch.ts} +31 -22
- package/{lib/framework/impl/table/table-split-cell.js → src/med_editor/framework/impl/table/table-split-cell.ts} +105 -94
- package/{lib/framework/impl/table/table-util.js → src/med_editor/framework/impl/table/table-util.ts} +197 -159
- package/{lib/framework/impl/text/text-impl.js → src/med_editor/framework/impl/text/text-impl.ts} +49 -35
- package/{lib/framework/impl/text/track-run-impl.js → src/med_editor/framework/impl/text/track-run-impl.ts} +53 -30
- package/{lib/framework/notify.js → src/med_editor/framework/notify.ts} +50 -36
- package/{lib/framework/range-util.js → src/med_editor/framework/range-util.ts} +80 -71
- package/{lib/framework/render-context.js → src/med_editor/framework/render-context.ts} +111 -64
- package/{lib/framework/render-define.js → src/med_editor/framework/render-define.ts} +90 -61
- package/{lib/framework/selection-overlays.js → src/med_editor/framework/selection-overlays.ts} +25 -16
- package/{lib/texteditor.js → src/med_editor/texteditor.ts} +288 -191
- package/src/med_editor/util/subject.ts +118 -0
- package/{lib/util/table-bind.js → src/med_editor/util/table-bind.ts} +2 -2
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225.json +3573 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225.json +3573 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225bug.json +315 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/211/271/346/263/250.json +122 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/226/207/346/241/243/351/252/214/350/257/201.json +3599 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/351/225/277/346/226/207/346/234/254.json +24586 -0
- package/src/med_editor//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225.json +2874 -0
- package/src/med_editor//346/211/213/346/234/257/350/256/260/345/275/225.json +341 -0
- package/src/med_editor//346/231/256/351/200/232doc/347/261/273/346/226/207/346/241/243.json +2201 -0
- package/src/med_editor//346/243/200/351/252/214/347/224/263/350/257/267/345/215/225.json +1069 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//345/206/205/351/225/234/344/270/213/346/262/273/347/226/227/350/256/260/345/275/225.json +125 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225/346/250/241/346/235/277.json +86 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//346/227/245/345/270/270/347/227/205/347/250/213/350/256/260/345/275/225.json +115 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//346/237/245/346/210/277/350/256/260/345/275/2251.json +108 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//351/246/226/346/254/241/344/270/212/347/272/247/345/214/273/345/270/210/346/237/245/346/210/277/350/256/260/345/275/225.json +272 -0
- package/src/med_editor//351/225/277/346/234/237/345/214/273/345/230/261/345/215/225.json +1070 -0
- package/lib/doc-ruler.d.ts +0 -51
- package/lib/doc-ruler.js.map +0 -1
- package/lib/framework/common-util.d.ts +0 -63
- package/lib/framework/common-util.js +0 -178
- package/lib/framework/common-util.js.map +0 -1
- package/lib/framework/document-change.d.ts +0 -265
- package/lib/framework/document-change.js.map +0 -1
- package/lib/framework/document-combine.d.ts +0 -24
- package/lib/framework/document-combine.js.map +0 -1
- package/lib/framework/document-comment.d.ts +0 -46
- package/lib/framework/document-comment.js.map +0 -1
- package/lib/framework/document-context.d.ts +0 -149
- package/lib/framework/document-context.js.map +0 -1
- package/lib/framework/document-eval-func.d.ts +0 -18
- package/lib/framework/document-eval-func.js.map +0 -1
- package/lib/framework/document-event.d.ts +0 -213
- package/lib/framework/document-event.js.map +0 -1
- package/lib/framework/document-history.d.ts +0 -26
- package/lib/framework/document-history.js.map +0 -1
- package/lib/framework/document-images-loader.d.ts +0 -16
- package/lib/framework/document-images-loader.js.map +0 -1
- package/lib/framework/document-input-cursor.d.ts +0 -78
- package/lib/framework/document-input-cursor.js.map +0 -1
- package/lib/framework/document-paint.d.ts +0 -34
- package/lib/framework/document-paint.js.map +0 -1
- package/lib/framework/document-print-offscreen.d.ts +0 -38
- package/lib/framework/document-print-offscreen.js.map +0 -1
- package/lib/framework/document-print.d.ts +0 -60
- package/lib/framework/document-print.js.map +0 -1
- package/lib/framework/document-segmenter.d.ts +0 -2
- package/lib/framework/document-segmenter.js +0 -106
- package/lib/framework/document-segmenter.js.map +0 -1
- package/lib/framework/document-selection.d.ts +0 -89
- package/lib/framework/document-selection.js.map +0 -1
- package/lib/framework/document-template.d.ts +0 -4
- package/lib/framework/document-template.js.map +0 -1
- package/lib/framework/document-textline-mode.d.ts +0 -7
- package/lib/framework/document-textline-mode.js +0 -30
- package/lib/framework/document-textline-mode.js.map +0 -1
- package/lib/framework/element-define.d.ts +0 -319
- package/lib/framework/element-define.js.map +0 -1
- package/lib/framework/element-event-define.d.ts +0 -99
- package/lib/framework/element-event-define.js +0 -108
- package/lib/framework/element-event-define.js.map +0 -1
- package/lib/framework/element-measure.d.ts +0 -97
- package/lib/framework/element-measure.js.map +0 -1
- package/lib/framework/element-paint.d.ts +0 -42
- package/lib/framework/element-paint.js.map +0 -1
- package/lib/framework/element-props.d.ts +0 -301
- package/lib/framework/element-props.js.map +0 -1
- package/lib/framework/element-reader.d.ts +0 -19
- package/lib/framework/element-reader.js.map +0 -1
- package/lib/framework/element-render-cut.d.ts +0 -55
- package/lib/framework/element-render-cut.js.map +0 -1
- package/lib/framework/element-serialize.d.ts +0 -30
- package/lib/framework/element-serialize.js.map +0 -1
- package/lib/framework/element-util.d.ts +0 -369
- package/lib/framework/element-util.js.map +0 -1
- package/lib/framework/impl/checkbox/checkbox-impl.d.ts +0 -24
- package/lib/framework/impl/checkbox/checkbox-impl.js.map +0 -1
- package/lib/framework/impl/comments/comment-content-impl.d.ts +0 -40
- package/lib/framework/impl/comments/comment-content-impl.js.map +0 -1
- package/lib/framework/impl/comments/comment-element-impl.d.ts +0 -21
- package/lib/framework/impl/comments/comment-element-impl.js.map +0 -1
- package/lib/framework/impl/comments/comments-container-impl.d.ts +0 -22
- package/lib/framework/impl/comments/comments-container-impl.js.map +0 -1
- package/lib/framework/impl/comments/comments-util.d.ts +0 -12
- package/lib/framework/impl/comments/comments-util.js.map +0 -1
- package/lib/framework/impl/comments/validate-msg-impl.d.ts +0 -21
- package/lib/framework/impl/comments/validate-msg-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-decorate-impl.d.ts +0 -30
- package/lib/framework/impl/data-element/data-decorate-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-barcode.d.ts +0 -31
- package/lib/framework/impl/data-element/data-element-barcode.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-base-impl.d.ts +0 -68
- package/lib/framework/impl/data-element/data-element-base-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-check-impl.d.ts +0 -35
- package/lib/framework/impl/data-element/data-element-check-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-date-impl.d.ts +0 -23
- package/lib/framework/impl/data-element/data-element-date-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-group-impl.d.ts +0 -23
- package/lib/framework/impl/data-element/data-element-group-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-image-impl.d.ts +0 -30
- package/lib/framework/impl/data-element/data-element-image-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-list-impl.d.ts +0 -22
- package/lib/framework/impl/data-element/data-element-list-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-text-impl.d.ts +0 -23
- package/lib/framework/impl/data-element/data-element-text-impl.js.map +0 -1
- package/lib/framework/impl/decorate/fill-null-space-imple.d.ts +0 -21
- package/lib/framework/impl/decorate/fill-null-space-imple.js.map +0 -1
- package/lib/framework/impl/document/doc-body-impl.d.ts +0 -27
- package/lib/framework/impl/document/doc-body-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-body-part-impl.d.ts +0 -30
- package/lib/framework/impl/document/doc-body-part-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-container-impl.d.ts +0 -16
- package/lib/framework/impl/document/doc-container-impl.js +0 -21
- package/lib/framework/impl/document/doc-container-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-footer-impl.d.ts +0 -26
- package/lib/framework/impl/document/doc-footer-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-header-impl.d.ts +0 -26
- package/lib/framework/impl/document/doc-header-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-impl.d.ts +0 -61
- package/lib/framework/impl/document/doc-impl.js.map +0 -1
- package/lib/framework/impl/media-formula/menstrual-history.d.ts +0 -35
- package/lib/framework/impl/media-formula/menstrual-history.js.map +0 -1
- package/lib/framework/impl/paragraph/p-impl.d.ts +0 -45
- package/lib/framework/impl/paragraph/p-impl.js.map +0 -1
- package/lib/framework/impl/picture/image-impl.d.ts +0 -31
- package/lib/framework/impl/picture/image-impl.js.map +0 -1
- package/lib/framework/impl/radio/radio-impl.d.ts +0 -22
- package/lib/framework/impl/radio/radio-impl.js.map +0 -1
- package/lib/framework/impl/symbol/br-symbol-impl.d.ts +0 -22
- package/lib/framework/impl/symbol/br-symbol-impl.js.map +0 -1
- package/lib/framework/impl/symbol/p-symbol-impl.d.ts +0 -19
- package/lib/framework/impl/symbol/p-symbol-impl.js.map +0 -1
- package/lib/framework/impl/table/table-cell-impl.d.ts +0 -37
- package/lib/framework/impl/table/table-cell-impl.js.map +0 -1
- package/lib/framework/impl/table/table-impl.d.ts +0 -55
- package/lib/framework/impl/table/table-impl.js.map +0 -1
- package/lib/framework/impl/table/table-row-impl.d.ts +0 -26
- package/lib/framework/impl/table/table-row-impl.js.map +0 -1
- package/lib/framework/impl/table/table-split-cell-patch.d.ts +0 -20
- package/lib/framework/impl/table/table-split-cell-patch.js.map +0 -1
- package/lib/framework/impl/table/table-split-cell.d.ts +0 -90
- package/lib/framework/impl/table/table-split-cell.js.map +0 -1
- package/lib/framework/impl/table/table-util.d.ts +0 -150
- package/lib/framework/impl/table/table-util.js.map +0 -1
- package/lib/framework/impl/text/text-impl.d.ts +0 -32
- package/lib/framework/impl/text/text-impl.js.map +0 -1
- package/lib/framework/impl/text/track-run-impl.d.ts +0 -27
- package/lib/framework/impl/text/track-run-impl.js.map +0 -1
- package/lib/framework/notify.d.ts +0 -13
- package/lib/framework/notify.js.map +0 -1
- package/lib/framework/range-util.d.ts +0 -40
- package/lib/framework/range-util.js.map +0 -1
- package/lib/framework/render-context.d.ts +0 -91
- package/lib/framework/render-context.js.map +0 -1
- package/lib/framework/render-define.d.ts +0 -109
- package/lib/framework/render-define.js.map +0 -1
- package/lib/framework/selection-overlays.d.ts +0 -30
- package/lib/framework/selection-overlays.js.map +0 -1
- package/lib/texteditor.d.ts +0 -318
- package/lib/texteditor.js.map +0 -1
- package/lib/util/subject.d.ts +0 -34
- package/lib/util/subject.js +0 -88
- package/lib/util/subject.js.map +0 -1
- package/lib/util/table-bind.d.ts +0 -5
- package/lib/util/table-bind.js.map +0 -1
- package/tsconfig.json +0 -25
@@ -1,27 +1,46 @@
|
|
1
|
+
import { EditorContext } from "./document-context";
|
2
|
+
import { Position, ViewOptions } from "./element-define";
|
3
|
+
import { TextProps } from "./element-props";
|
1
4
|
import { ElementUtil } from "./element-util";
|
5
|
+
import { DocumentRenderObject } from "./impl/document/doc-impl";
|
2
6
|
import { ParagraphElement } from "./impl/paragraph/p-impl";
|
7
|
+
import { TextGroupElement, TextGroupRenderObject } from "./impl/text/text-impl";
|
8
|
+
|
9
|
+
export interface TextUnits {
|
10
|
+
sourceSize: number,
|
11
|
+
actualSize: number,
|
12
|
+
char: string
|
13
|
+
}
|
14
|
+
|
15
|
+
export type RenderContenxtType = {
|
16
|
+
contentContext: PaintContent;
|
17
|
+
overlaysContext: PaintContent;
|
18
|
+
drawMode: 'view' | 'print';
|
19
|
+
clear(): void;
|
20
|
+
viewOptions: ViewOptions;
|
21
|
+
docCtx: EditorContext;
|
22
|
+
commit(pageSetting: { width: number, height: number } | null): void
|
23
|
+
};
|
24
|
+
|
3
25
|
export class RenderContenxt {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
overlayOffCanvas;
|
12
|
-
constructor(mainCtx, viewOptions, docCtx) {
|
13
|
-
this.mainCtx = mainCtx;
|
14
|
-
this.viewOptions = viewOptions;
|
15
|
-
this.docCtx = docCtx;
|
26
|
+
contentContext!: PaintContent;
|
27
|
+
overlaysContext!: PaintContent;
|
28
|
+
drawMode: 'view' | 'print' = 'view';
|
29
|
+
private contentOffCanvas!: HTMLCanvasElement;
|
30
|
+
private overlayOffCanvas!: HTMLCanvasElement;
|
31
|
+
|
32
|
+
constructor(public mainCtx: CanvasRenderingContext2D, public viewOptions: ViewOptions, public docCtx: EditorContext) {
|
16
33
|
this.createNativeCanvas();
|
17
34
|
}
|
18
|
-
|
35
|
+
|
36
|
+
private createNativeCanvas() {
|
19
37
|
this.contentOffCanvas = document.createElement('canvas');
|
20
38
|
this.overlayOffCanvas = document.createElement('canvas');
|
21
|
-
this.contentContext = new PaintContent(this.contentOffCanvas.getContext('2d'), this.viewOptions);
|
22
|
-
this.overlaysContext = new PaintContent(this.overlayOffCanvas.getContext('2d'), this.viewOptions);
|
39
|
+
this.contentContext = new PaintContent(this.contentOffCanvas.getContext('2d') as CanvasRenderingContext2D, this.viewOptions);
|
40
|
+
this.overlaysContext = new PaintContent(this.overlayOffCanvas.getContext('2d') as CanvasRenderingContext2D, this.viewOptions);
|
23
41
|
this.setCanvasProps();
|
24
42
|
}
|
43
|
+
|
25
44
|
// private createOffscreenCanvas() {
|
26
45
|
// this.contentOffCanvas = new OffscreenCanvas(250, 250);
|
27
46
|
// this.overlayOffCanvas = new OffscreenCanvas(250, 250);
|
@@ -29,9 +48,10 @@ export class RenderContenxt {
|
|
29
48
|
// this.overlaysContext = new PaintContent(this.overlayOffCanvas.getContext('2d') as OffscreenCanvasRenderingContext2D, this.viewOptions);
|
30
49
|
// this.setCanvasProps();
|
31
50
|
// }
|
32
|
-
|
51
|
+
|
52
|
+
setCanvasProps(pageSetting: { width: number, height: number } | null = null): void {
|
33
53
|
if (!pageSetting) {
|
34
|
-
pageSetting = { width: this.viewOptions.viewSettings.width, height: this.viewOptions.viewPaintHeight }
|
54
|
+
pageSetting = { width: this.viewOptions.viewSettings.width, height: this.viewOptions.viewPaintHeight }
|
35
55
|
if (this.viewOptions.showReviewWindow) {
|
36
56
|
pageSetting.width += this.viewOptions.reviewWindowWidth;
|
37
57
|
}
|
@@ -40,19 +60,21 @@ export class RenderContenxt {
|
|
40
60
|
width: this.viewOptions.viewSettings.width,
|
41
61
|
height: this.viewOptions.viewPaintHeight
|
42
62
|
};
|
43
|
-
ElementUtil.setCanvasProps(this.contentOffCanvas, this.contentContext.ctx, pageSetting, this.viewOptions.scale)
|
44
|
-
ElementUtil.setCanvasProps(this.overlayOffCanvas, this.overlaysContext.ctx, pageSetting, this.viewOptions.scale)
|
45
|
-
ElementUtil.setCanvasProps(this.mainCtx.canvas, this.mainCtx, pageSetting, this.viewOptions.scale)
|
63
|
+
ElementUtil.setCanvasProps(this.contentOffCanvas, this.contentContext.ctx, pageSetting, this.viewOptions.scale)
|
64
|
+
ElementUtil.setCanvasProps(this.overlayOffCanvas, this.overlaysContext.ctx, pageSetting, this.viewOptions.scale)
|
65
|
+
ElementUtil.setCanvasProps(this.mainCtx.canvas, this.mainCtx, pageSetting, this.viewOptions.scale)
|
46
66
|
}
|
47
|
-
|
67
|
+
|
68
|
+
clear(): void {
|
48
69
|
this.contentContext.clear();
|
49
70
|
this.overlaysContext.clear();
|
50
71
|
this.mainCtx.clearRect(0, 0, this.mainCtx.canvas.width, this.mainCtx.canvas.height);
|
51
72
|
}
|
52
|
-
|
73
|
+
|
74
|
+
commit(pageSetting: { width: number, height: number } | null = null): void {
|
53
75
|
//pageSetting = pageSetting || { width: this.viewOptions.viewSettings.width, height: this.viewOptions.viewPaintHeight };
|
54
76
|
if (!pageSetting) {
|
55
|
-
pageSetting = { width: this.viewOptions.viewSettings.width, height: this.viewOptions.viewPaintHeight }
|
77
|
+
pageSetting = { width: this.viewOptions.viewSettings.width, height: this.viewOptions.viewPaintHeight }
|
56
78
|
if (this.viewOptions.showReviewWindow) {
|
57
79
|
pageSetting.width += this.viewOptions.reviewWindowWidth;
|
58
80
|
}
|
@@ -62,34 +84,38 @@ export class RenderContenxt {
|
|
62
84
|
if (!this.overlayOffCanvas.width || !this.overlayOffCanvas.height) {
|
63
85
|
return;
|
64
86
|
}
|
87
|
+
|
65
88
|
this.mainCtx.drawImage(this.overlayOffCanvas, 0, 0, ElementUtil.getDprNumber(width, this.viewOptions.scale), ElementUtil.getDprNumber(height));
|
66
89
|
//console.time('drawImage');
|
67
90
|
this.mainCtx.drawImage(this.contentOffCanvas, 0, 0, ElementUtil.getDprNumber(width, this.viewOptions.scale), ElementUtil.getDprNumber(height));
|
68
91
|
//console.timeEnd('drawImage');
|
69
92
|
}
|
93
|
+
|
70
94
|
}
|
95
|
+
|
71
96
|
export class PaintContent {
|
72
|
-
ctx
|
73
|
-
viewOptions;
|
74
|
-
constructor(ctx, viewOptions) {
|
75
|
-
this.ctx = ctx;
|
76
|
-
this.viewOptions = viewOptions;
|
97
|
+
constructor(public ctx: CanvasRenderingContext2D, private viewOptions: ViewOptions) {
|
77
98
|
this.init();
|
78
99
|
}
|
79
|
-
|
100
|
+
|
101
|
+
init(): void {
|
80
102
|
this.ctx.textBaseline = 'alphabetic';
|
81
103
|
}
|
82
|
-
|
104
|
+
|
105
|
+
setGlobalAlpha(alpha: number): void {
|
83
106
|
this.ctx.globalAlpha = alpha;
|
84
107
|
}
|
85
|
-
|
108
|
+
|
109
|
+
getGlobalAlpha(): number {
|
86
110
|
return this.ctx.globalAlpha;
|
87
111
|
}
|
88
|
-
|
112
|
+
|
113
|
+
clear(): void {
|
89
114
|
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
|
90
115
|
this.init();
|
91
116
|
}
|
92
|
-
|
117
|
+
|
118
|
+
drawText(text: string, textProps: TextProps, x: number, y: number, width: number, height: number): void {
|
93
119
|
if (textProps.background) {
|
94
120
|
this.fillRect(x, y, width, height, textProps.background);
|
95
121
|
}
|
@@ -109,7 +135,8 @@ export class PaintContent {
|
|
109
135
|
this.drawLine(x, y, width, textProps.color, 1);
|
110
136
|
}
|
111
137
|
}
|
112
|
-
|
138
|
+
|
139
|
+
fillCircular(x: number, y: number, r: number, color: string = 'black'): void {
|
113
140
|
this.ctx.save();
|
114
141
|
this.ctx.beginPath();
|
115
142
|
this.ctx.fillStyle = color;
|
@@ -117,8 +144,9 @@ export class PaintContent {
|
|
117
144
|
this.ctx.fill();
|
118
145
|
this.ctx.restore();
|
119
146
|
}
|
120
|
-
|
121
|
-
|
147
|
+
|
148
|
+
drawTextUnits(textGroupRender: TextGroupRenderObject, x: number, y: number): void {
|
149
|
+
const textEle = textGroupRender.element as TextGroupElement;
|
122
150
|
const textProps = textEle.props;
|
123
151
|
const { width, height } = textGroupRender.rect;
|
124
152
|
this.ctx.save();
|
@@ -151,20 +179,24 @@ export class PaintContent {
|
|
151
179
|
}
|
152
180
|
this.ctx.restore();
|
153
181
|
}
|
154
|
-
|
182
|
+
|
183
|
+
getParaLineHeight(textEle: TextGroupElement): number {
|
155
184
|
const para = ElementUtil.getParentByType(textEle, ParagraphElement);
|
156
185
|
if (!para) {
|
157
|
-
throw new Error('未能找到父级段落元素')
|
186
|
+
throw new Error('未能找到父级段落元素')
|
158
187
|
}
|
159
188
|
return para.props.lineHeight;
|
160
189
|
}
|
161
|
-
|
190
|
+
|
191
|
+
measureText(text: string, textProps: TextProps): { width: number, height: number } {
|
162
192
|
this.ctx.fillStyle = textProps.color;
|
163
193
|
this.ctx.font = textProps.getFont();
|
164
194
|
const textMeasure = this.ctx.measureText(text);
|
165
195
|
return { width: textMeasure.width, height: textProps.fontSize };
|
166
196
|
}
|
167
|
-
|
197
|
+
|
198
|
+
|
199
|
+
measureTextUnits(units: Array<TextUnits>, textProps: TextProps): void {
|
168
200
|
this.ctx.font = textProps.getFont();
|
169
201
|
const letterSpace = textProps.letterSpace ?? 0;
|
170
202
|
for (let i = 0; i < units.length; i++) {
|
@@ -174,16 +206,21 @@ export class PaintContent {
|
|
174
206
|
char.sourceSize = textMeasure.width;
|
175
207
|
}
|
176
208
|
}
|
177
|
-
|
209
|
+
|
210
|
+
clearRect(x: number, y: number, width: number, height: number): void {
|
178
211
|
this.ctx.clearRect(x, y, width, height);
|
179
212
|
}
|
180
|
-
|
213
|
+
|
214
|
+
save(): void {
|
181
215
|
this.ctx.save();
|
182
216
|
}
|
183
|
-
|
217
|
+
|
218
|
+
restore(): void {
|
184
219
|
this.ctx.restore();
|
185
220
|
}
|
186
|
-
|
221
|
+
|
222
|
+
|
223
|
+
strokeRect(x: number, y: number, width: number, height: number, strokeColor = 'black', strokeWidth = 1): void {
|
187
224
|
x = Math.ceil(x);
|
188
225
|
y = Math.ceil(y);
|
189
226
|
x += 0.5;
|
@@ -195,8 +232,10 @@ export class PaintContent {
|
|
195
232
|
this.ctx.restore();
|
196
233
|
//this.strokeLines([{ x, y }, { x: x + width, y }, { x: x + width, y: y + height }, { x, y: y + height }, { x, y }], strokeWidth, strokeColor);
|
197
234
|
}
|
235
|
+
|
198
236
|
//strokeRectImageData(x:number)
|
199
|
-
|
237
|
+
|
238
|
+
drawLine(x: number, y: number, width: number, lineColor = 'black', lineWidth = 1): void {
|
200
239
|
x = Math.ceil(x);
|
201
240
|
y = Math.ceil(y);
|
202
241
|
x += 0.5;
|
@@ -211,7 +250,8 @@ export class PaintContent {
|
|
211
250
|
this.ctx.closePath();
|
212
251
|
this.ctx.restore();
|
213
252
|
}
|
214
|
-
|
253
|
+
|
254
|
+
fillRect(x: number, y: number, width: number, height: number, fillColor = 'white', shadowBlur = 0, shadowColor = 'black'): void {
|
215
255
|
x = Math.ceil(x);
|
216
256
|
y = Math.ceil(y);
|
217
257
|
x += 0.5;
|
@@ -230,7 +270,8 @@ export class PaintContent {
|
|
230
270
|
this.ctx.closePath();
|
231
271
|
this.ctx.restore();
|
232
272
|
}
|
233
|
-
|
273
|
+
|
274
|
+
strokeLines(lines: Array<Position>, width = 1, strokeColor = 'black'): void {
|
234
275
|
this.ctx.save();
|
235
276
|
this.ctx.strokeStyle = strokeColor;
|
236
277
|
this.ctx.lineWidth = width;
|
@@ -244,8 +285,7 @@ export class PaintContent {
|
|
244
285
|
y += 0.5;
|
245
286
|
if (i === 0) {
|
246
287
|
this.ctx.moveTo(x, y);
|
247
|
-
}
|
248
|
-
else {
|
288
|
+
} else {
|
249
289
|
this.ctx.lineTo(x, y);
|
250
290
|
}
|
251
291
|
}
|
@@ -253,7 +293,8 @@ export class PaintContent {
|
|
253
293
|
this.ctx.closePath();
|
254
294
|
this.ctx.restore();
|
255
295
|
}
|
256
|
-
|
296
|
+
|
297
|
+
fillLines(lines: Array<Position>, width = 1, fillColor = 'black'): void {
|
257
298
|
this.ctx.save();
|
258
299
|
this.ctx.beginPath();
|
259
300
|
this.ctx.fillStyle = fillColor;
|
@@ -266,8 +307,7 @@ export class PaintContent {
|
|
266
307
|
y += 0.5;
|
267
308
|
if (i === 0) {
|
268
309
|
this.ctx.moveTo(x, y);
|
269
|
-
}
|
270
|
-
else {
|
310
|
+
} else {
|
271
311
|
this.ctx.lineTo(x, y);
|
272
312
|
}
|
273
313
|
}
|
@@ -275,17 +315,20 @@ export class PaintContent {
|
|
275
315
|
this.ctx.closePath();
|
276
316
|
this.ctx.restore();
|
277
317
|
}
|
278
|
-
|
318
|
+
|
319
|
+
|
320
|
+
drawCheckBox(x: number, y: number, width: number, height: number, isChecked: boolean): void {
|
279
321
|
this.strokeRect(x, y, width, height, 'black', 1);
|
280
322
|
if (isChecked) {
|
281
|
-
const lines = [];
|
323
|
+
const lines: Array<Position> = [];
|
282
324
|
lines.push({ x: x + (Math.ceil(width / 4)), y: y + (Math.ceil(height / 2)) });
|
283
325
|
lines.push({ x: x + (Math.ceil(width / 2)), y: y + (Math.floor(height * 3 / 4)) });
|
284
326
|
lines.push({ x: x + (Math.ceil(width * 3 / 4)), y: y + (Math.ceil(height / 4)) });
|
285
327
|
this.strokeLines(lines, 2, 'red');
|
286
328
|
}
|
287
329
|
}
|
288
|
-
|
330
|
+
|
331
|
+
drawRadioBox(x: number, y: number, width: number, height: number, isChecked: boolean): void {
|
289
332
|
x = x + Math.floor(width / 2);
|
290
333
|
y = y + Math.floor(height / 2);
|
291
334
|
width = Math.floor(width / 2);
|
@@ -304,6 +347,8 @@ export class PaintContent {
|
|
304
347
|
}
|
305
348
|
this.ctx.restore();
|
306
349
|
}
|
350
|
+
|
351
|
+
|
307
352
|
/**
|
308
353
|
* 绘制图片
|
309
354
|
* @param image
|
@@ -316,10 +361,11 @@ export class PaintContent {
|
|
316
361
|
* @param dWidth image在目标canvas上绘制的宽度
|
317
362
|
* @param dHeight image在目标canvas上绘制的高度
|
318
363
|
*/
|
319
|
-
drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) {
|
364
|
+
drawImage(image: HTMLImageElement, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number): void {
|
320
365
|
this.ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
|
321
366
|
}
|
322
|
-
|
367
|
+
|
368
|
+
drawDashLine(points: Array<Position>, lineDash: Array<number>, lineColor = 'black', lineWidth = 1): void {
|
323
369
|
this.ctx.save();
|
324
370
|
this.ctx.setLineDash(lineDash);
|
325
371
|
this.ctx.strokeStyle = lineColor;
|
@@ -331,8 +377,7 @@ export class PaintContent {
|
|
331
377
|
y += 0.5;
|
332
378
|
if (i === 0) {
|
333
379
|
this.ctx.moveTo(x, y);
|
334
|
-
}
|
335
|
-
else {
|
380
|
+
} else {
|
336
381
|
this.ctx.lineTo(x, y);
|
337
382
|
}
|
338
383
|
}
|
@@ -340,7 +385,8 @@ export class PaintContent {
|
|
340
385
|
this.ctx.closePath();
|
341
386
|
this.ctx.restore();
|
342
387
|
}
|
343
|
-
|
388
|
+
|
389
|
+
roundRect(x: number, y: number, width: number, height: number, radius: number | { tl: number, tr: number, br: number, bl: number }, fill: boolean, stroke: boolean) {
|
344
390
|
x += 0.5;
|
345
391
|
y += 0.5;
|
346
392
|
if (typeof stroke === 'undefined') {
|
@@ -348,8 +394,7 @@ export class PaintContent {
|
|
348
394
|
}
|
349
395
|
if (typeof radius === 'number') {
|
350
396
|
radius = { tl: radius, tr: radius, br: radius, bl: radius };
|
351
|
-
}
|
352
|
-
else {
|
397
|
+
} else {
|
353
398
|
var defaultRadius = { tl: 0, tr: 0, br: 0, bl: 0 };
|
354
399
|
for (var side in defaultRadius) {
|
355
400
|
radius[side] = radius[side] || defaultRadius[side];
|
@@ -373,12 +418,14 @@ export class PaintContent {
|
|
373
418
|
if (stroke) {
|
374
419
|
this.ctx.stroke();
|
375
420
|
}
|
421
|
+
|
376
422
|
}
|
377
|
-
|
423
|
+
|
424
|
+
clip(x: number, y: number, width: number, height: number): void {
|
378
425
|
this.ctx.save();
|
379
426
|
this.ctx.beginPath();
|
380
427
|
this.ctx.rect(x, y, width, height);
|
381
428
|
this.ctx.clip();
|
382
429
|
}
|
430
|
+
|
383
431
|
}
|
384
|
-
//# sourceMappingURL=render-context.js.map
|
@@ -1,36 +1,37 @@
|
|
1
|
-
import { Rect, MarginProps, PaddingProps } from './element-define'
|
1
|
+
import { Rect, Element, MarginProps, PaddingProps, Position } from './element-define'
|
2
|
+
import { RenderContenxtType } from './render-context';
|
2
3
|
/**
|
3
4
|
* 定义组件的UI形式的渲染
|
4
5
|
*/
|
5
|
-
export class RenderObject {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
parent;
|
6
|
+
export abstract class RenderObject<T extends Element = Element> {
|
7
|
+
margin!: MarginProps;
|
8
|
+
padding!: PaddingProps;
|
9
|
+
rect: Rect = new Rect();
|
10
|
+
parent!: BranchRenderObject;
|
11
11
|
/**
|
12
12
|
* 可点击性,例如:null-text 占位符元素不具备可点击能力
|
13
13
|
*/
|
14
|
-
disableClick;
|
15
|
-
constructor(element) {
|
16
|
-
this.element = element;
|
14
|
+
disableClick!: boolean;
|
15
|
+
constructor(public element: T) {
|
17
16
|
this.margin = new MarginProps();
|
18
17
|
this.padding = new PaddingProps();
|
19
18
|
}
|
20
|
-
|
21
|
-
|
19
|
+
abstract clone(): RenderObject;
|
20
|
+
pagePaintCompleted(ctx: RenderContenxtType, position: Position): void { }
|
21
|
+
destroy(): void {
|
22
22
|
//this.parent = null;
|
23
23
|
//this.margin = null;
|
24
24
|
//this.padding = null;
|
25
25
|
//this.rect = null;
|
26
26
|
//this.element = null;
|
27
27
|
}
|
28
|
+
|
28
29
|
/**
|
29
30
|
* 获取内容区域框体
|
30
|
-
* @param render
|
31
|
-
* @returns
|
31
|
+
* @param render
|
32
|
+
* @returns
|
32
33
|
*/
|
33
|
-
getInnnerRect() {
|
34
|
+
getInnnerRect(): Rect {
|
34
35
|
const { padding } = this;
|
35
36
|
const rect = new Rect();
|
36
37
|
rect.x = padding.left;
|
@@ -41,64 +42,73 @@ export class RenderObject {
|
|
41
42
|
}
|
42
43
|
return rect;
|
43
44
|
}
|
44
|
-
|
45
|
+
|
46
|
+
getInnerMaxWidth(): number {
|
45
47
|
if (!this.rect.maxWidth) {
|
46
|
-
throw new Error('this.rect.maxWidth is null')
|
48
|
+
throw new Error('this.rect.maxWidth is null')
|
47
49
|
}
|
48
50
|
const { padding, margin } = this;
|
49
51
|
return this.rect.maxWidth - padding.left - padding.right - margin.left - margin.bottom;
|
50
52
|
}
|
53
|
+
|
51
54
|
/**
|
52
55
|
* 根据内框内容高度,更新外框框体高度
|
53
|
-
* @param render
|
54
|
-
* @param innerRect
|
56
|
+
* @param render
|
57
|
+
* @param innerRect
|
55
58
|
*/
|
56
|
-
updateRenderHeight(innerRect) {
|
57
|
-
const innnerHeight = typeof innerRect === 'number' ? innerRect : innerRect.height;
|
59
|
+
updateRenderHeight(innerRect: Rect | number): void {
|
60
|
+
const innnerHeight = typeof innerRect === 'number' ? innerRect : (<Rect>innerRect).height;
|
58
61
|
const { padding, margin } = this;
|
59
62
|
//外层容器高度等于内容高度+外边距+内边距
|
60
63
|
this.rect.height = innnerHeight + padding.top + padding.bottom;
|
61
64
|
}
|
62
|
-
|
65
|
+
|
66
|
+
getIndex(): number {
|
63
67
|
if (this.parent) {
|
64
68
|
return this.parent.getChildIndex(this);
|
65
|
-
}
|
66
|
-
else {
|
69
|
+
} else {
|
67
70
|
return 0;
|
68
71
|
}
|
69
72
|
}
|
70
73
|
}
|
74
|
+
|
71
75
|
/**
|
72
76
|
* 叶子节点渲染元素
|
73
77
|
*/
|
74
|
-
export class LeafRenderObject extends RenderObject {
|
75
|
-
constructor(element) {
|
76
|
-
super(element);
|
78
|
+
export abstract class LeafRenderObject<T extends Element = Element> extends RenderObject<T> {
|
79
|
+
constructor(element: T | null) {
|
80
|
+
super(element as T);
|
77
81
|
}
|
82
|
+
abstract render(ctx: RenderContenxtType, position: { x: number, y: number }): void;
|
83
|
+
|
78
84
|
}
|
85
|
+
|
79
86
|
/**
|
80
87
|
* 枝干节点渲染元素
|
81
88
|
*/
|
82
|
-
export class BranchRenderObject extends RenderObject {
|
83
|
-
constructor(element) {
|
84
|
-
super(element);
|
89
|
+
export abstract class BranchRenderObject<T extends Element = Element> extends RenderObject<T> {
|
90
|
+
constructor(element: T | null) {
|
91
|
+
super(element as T);
|
85
92
|
}
|
86
|
-
chilren = [];
|
87
|
-
getItems() {
|
93
|
+
private chilren: Array<RenderObject> = [];
|
94
|
+
getItems(): Array<RenderObject> {
|
88
95
|
return this.chilren;
|
89
96
|
}
|
90
|
-
|
97
|
+
|
98
|
+
addChild(...items: Array<RenderObject>): void {
|
91
99
|
for (let i = 0; i < items.length; i++) {
|
92
100
|
const item = items[i];
|
93
101
|
item.parent = this;
|
94
102
|
this.chilren.push(item);
|
95
103
|
}
|
96
104
|
}
|
97
|
-
|
105
|
+
|
106
|
+
insertChild(item: RenderObject, index: number): void {
|
98
107
|
this.chilren.splice(index, 0, item);
|
99
108
|
item.parent = this;
|
100
109
|
}
|
101
|
-
|
110
|
+
|
111
|
+
removeChild(child: RenderObject): void {
|
102
112
|
const index = this.chilren.indexOf(child);
|
103
113
|
if (index < 0) {
|
104
114
|
throw new Error('为查找到当前元素');
|
@@ -108,17 +118,18 @@ export class BranchRenderObject extends RenderObject {
|
|
108
118
|
}
|
109
119
|
this.chilren.splice(index, 1);
|
110
120
|
}
|
111
|
-
|
121
|
+
|
122
|
+
removeChildByIndex(index: number): void {
|
112
123
|
const child = this.chilren[index];
|
113
124
|
if (child) {
|
114
125
|
this.chilren.splice(index, 1);
|
115
126
|
//child.parent = null;
|
116
|
-
}
|
117
|
-
else {
|
127
|
+
} else {
|
118
128
|
throw new Error('为查找到当前元素');
|
119
129
|
}
|
120
130
|
}
|
121
|
-
|
131
|
+
|
132
|
+
clear(): void {
|
122
133
|
const items = [...this.chilren];
|
123
134
|
for (let i = items.length - 1; i >= 0; i--) {
|
124
135
|
this.removeChildByIndex(i);
|
@@ -127,13 +138,20 @@ export class BranchRenderObject extends RenderObject {
|
|
127
138
|
get length() {
|
128
139
|
return this.chilren.length;
|
129
140
|
}
|
130
|
-
|
131
|
-
|
141
|
+
|
142
|
+
|
143
|
+
getChild<T extends RenderObject = RenderObject>(index: number): T {
|
144
|
+
return this.chilren[index] as T;
|
132
145
|
}
|
133
|
-
|
146
|
+
|
147
|
+
getChildIndex(child: RenderObject): number {
|
134
148
|
return this.chilren.indexOf(child);
|
135
149
|
}
|
136
|
-
|
150
|
+
|
151
|
+
abstract beginRender(ctx: RenderContenxtType, position: Position): void;
|
152
|
+
abstract endRender(ctx: RenderContenxtType, position: Position): void;
|
153
|
+
|
154
|
+
destroy(): void {
|
137
155
|
super.destroy();
|
138
156
|
const len = this.length;
|
139
157
|
for (let i = len - 1; i >= 0; i--) {
|
@@ -145,51 +163,62 @@ export class BranchRenderObject extends RenderObject {
|
|
145
163
|
//this.chilren = null;
|
146
164
|
}
|
147
165
|
}
|
166
|
+
|
167
|
+
|
148
168
|
/**
|
149
169
|
* 块级渲染元素
|
150
170
|
*/
|
151
|
-
export class BlockContentRenderObject extends BranchRenderObject {
|
152
|
-
setRenderWidth(maxWidth) {
|
171
|
+
export abstract class BlockContentRenderObject<T extends Element = Element> extends BranchRenderObject<T> {
|
172
|
+
setRenderWidth(maxWidth: number): void {
|
153
173
|
this.rect.maxWidth = maxWidth;
|
154
174
|
this.rect.width = maxWidth;
|
155
175
|
}
|
156
176
|
}
|
157
|
-
|
177
|
+
|
178
|
+
export abstract class InlineGroupRenderObject<T extends Element = Element> extends BranchRenderObject<T> {
|
158
179
|
}
|
180
|
+
|
159
181
|
/**
|
160
182
|
* 包含块级渲染元素的容器元素,例如body、table-cell等
|
161
183
|
*/
|
162
|
-
export class BlockContainerRenderObject extends BranchRenderObject {
|
163
|
-
setRenderWidth(maxWidth) {
|
184
|
+
export abstract class BlockContainerRenderObject<T extends Element = Element> extends BranchRenderObject<T> {
|
185
|
+
setRenderWidth(maxWidth: number): void {
|
164
186
|
this.rect.maxWidth = maxWidth;
|
165
187
|
this.rect.width = maxWidth;
|
166
188
|
}
|
167
189
|
}
|
190
|
+
|
168
191
|
/**
|
169
192
|
* 多级 ‘BlockLineRectRenderObject’ 包裹元素,例如 p、table
|
170
193
|
*/
|
171
|
-
export class MuiltBlockLineRenderObject extends BlockContentRenderObject {
|
172
|
-
|
194
|
+
export abstract class MuiltBlockLineRenderObject<T extends Element = Element> extends BlockContentRenderObject<T> { }
|
195
|
+
|
173
196
|
/**
|
174
197
|
* 容器-子内容为多个行内块级元素,例如table-row
|
175
198
|
*/
|
176
|
-
export class InlineBlockContainer extends MuiltBlockLineRenderObject {
|
177
|
-
|
199
|
+
export abstract class InlineBlockContainer extends MuiltBlockLineRenderObject { }
|
200
|
+
|
178
201
|
/**
|
179
202
|
* 服务于table-cell
|
180
203
|
* 可被多级拆分的元素
|
181
204
|
*/
|
182
|
-
export class InlineMuiltBlockLineRenderObject extends MuiltBlockLineRenderObject {
|
183
|
-
|
205
|
+
export abstract class InlineMuiltBlockLineRenderObject extends MuiltBlockLineRenderObject { }
|
206
|
+
|
184
207
|
/**
|
185
208
|
* 最小不可分割单位的块级行框,例如 p-line
|
186
209
|
* 一行不可存在于两个页面中,块级行框不能分布在两个页面中
|
187
210
|
*/
|
188
|
-
export class BlockLineRectRenderObject extends BlockContentRenderObject {
|
211
|
+
export abstract class BlockLineRectRenderObject extends BlockContentRenderObject { }
|
212
|
+
|
213
|
+
|
214
|
+
export type BorderType = 'left' | 'right' | 'top' | 'bottom' | 'left-middle' | 'right-middle' | 'top-middle' | 'bottom-middle' | 'none' | 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom';
|
215
|
+
export type CursorType = 'text' | 'row-resize' | 'col-resize' | 'none' | 'default' | 'move' | 'pointer' | 'w-resize' | 's-resize' | 'se-resize' | 'ne-resize';
|
216
|
+
export enum RenderObjectType {
|
217
|
+
Branch = 0,
|
218
|
+
Leaf = 1
|
219
|
+
}
|
220
|
+
|
221
|
+
export interface IMeasureRenderStruct<T> {
|
222
|
+
rect: Rect,
|
223
|
+
render: T
|
189
224
|
}
|
190
|
-
export var RenderObjectType;
|
191
|
-
(function (RenderObjectType) {
|
192
|
-
RenderObjectType[RenderObjectType["Branch"] = 0] = "Branch";
|
193
|
-
RenderObjectType[RenderObjectType["Leaf"] = 1] = "Leaf";
|
194
|
-
})(RenderObjectType || (RenderObjectType = {}));
|
195
|
-
//# sourceMappingURL=render-define.js.map
|