@visactor/vrender-core 0.16.0-alpha.0 → 0.16.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animate/animate.js +8 -2
- package/cjs/animate/animate.js.map +1 -1
- package/cjs/core/application.js +1 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/constants.d.ts +3 -0
- package/cjs/core/constants.js +5 -3
- package/cjs/core/constants.js.map +1 -1
- package/cjs/core/contributions/layerHandler/canvas2d-contribution.d.ts +3 -1
- package/cjs/core/contributions/layerHandler/canvas2d-contribution.js +1 -1
- package/cjs/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
- package/cjs/core/contributions/layerHandler/empty-contribution.d.ts +24 -0
- package/cjs/core/contributions/layerHandler/empty-contribution.js +57 -0
- package/cjs/core/contributions/layerHandler/empty-contribution.js.map +1 -0
- package/cjs/core/contributions/layerHandler/modules.js +4 -2
- package/cjs/core/contributions/layerHandler/modules.js.map +1 -1
- package/cjs/core/contributions/layerHandler/offscreen2d-contribution.d.ts +3 -1
- package/cjs/core/contributions/layerHandler/offscreen2d-contribution.js +1 -1
- package/cjs/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
- package/cjs/core/core-modules.js +1 -1
- package/cjs/core/global-module.js +2 -0
- package/cjs/core/layer-service.d.ts +5 -2
- package/cjs/core/layer-service.js +23 -3
- package/cjs/core/layer-service.js.map +1 -1
- package/cjs/core/layer.d.ts +4 -3
- package/cjs/core/layer.js +13 -8
- package/cjs/core/layer.js.map +1 -1
- package/cjs/core/stage.d.ts +8 -7
- package/cjs/core/stage.js +33 -34
- package/cjs/core/stage.js.map +1 -1
- package/cjs/event/constant.js +1 -1
- package/cjs/event/event-manager.js +1 -1
- package/cjs/event/event-system.js +1 -1
- package/cjs/event/event-target.js +1 -1
- package/cjs/event/index.js +1 -1
- package/cjs/graphic/config.d.ts +2 -1
- package/cjs/graphic/config.js +13 -6
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic-service/common-contribution.js +1 -1
- package/cjs/graphic/graphic-service/common-contribution.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.d.ts +2 -0
- package/cjs/graphic/graphic-service/graphic-service.js +4 -0
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic-service/symbol-contribution.js +1 -1
- package/cjs/graphic/graphic-service/symbol-contribution.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +3 -0
- package/cjs/graphic/graphic.js +48 -21
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/graphic/node-tree.d.ts +1 -1
- package/cjs/graphic/node-tree.js +2 -2
- package/cjs/graphic/node-tree.js.map +1 -1
- package/cjs/graphic/text.d.ts +12 -0
- package/cjs/graphic/text.js +31 -5
- package/cjs/graphic/text.js.map +1 -1
- package/cjs/interface/context.d.ts +2 -1
- package/cjs/interface/context.js.map +1 -1
- package/cjs/interface/core.d.ts +2 -1
- package/cjs/interface/core.js.map +1 -1
- package/cjs/interface/event.d.ts +1 -0
- package/cjs/interface/event.js.map +1 -1
- package/cjs/interface/graphic/text.d.ts +3 -0
- package/cjs/interface/graphic/text.js.map +1 -1
- package/cjs/interface/graphic-service.d.ts +2 -0
- package/cjs/interface/graphic-service.js.map +1 -1
- package/cjs/interface/graphic.d.ts +9 -2
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/interface/layer.d.ts +9 -2
- package/cjs/interface/layer.js.map +1 -1
- package/cjs/interface/picker.d.ts +5 -5
- package/cjs/interface/picker.js.map +1 -1
- package/cjs/interface/render.d.ts +1 -1
- package/cjs/interface/render.js.map +1 -1
- package/cjs/interface/stage.d.ts +6 -10
- package/cjs/interface/stage.js.map +1 -1
- package/cjs/picker/global-picker-service.d.ts +1 -1
- package/cjs/picker/global-picker-service.js +14 -4
- package/cjs/picker/global-picker-service.js.map +1 -1
- package/cjs/picker/pick-interceptor.d.ts +9 -3
- package/cjs/picker/pick-interceptor.js +26 -5
- package/cjs/picker/pick-interceptor.js.map +1 -1
- package/cjs/picker/pick-modules.js +2 -0
- package/cjs/picker/pick-modules.js.map +1 -1
- package/cjs/picker/picker-service.d.ts +1 -1
- package/cjs/picker/picker-service.js +5 -4
- package/cjs/picker/picker-service.js.map +1 -1
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.d.ts +1 -0
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js +7 -0
- package/cjs/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.js +2 -2
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/arc3d-render.js +2 -2
- package/cjs/render/contributions/render/arc3d-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.js +1 -1
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/base-render.js.map +1 -1
- package/cjs/render/contributions/render/circle-render.js +1 -1
- package/cjs/render/contributions/render/circle-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js +2 -2
- package/cjs/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/draw-contribution.js +11 -2
- package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
- package/cjs/render/contributions/render/draw-interceptor.d.ts +15 -1
- package/cjs/render/contributions/render/draw-interceptor.js +82 -1
- package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
- package/cjs/render/contributions/render/group-render.js +1 -1
- package/cjs/render/contributions/render/group-render.js.map +1 -1
- package/cjs/render/contributions/render/image-render.js +3 -2
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/cjs/render/contributions/render/incremental-area-render.js +1 -1
- package/cjs/render/contributions/render/incremental-area-render.js.map +1 -1
- package/cjs/render/contributions/render/incremental-line-render.js +1 -1
- package/cjs/render/contributions/render/incremental-line-render.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +1 -1
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/render/contributions/render/module.js +4 -0
- package/cjs/render/contributions/render/module.js.map +1 -1
- package/cjs/render/contributions/render/path-render.js +1 -1
- package/cjs/render/contributions/render/path-render.js.map +1 -1
- package/cjs/render/contributions/render/polygon-render.js +2 -2
- package/cjs/render/contributions/render/polygon-render.js.map +1 -1
- package/cjs/render/contributions/render/rect-render.js +1 -1
- package/cjs/render/contributions/render/rect-render.js.map +1 -1
- package/cjs/render/contributions/render/symbol-render.js +1 -1
- package/cjs/render/contributions/render/symbol-render.js.map +1 -1
- package/cjs/render/contributions/render/text-render.js +11 -4
- package/cjs/render/contributions/render/text-render.js.map +1 -1
- package/cjs/render/contributions/render/utils.js +2 -2
- package/cjs/render/contributions/render/utils.js.map +1 -1
- package/dist/index.js +945 -2430
- package/dist/index.min.js +1 -1
- package/es/animate/animate.js +8 -2
- package/es/animate/animate.js.map +1 -1
- package/es/core/application.js +1 -1
- package/es/core/camera.js +1 -1
- package/es/core/constants.d.ts +3 -0
- package/es/core/constants.js +7 -1
- package/es/core/constants.js.map +1 -1
- package/es/core/contributions/layerHandler/canvas2d-contribution.d.ts +3 -1
- package/es/core/contributions/layerHandler/canvas2d-contribution.js +1 -1
- package/es/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
- package/es/core/contributions/layerHandler/empty-contribution.d.ts +24 -0
- package/es/core/contributions/layerHandler/empty-contribution.js +53 -0
- package/es/core/contributions/layerHandler/empty-contribution.js.map +1 -0
- package/es/core/contributions/layerHandler/modules.js +6 -2
- package/es/core/contributions/layerHandler/modules.js.map +1 -1
- package/es/core/contributions/layerHandler/offscreen2d-contribution.d.ts +3 -1
- package/es/core/contributions/layerHandler/offscreen2d-contribution.js +1 -1
- package/es/core/contributions/layerHandler/offscreen2d-contribution.js.map +1 -1
- package/es/core/core-modules.js +1 -1
- package/es/core/global-module.js +2 -0
- package/es/core/layer-service.d.ts +5 -2
- package/es/core/layer-service.js +26 -2
- package/es/core/layer-service.js.map +1 -1
- package/es/core/layer.d.ts +4 -3
- package/es/core/layer.js +11 -7
- package/es/core/layer.js.map +1 -1
- package/es/core/stage.d.ts +8 -7
- package/es/core/stage.js +33 -34
- package/es/core/stage.js.map +1 -1
- package/es/event/constant.js +1 -1
- package/es/event/event-manager.js +1 -1
- package/es/event/event-system.js +1 -1
- package/es/event/event-target.js +1 -1
- package/es/event/index.js +1 -1
- package/es/graphic/config.d.ts +2 -1
- package/es/graphic/config.js +12 -4
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic-service/common-contribution.js +1 -1
- package/es/graphic/graphic-service/common-contribution.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.d.ts +2 -0
- package/es/graphic/graphic-service/graphic-service.js +4 -0
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic-service/symbol-contribution.js +1 -1
- package/es/graphic/graphic-service/symbol-contribution.js.map +1 -1
- package/es/graphic/graphic.d.ts +3 -0
- package/es/graphic/graphic.js +47 -21
- package/es/graphic/graphic.js.map +1 -1
- package/es/graphic/node-tree.d.ts +1 -1
- package/es/graphic/node-tree.js +2 -2
- package/es/graphic/node-tree.js.map +1 -1
- package/es/graphic/text.d.ts +12 -0
- package/es/graphic/text.js +31 -5
- package/es/graphic/text.js.map +1 -1
- package/es/interface/context.d.ts +2 -1
- package/es/interface/context.js.map +1 -1
- package/es/interface/core.d.ts +2 -1
- package/es/interface/core.js.map +1 -1
- package/es/interface/event.d.ts +1 -0
- package/es/interface/event.js.map +1 -1
- package/es/interface/graphic/text.d.ts +3 -0
- package/es/interface/graphic/text.js.map +1 -1
- package/es/interface/graphic-service.d.ts +2 -0
- package/es/interface/graphic-service.js.map +1 -1
- package/es/interface/graphic.d.ts +9 -2
- package/es/interface/graphic.js.map +1 -1
- package/es/interface/layer.d.ts +9 -2
- package/es/interface/layer.js.map +1 -1
- package/es/interface/picker.d.ts +5 -5
- package/es/interface/picker.js.map +1 -1
- package/es/interface/render.d.ts +1 -1
- package/es/interface/render.js.map +1 -1
- package/es/interface/stage.d.ts +6 -10
- package/es/interface/stage.js.map +1 -1
- package/es/picker/global-picker-service.d.ts +1 -1
- package/es/picker/global-picker-service.js +14 -4
- package/es/picker/global-picker-service.js.map +1 -1
- package/es/picker/pick-interceptor.d.ts +9 -3
- package/es/picker/pick-interceptor.js +26 -4
- package/es/picker/pick-interceptor.js.map +1 -1
- package/es/picker/pick-modules.js +2 -1
- package/es/picker/pick-modules.js.map +1 -1
- package/es/picker/picker-service.d.ts +1 -1
- package/es/picker/picker-service.js +4 -4
- package/es/picker/picker-service.js.map +1 -1
- package/es/plugins/builtin-plugin/html-attribute-plugin.d.ts +1 -0
- package/es/plugins/builtin-plugin/html-attribute-plugin.js +7 -0
- package/es/plugins/builtin-plugin/html-attribute-plugin.js.map +1 -1
- package/es/render/contributions/render/arc-render.js +2 -2
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/arc3d-render.js +2 -2
- package/es/render/contributions/render/arc3d-render.js.map +1 -1
- package/es/render/contributions/render/area-render.js +1 -1
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/base-render.js.map +1 -1
- package/es/render/contributions/render/circle-render.js +1 -1
- package/es/render/contributions/render/circle-render.js.map +1 -1
- package/es/render/contributions/render/contributions/arc-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/arc-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/circle-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/circle-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/rect-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
- package/es/render/contributions/render/contributions/symbol-contribution-render.js +2 -2
- package/es/render/contributions/render/contributions/symbol-contribution-render.js.map +1 -1
- package/es/render/contributions/render/draw-contribution.js +11 -2
- package/es/render/contributions/render/draw-contribution.js.map +1 -1
- package/es/render/contributions/render/draw-interceptor.d.ts +15 -1
- package/es/render/contributions/render/draw-interceptor.js +84 -1
- package/es/render/contributions/render/draw-interceptor.js.map +1 -1
- package/es/render/contributions/render/group-render.js +1 -1
- package/es/render/contributions/render/group-render.js.map +1 -1
- package/es/render/contributions/render/image-render.js +3 -2
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/es/render/contributions/render/incremental-area-render.js +1 -1
- package/es/render/contributions/render/incremental-area-render.js.map +1 -1
- package/es/render/contributions/render/incremental-line-render.js +1 -1
- package/es/render/contributions/render/incremental-line-render.js.map +1 -1
- package/es/render/contributions/render/line-render.js +1 -1
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/render/contributions/render/module.js +3 -1
- package/es/render/contributions/render/module.js.map +1 -1
- package/es/render/contributions/render/path-render.js +1 -1
- package/es/render/contributions/render/path-render.js.map +1 -1
- package/es/render/contributions/render/polygon-render.js +2 -2
- package/es/render/contributions/render/polygon-render.js.map +1 -1
- package/es/render/contributions/render/rect-render.js +1 -1
- package/es/render/contributions/render/rect-render.js.map +1 -1
- package/es/render/contributions/render/symbol-render.js +1 -1
- package/es/render/contributions/render/symbol-render.js.map +1 -1
- package/es/render/contributions/render/text-render.js +11 -4
- package/es/render/contributions/render/text-render.js.map +1 -1
- package/es/render/contributions/render/utils.js +2 -2
- package/es/render/contributions/render/utils.js.map +1 -1
- package/package.json +3 -3
package/es/graphic/text.d.ts
CHANGED
|
@@ -53,6 +53,18 @@ export declare class Text extends Graphic<ITextGraphicAttribute> implements ITex
|
|
|
53
53
|
updateSingallineAABBBounds(text: number | string): AABBBounds;
|
|
54
54
|
updateMultilineAABBBounds(text: (number | string)[]): AABBBounds;
|
|
55
55
|
updateHorizontalSinglelineAABBBounds(text: number | string): AABBBounds;
|
|
56
|
+
getBaselineMapAlign(): Record<string, string>;
|
|
57
|
+
getAlignMapBaseline(): Record<string, string>;
|
|
58
|
+
static baselineMapAlign: {
|
|
59
|
+
top: string;
|
|
60
|
+
bottom: string;
|
|
61
|
+
middle: string;
|
|
62
|
+
};
|
|
63
|
+
static alignMapBaseline: {
|
|
64
|
+
left: string;
|
|
65
|
+
right: string;
|
|
66
|
+
center: string;
|
|
67
|
+
};
|
|
56
68
|
updateVerticalSinglelineAABBBounds(text: number | string): AABBBounds;
|
|
57
69
|
updateHorizontalMultilineAABBBounds(text: (number | string)[]): AABBBounds;
|
|
58
70
|
updateVerticalMultilineAABBBounds(text: (number | string)[]): AABBBounds;
|
package/es/graphic/text.js
CHANGED
|
@@ -111,11 +111,23 @@ export class Text extends Graphic {
|
|
|
111
111
|
return this._AABBBounds.set(dx, dy, dx + width, dy + lh), stroke && this._AABBBounds.expand(lineWidth / 2),
|
|
112
112
|
this._AABBBounds;
|
|
113
113
|
}
|
|
114
|
+
getBaselineMapAlign() {
|
|
115
|
+
return Text.baselineMapAlign;
|
|
116
|
+
}
|
|
117
|
+
getAlignMapBaseline() {
|
|
118
|
+
return Text.alignMapBaseline;
|
|
119
|
+
}
|
|
114
120
|
updateVerticalSinglelineAABBBounds(text) {
|
|
115
|
-
var _a;
|
|
121
|
+
var _a, _b, _c;
|
|
116
122
|
const textTheme = getTheme(this).text, textMeasure = application.graphicUtil.textMeasure;
|
|
117
123
|
let width;
|
|
118
|
-
const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis,
|
|
124
|
+
const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, fontFamily: fontFamily = textTheme.fontFamily, stroke: stroke = textTheme.stroke, lineHeight: lineHeight = (null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf), lineWidth: lineWidth = textTheme.lineWidth, verticalMode: verticalMode = textTheme.verticalMode} = attribute;
|
|
125
|
+
let {textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline} = attribute;
|
|
126
|
+
if (!verticalMode) {
|
|
127
|
+
const t = textAlign;
|
|
128
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left",
|
|
129
|
+
textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
130
|
+
}
|
|
119
131
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
120
132
|
width = this.cache.clipedWidth;
|
|
121
133
|
const dx = textDrawOffsetX(textAlign, width), dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);
|
|
@@ -170,10 +182,16 @@ export class Text extends Graphic {
|
|
|
170
182
|
stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
171
183
|
}
|
|
172
184
|
updateVerticalMultilineAABBBounds(text) {
|
|
173
|
-
var _a;
|
|
185
|
+
var _a, _b, _c;
|
|
174
186
|
const textTheme = getTheme(this).text, textMeasure = application.graphicUtil.textMeasure;
|
|
175
187
|
let width;
|
|
176
|
-
const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis,
|
|
188
|
+
const attribute = this.attribute, {ignoreBuf: ignoreBuf = textTheme.ignoreBuf} = attribute, buf = ignoreBuf ? 0 : 2, {maxLineWidth: maxLineWidth = textTheme.maxLineWidth, ellipsis: ellipsis = textTheme.ellipsis, fontFamily: fontFamily = textTheme.fontFamily, fontSize: fontSize = textTheme.fontSize, fontWeight: fontWeight = textTheme.fontWeight, stroke: stroke = textTheme.stroke, lineHeight: lineHeight = (null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf), lineWidth: lineWidth = textTheme.lineWidth, verticalMode: verticalMode = textTheme.verticalMode} = attribute;
|
|
189
|
+
let {textAlign: textAlign = textTheme.textAlign, textBaseline: textBaseline = textTheme.textBaseline} = attribute;
|
|
190
|
+
if (!verticalMode) {
|
|
191
|
+
const t = textAlign;
|
|
192
|
+
textAlign = null !== (_b = Text.baselineMapAlign[textBaseline]) && void 0 !== _b ? _b : "left",
|
|
193
|
+
textBaseline = null !== (_c = Text.alignMapBaseline[t]) && void 0 !== _c ? _c : "top";
|
|
194
|
+
}
|
|
177
195
|
if (width = 0, !this.shouldUpdateShape() && this.cache) {
|
|
178
196
|
this.cache.verticalList.forEach((item => {
|
|
179
197
|
const w = item.reduce(((a, b) => a + b.width), 0);
|
|
@@ -243,5 +261,13 @@ Text.NOWORK_ANIMATE_ATTR = Object.assign({
|
|
|
243
261
|
textBaseline: 1,
|
|
244
262
|
fontFamily: 1,
|
|
245
263
|
fontWeight: 1
|
|
246
|
-
}, NOWORK_ANIMATE_ATTR)
|
|
264
|
+
}, NOWORK_ANIMATE_ATTR), Text.baselineMapAlign = {
|
|
265
|
+
top: "left",
|
|
266
|
+
bottom: "right",
|
|
267
|
+
middle: "center"
|
|
268
|
+
}, Text.alignMapBaseline = {
|
|
269
|
+
left: "top",
|
|
270
|
+
right: "bottom",
|
|
271
|
+
center: "middle"
|
|
272
|
+
};
|
|
247
273
|
//# sourceMappingURL=text.js.map
|
package/es/graphic/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/text.ts"],"names":[],"mappings":"AAAA,OAAO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AC1B,CAAC;IAED,mBAAmB,CAAC,IAAY;QAC9B,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QACtC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAES,cAAc,CAAC,IAAc,EAAE,CAAC,GAAG,mBAAmB;QAC9D,OAAO,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IACS,aAAa,CAAC,GAAW,EAAE,CAAC,GAAG,mBAAmB;QAC1D,OAAO,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACH,OAAO,IAAI,IAAI,mBAAM,IAAI,CAAC,SAAS,EAAG,CAAC;IACzC,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;;AAtdM,wBAAmB,mBACxB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,CAAC,EACZ,SAAS,EAAE,CAAC,EACZ,SAAS,EAAE,CAAC,EACZ,YAAY,EAAE,CAAC,EACf,UAAU,EAAE,CAAC,EACb,UAAU,EAAE,CAAC,IACV,mBAAmB,EACtB","file":"text.js","sourcesContent":["import { max, type AABBBounds, type OBBBounds } from '@visactor/vutils';\nimport { getContextFont, textDrawOffsetX, textLayoutOffsetY } from '../common/text';\nimport { CanvasTextLayout } from '../core/contributions/textMeasure/layout';\nimport { application } from '../application';\nimport type { IText, ITextCache, ITextGraphicAttribute, LayoutType } from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { getTheme } from './theme';\nimport { parsePadding } from '../common/utils';\nimport { TEXT_NUMBER_TYPE } from './constants';\nimport { TextDirection, verticalLayout } from './tools';\n\nconst TEXT_UPDATE_TAG_KEY = [\n 'text',\n 'maxLineWidth',\n // 'textAlign',\n // 'textBaseline',\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'ellipsis',\n 'lineHeight',\n 'direction',\n 'wordBreak',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class Text extends Graphic<ITextGraphicAttribute> implements IText {\n type: 'text' = 'text';\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n direction: 1,\n textAlign: 1,\n textBaseline: 1,\n fontFamily: 1,\n fontWeight: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n cache: ITextCache;\n _font: string;\n\n get font(): string {\n const textTheme = getTheme(this).text;\n if (!this._font) {\n this._font = getContextFont(this.attribute, textTheme);\n }\n return this._font as string;\n }\n\n get clipedText(): string | undefined {\n const attribute = this.attribute;\n const textTheme = getTheme(this).text;\n if (Array.isArray(attribute.text)) {\n return undefined;\n }\n const { maxLineWidth = textTheme.maxLineWidth } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return (attribute.text ?? textTheme.text).toString();\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedText;\n }\n get clipedWidth(): number | undefined {\n if (Array.isArray(this.attribute.text)) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedWidth;\n }\n get cliped(): boolean | undefined {\n const textTheme = getTheme(this).text;\n const attribute = this.attribute;\n if (Array.isArray(attribute.text)) {\n return undefined;\n }\n const { maxLineWidth = textTheme.maxLineWidth } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return false;\n }\n this.tryUpdateAABBBounds();\n return this.clipedText !== attribute.text.toString();\n }\n get multilineLayout(): LayoutType | undefined {\n if (!Array.isArray(this.attribute.text)) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.layoutData;\n }\n\n constructor(params: ITextGraphicAttribute = { text: '', fontSize: 16 }) {\n super(params);\n this.numberType = TEXT_NUMBER_TYPE;\n this.cache = {};\n }\n\n isValid(): boolean {\n return super.isValid() && this._isValid();\n }\n protected _isValid(): boolean {\n const { text } = this.attribute;\n return text != null && text !== '';\n }\n\n protected doUpdateAABBBounds(): AABBBounds {\n const textTheme = getTheme(this).text;\n this._AABBBounds.setValue(Infinity, Infinity, -Infinity, -Infinity);\n const attribute = this.attribute;\n const bounds = application.graphicService.updateTextAABBBounds(\n attribute,\n textTheme,\n this._AABBBounds,\n this\n ) as AABBBounds;\n\n const { boundsPadding = textTheme.boundsPadding } = this.attribute;\n const paddingArray = parsePadding(boundsPadding);\n if (paddingArray) {\n bounds.expand(paddingArray);\n }\n\n this.clearUpdateBoundTag();\n return bounds;\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateSingallineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const { direction = textTheme.direction } = this.attribute;\n\n return direction === 'horizontal'\n ? this.updateHorizontalSinglelineAABBBounds(text)\n : this.updateVerticalSinglelineAABBBounds(text);\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const { direction = textTheme.direction } = this.attribute;\n\n return direction === 'horizontal'\n ? this.updateHorizontalMultilineAABBBounds(text)\n : this.updateVerticalMultilineAABBBounds(text);\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateHorizontalSinglelineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak,\n ignoreBuf = textTheme.ignoreBuf\n } = attribute;\n const buf = ignoreBuf ? 0 : Math.max(2, fontSize * 0.075);\n const { lineHeight = attribute.lineHeight ?? (attribute.fontSize || textTheme.fontSize) + buf } = attribute;\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth ?? 0;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffix(\n text.toString(),\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false\n );\n str = data.str;\n width = data.width;\n } else {\n const data = textMeasure.clipText(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, false);\n str = data.str;\n width = data.width;\n }\n this.cache.clipedText = str;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontWeight, fontFamily });\n this.cache.clipedText = text.toString();\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n let lh = lineHeight;\n if (application.global && application.global.isSafari()) {\n // 如果是safari,那么需要额外增加高度\n lh += fontSize * 0.2;\n }\n const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);\n this._AABBBounds.set(dx, dy, dx + width, dy + lh);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算垂直布局的单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalSinglelineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n fontFamily = textTheme.fontFamily,\n stroke = textTheme.stroke,\n lineHeight = attribute.lineHeight ?? (attribute.fontSize || textTheme.fontSize) + buf,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak\n } = attribute;\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n let verticalList: { text: string; width?: number; direction: TextDirection }[][] = [\n verticalLayout(text.toString())\n ];\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false\n );\n verticalList = [data.verticalList];\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalList = [data.verticalList];\n width = data.width;\n }\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalList[0].forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算多行文字的bounds,缓存每行文字的布局位置\n * @param text\n */\n updateHorizontalMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const attribute = this.attribute;\n const {\n fontFamily = textTheme.fontFamily,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n lineHeight = attribute.lineHeight || attribute.fontSize || textTheme.fontSize,\n ellipsis = textTheme.ellipsis,\n maxLineWidth,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak\n } = attribute;\n\n if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n const bbox = this.cache.layoutData.bbox;\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n const textMeasure = application.graphicUtil.textMeasure;\n const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);\n const layoutData = layoutObj.GetLayoutByLines(\n text,\n textAlign,\n textBaseline as any,\n lineHeight,\n ellipsis === true ? (textTheme.ellipsis as string) : ellipsis || undefined,\n false,\n maxLineWidth\n );\n const { bbox } = layoutData;\n this.cache.layoutData = layoutData;\n this.clearUpdateShapeTag();\n\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算垂直布局的多行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineHeight = attribute.lineHeight ?? (attribute.fontSize || textTheme.fontSize) + buf,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak\n } = attribute;\n width = 0;\n if (!this.shouldUpdateShape() && this.cache) {\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n const verticalLists: { text: string; width?: number; direction: TextDirection }[][] = text.map(str => {\n return verticalLayout(str.toString());\n });\n verticalLists.forEach((verticalData, i) => {\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n }\n // this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalData.forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n }\n });\n this.cache.verticalList = verticalLists;\n this.clearUpdateShapeTag();\n\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n protected tryUpdateOBBBounds(): OBBBounds {\n throw new Error('暂不支持');\n }\n\n getDefaultAttribute(name: string) {\n const textTheme = getTheme(this).text;\n return textTheme[name];\n }\n\n protected needUpdateTags(keys: string[], k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTags(keys, k);\n }\n protected needUpdateTag(key: string, k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTag(key, k);\n }\n\n clone(): Text {\n return new Text({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Text.NOWORK_ANIMATE_ATTR;\n }\n}\n\n// addAttributeToPrototype(DefaultLineStyle, Text, PURE_STYLE_KEY);\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graphic/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmC,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,EAAE,QAAQ,E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B,GAAG;IACxB,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;CACjB,CAAC","file":"text.js","sourcesContent":["import { max, type AABBBounds, type OBBBounds } from '@visactor/vutils';\nimport { getContextFont, textDrawOffsetX, textLayoutOffsetY } from '../common/text';\nimport { CanvasTextLayout } from '../core/contributions/textMeasure/layout';\nimport { application } from '../application';\nimport type { IText, ITextCache, ITextGraphicAttribute, LayoutType } from '../interface';\nimport { Graphic, GRAPHIC_UPDATE_TAG_KEY, NOWORK_ANIMATE_ATTR } from './graphic';\nimport { getTheme } from './theme';\nimport { parsePadding } from '../common/utils';\nimport { TEXT_NUMBER_TYPE } from './constants';\nimport { TextDirection, verticalLayout } from './tools';\n\nconst TEXT_UPDATE_TAG_KEY = [\n 'text',\n 'maxLineWidth',\n // 'textAlign',\n // 'textBaseline',\n 'fontSize',\n 'fontFamily',\n 'fontWeight',\n 'ellipsis',\n 'lineHeight',\n 'direction',\n 'wordBreak',\n ...GRAPHIC_UPDATE_TAG_KEY\n];\n\nexport class Text extends Graphic<ITextGraphicAttribute> implements IText {\n type: 'text' = 'text';\n\n static NOWORK_ANIMATE_ATTR = {\n ellipsis: 1,\n wordBreak: 1,\n direction: 1,\n textAlign: 1,\n textBaseline: 1,\n fontFamily: 1,\n fontWeight: 1,\n ...NOWORK_ANIMATE_ATTR\n };\n\n cache: ITextCache;\n _font: string;\n\n get font(): string {\n const textTheme = getTheme(this).text;\n if (!this._font) {\n this._font = getContextFont(this.attribute, textTheme);\n }\n return this._font as string;\n }\n\n get clipedText(): string | undefined {\n const attribute = this.attribute;\n const textTheme = getTheme(this).text;\n if (Array.isArray(attribute.text)) {\n return undefined;\n }\n const { maxLineWidth = textTheme.maxLineWidth } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return (attribute.text ?? textTheme.text).toString();\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedText;\n }\n get clipedWidth(): number | undefined {\n if (Array.isArray(this.attribute.text)) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.clipedWidth;\n }\n get cliped(): boolean | undefined {\n const textTheme = getTheme(this).text;\n const attribute = this.attribute;\n if (Array.isArray(attribute.text)) {\n return undefined;\n }\n const { maxLineWidth = textTheme.maxLineWidth } = attribute;\n if (!Number.isFinite(maxLineWidth)) {\n return false;\n }\n this.tryUpdateAABBBounds();\n return this.clipedText !== attribute.text.toString();\n }\n get multilineLayout(): LayoutType | undefined {\n if (!Array.isArray(this.attribute.text)) {\n return undefined;\n }\n this.tryUpdateAABBBounds();\n return this.cache.layoutData;\n }\n\n constructor(params: ITextGraphicAttribute = { text: '', fontSize: 16 }) {\n super(params);\n this.numberType = TEXT_NUMBER_TYPE;\n this.cache = {};\n }\n\n isValid(): boolean {\n return super.isValid() && this._isValid();\n }\n protected _isValid(): boolean {\n const { text } = this.attribute;\n return text != null && text !== '';\n }\n\n protected doUpdateAABBBounds(): AABBBounds {\n const textTheme = getTheme(this).text;\n this._AABBBounds.setValue(Infinity, Infinity, -Infinity, -Infinity);\n const attribute = this.attribute;\n const bounds = application.graphicService.updateTextAABBBounds(\n attribute,\n textTheme,\n this._AABBBounds,\n this\n ) as AABBBounds;\n\n const { boundsPadding = textTheme.boundsPadding } = this.attribute;\n const paddingArray = parsePadding(boundsPadding);\n if (paddingArray) {\n bounds.expand(paddingArray);\n }\n\n this.clearUpdateBoundTag();\n return bounds;\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateSingallineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const { direction = textTheme.direction } = this.attribute;\n\n return direction === 'horizontal'\n ? this.updateHorizontalSinglelineAABBBounds(text)\n : this.updateVerticalSinglelineAABBBounds(text);\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const { direction = textTheme.direction } = this.attribute;\n\n return direction === 'horizontal'\n ? this.updateHorizontalMultilineAABBBounds(text)\n : this.updateVerticalMultilineAABBBounds(text);\n }\n\n /**\n * 计算单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateHorizontalSinglelineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak,\n ignoreBuf = textTheme.ignoreBuf\n } = attribute;\n const buf = ignoreBuf ? 0 : Math.max(2, fontSize * 0.075);\n const { lineHeight = attribute.lineHeight ?? (attribute.fontSize || textTheme.fontSize) + buf } = attribute;\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth ?? 0;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dx, dy, dx + width, dy + lineHeight);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffix(\n text.toString(),\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false\n );\n str = data.str;\n width = data.width;\n } else {\n const data = textMeasure.clipText(text.toString(), { fontSize, fontWeight, fontFamily }, maxLineWidth, false);\n str = data.str;\n width = data.width;\n }\n this.cache.clipedText = str;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontWeight, fontFamily });\n this.cache.clipedText = text.toString();\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n let lh = lineHeight;\n if (application.global && application.global.isSafari()) {\n // 如果是safari,那么需要额外增加高度\n lh += fontSize * 0.2;\n }\n const dy = textLayoutOffsetY(textBaseline, lh, fontSize, buf);\n this._AABBBounds.set(dx, dy, dx + width, dy + lh);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n getBaselineMapAlign(): Record<string, string> {\n return Text.baselineMapAlign;\n }\n\n getAlignMapBaseline(): Record<string, string> {\n return Text.alignMapBaseline;\n }\n\n static baselineMapAlign = {\n top: 'left',\n bottom: 'right',\n middle: 'center'\n };\n\n static alignMapBaseline = {\n left: 'top',\n right: 'bottom',\n center: 'middle'\n };\n\n /**\n * 计算垂直布局的单行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalSinglelineAABBBounds(text: number | string): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n let str: string;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n fontFamily = textTheme.fontFamily,\n stroke = textTheme.stroke,\n lineHeight = attribute.lineHeight ?? (attribute.fontSize || textTheme.fontSize) + buf,\n lineWidth = textTheme.lineWidth,\n verticalMode = textTheme.verticalMode\n } = attribute;\n\n let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;\n if (!verticalMode) {\n const t = textAlign;\n textAlign = Text.baselineMapAlign[textBaseline] ?? 'left';\n textBaseline = Text.alignMapBaseline[t] ?? 'top';\n }\n if (!this.shouldUpdateShape() && this.cache) {\n width = this.cache.clipedWidth;\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n let verticalList: { text: string; width?: number; direction: TextDirection }[][] = [\n verticalLayout(text.toString())\n ];\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false\n );\n verticalList = [data.verticalList];\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalList[0],\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalList = [data.verticalList];\n width = data.width;\n }\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalList[0].forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n this.cache.verticalList = verticalList;\n this.cache.clipedWidth = width;\n }\n this.clearUpdateShapeTag();\n\n const dx = textDrawOffsetX(textAlign, width);\n const dy = textLayoutOffsetY(textBaseline, lineHeight, fontSize);\n this._AABBBounds.set(dy, dx, dy + lineHeight, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算多行文字的bounds,缓存每行文字的布局位置\n * @param text\n */\n updateHorizontalMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const attribute = this.attribute;\n const {\n fontFamily = textTheme.fontFamily,\n textAlign = textTheme.textAlign,\n textBaseline = textTheme.textBaseline,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n lineHeight = attribute.lineHeight || attribute.fontSize || textTheme.fontSize,\n ellipsis = textTheme.ellipsis,\n maxLineWidth,\n stroke = textTheme.stroke,\n lineWidth = textTheme.lineWidth,\n wordBreak = textTheme.wordBreak\n } = attribute;\n\n if (!this.shouldUpdateShape() && this.cache?.layoutData) {\n const bbox = this.cache.layoutData.bbox;\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n const textMeasure = application.graphicUtil.textMeasure;\n const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);\n const layoutData = layoutObj.GetLayoutByLines(\n text,\n textAlign,\n textBaseline as any,\n lineHeight,\n ellipsis === true ? (textTheme.ellipsis as string) : ellipsis || undefined,\n false,\n maxLineWidth\n );\n const { bbox } = layoutData;\n this.cache.layoutData = layoutData;\n this.clearUpdateShapeTag();\n\n this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n /**\n * 计算垂直布局的多行文字的bounds,可以缓存长度以及截取的文字\n * @param text\n */\n updateVerticalMultilineAABBBounds(text: (number | string)[]): AABBBounds {\n const textTheme = getTheme(this).text;\n const textMeasure = application.graphicUtil.textMeasure;\n let width: number;\n const attribute = this.attribute;\n const { ignoreBuf = textTheme.ignoreBuf } = attribute;\n const buf = ignoreBuf ? 0 : 2;\n const {\n maxLineWidth = textTheme.maxLineWidth,\n ellipsis = textTheme.ellipsis,\n fontFamily = textTheme.fontFamily,\n fontSize = textTheme.fontSize,\n fontWeight = textTheme.fontWeight,\n stroke = textTheme.stroke,\n lineHeight = attribute.lineHeight ?? (attribute.fontSize || textTheme.fontSize) + buf,\n lineWidth = textTheme.lineWidth,\n // wordBreak = textTheme.wordBreak,\n verticalMode = textTheme.verticalMode\n } = attribute;\n let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;\n if (!verticalMode) {\n const t = textAlign;\n textAlign = Text.baselineMapAlign[textBaseline] ?? 'left';\n textBaseline = Text.alignMapBaseline[t] ?? 'top';\n }\n width = 0;\n if (!this.shouldUpdateShape() && this.cache) {\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n return this._AABBBounds;\n }\n\n const verticalLists: { text: string; width?: number; direction: TextDirection }[][] = text.map(str => {\n return verticalLayout(str.toString());\n });\n verticalLists.forEach((verticalData, i) => {\n if (Number.isFinite(maxLineWidth)) {\n if (ellipsis) {\n const strEllipsis = (ellipsis === true ? textTheme.ellipsis : ellipsis) as string;\n const data = textMeasure.clipTextWithSuffixVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n strEllipsis,\n false\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n } else {\n const data = textMeasure.clipTextVertical(\n verticalData,\n { fontSize, fontWeight, fontFamily },\n maxLineWidth,\n false\n );\n verticalLists[i] = data.verticalList;\n width = data.width;\n }\n // this.cache.clipedWidth = width;\n // todo 计算原本的宽度\n } else {\n width = 0;\n verticalData.forEach(t => {\n const w =\n t.direction === TextDirection.HORIZONTAL\n ? fontSize\n : textMeasure.measureTextWidth(t.text, { fontSize, fontWeight, fontFamily });\n\n width += w;\n t.width = w;\n });\n }\n });\n this.cache.verticalList = verticalLists;\n this.clearUpdateShapeTag();\n\n this.cache.verticalList.forEach(item => {\n const w = item.reduce((a, b) => a + b.width, 0);\n width = max(w, width);\n });\n\n const dx = textDrawOffsetX(textAlign, width);\n const height = this.cache.verticalList.length * lineHeight;\n const dy = textLayoutOffsetY(textBaseline, height, fontSize);\n this._AABBBounds.set(dy, dx, dy + height, dx + width);\n\n if (stroke) {\n this._AABBBounds.expand(lineWidth / 2);\n }\n\n return this._AABBBounds;\n }\n\n protected tryUpdateOBBBounds(): OBBBounds {\n throw new Error('暂不支持');\n }\n\n getDefaultAttribute(name: string) {\n const textTheme = getTheme(this).text;\n return textTheme[name];\n }\n\n protected needUpdateTags(keys: string[], k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTags(keys, k);\n }\n protected needUpdateTag(key: string, k = TEXT_UPDATE_TAG_KEY): boolean {\n return super.needUpdateTag(key, k);\n }\n\n clone(): Text {\n return new Text({ ...this.attribute });\n }\n\n getNoWorkAnimateAttr(): Record<string, number> {\n return Text.NOWORK_ANIMATE_ATTR;\n }\n}\n\n// addAttributeToPrototype(DefaultLineStyle, Text, PURE_STYLE_KEY);\n"]}
|
|
@@ -16,6 +16,7 @@ export interface ICommonStyleParams {
|
|
|
16
16
|
shadowColor?: string;
|
|
17
17
|
shadowOffsetX?: number;
|
|
18
18
|
shadowOffsetY?: number;
|
|
19
|
+
globalCompositeOperation?: CanvasRenderingContext2D['globalCompositeOperation'] | '';
|
|
19
20
|
opacity?: number;
|
|
20
21
|
blur?: number;
|
|
21
22
|
}
|
|
@@ -132,7 +133,7 @@ export interface IContext2d extends Releaseable {
|
|
|
132
133
|
strokeText: (text: string, x: number, y: number, z?: number) => void;
|
|
133
134
|
drawImage: ((image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | ICanvas | any, dstX: number, dstY: number) => void) & ((image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | ICanvas | any, dstX: number, dstY: number, dstW: number, dstH: number) => void) & ((image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | ICanvas | any, srcX: number, srcY: number, srcW: number, srcH: number, dstX: number, dstY: number, dstW: number, dstH: number) => void);
|
|
134
135
|
setCommonStyle: (params: ISetCommonStyleParams, attribute: ICommonStyleParams, offsetX: number, offsetY: number, defultParams?: ICommonStyleParams | Partial<ICommonStyleParams>[]) => void;
|
|
135
|
-
|
|
136
|
+
setShadowBlendStyle?: (params: ISetCommonStyleParams, attribute: ICommonStyleParams, defultParams?: ICommonStyleParams | Partial<ICommonStyleParams>[]) => void;
|
|
136
137
|
setStrokeStyle: (params: ISetStrokeStyleParams, attribute: IStrokeStyleParams, offsetX: number, offsetY: number, defultParams?: Required<IStrokeStyleParams> | Partial<IStrokeStyleParams>[]) => void;
|
|
137
138
|
setTextStyle: (params: Partial<ITextStyleParams>, defaultParams?: ITextStyleParams, z?: number) => void;
|
|
138
139
|
setTextStyleWithoutAlignBaseline: (params: Partial<ITextStyleParams>, defaultParams?: ITextStyleParams, z?: number) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/context.ts"],"names":[],"mappings":"","file":"context.js","sourcesContent":["import type { Matrix, IMatrix, IBoundsLike, IPointLike } from '@visactor/vutils';\nimport type { ICamera } from './camera';\nimport type { ICanvas } from './canvas';\nimport type { Releaseable } from './common';\nimport type { mat4, vec3 } from './matrix';\nimport type { IFillType, IStrokeType, ITransform } from './graphic';\n\nexport interface IConicalGradientData {\n addColorStop: (pos: number, color: string) => void;\n readonly stops: [number, string][];\n GetPattern: (minW: number, minH: number, deltaAngle?: number) => CanvasPattern | null;\n}\n\n// 用于commonStyle函数的参数\nexport interface ICommonStyleParams {\n fill?: IFillType;\n fillOpacity?: number;\n shadowBlur?: number;\n shadowColor?: string;\n shadowOffsetX?: number;\n shadowOffsetY?: number;\n opacity?: number;\n blur?: number;\n}\n\nexport interface IStrokeStyleParams {\n stroke?: IStrokeType | IStrokeType[];\n strokeOpacity?: number;\n lineDash?: number[];\n lineDashOffset?: number;\n lineWidth?: number;\n lineCap?: CanvasLineCap;\n lineJoin?: CanvasLineJoin;\n miterLimit?: number;\n opacity?: number;\n}\nexport interface ITextStyleParams {\n font?: string;\n fontSize: number;\n fontFamily?: string;\n fontWeight?: string | number;\n textAlign?: CanvasTextAlign;\n textBaseline?: CanvasTextBaseline;\n scaleIn3d?: boolean;\n}\n\nexport interface ISetCommonStyleParams {\n attribute: Partial<ICommonStyleParams & ITransform>;\n AABBBounds: IBoundsLike;\n}\n\nexport interface ISetStrokeStyleParams {\n attribute: Partial<IStrokeStyleParams & ITransform>;\n AABBBounds: IBoundsLike;\n}\nexport interface IContext2d extends Releaseable {\n stack: IMatrix[];\n inuse?: boolean;\n camera?: ICamera;\n modelMatrix?: mat4;\n drawPromise?: Promise<any>;\n // 属性代理\n fillStyle: string | CanvasGradient | CanvasPattern;\n disableFill?: boolean;\n disableStroke?: boolean;\n disableBeginPath?: boolean;\n /**\n * @deprecated font方法不建议使用,请使用setTextStyle\n */\n font: string;\n globalAlpha: number;\n lineCap: string;\n lineDashOffset: number;\n lineJoin: string;\n lineWidth: number;\n miterLimit: number;\n shadowBlur: number;\n shadowColor: string;\n shadowOffsetX: number;\n shadowOffsetY: number;\n strokeStyle: string | CanvasGradient | CanvasPattern;\n dpr: number;\n /**\n * @deprecated textAlign方法不建议使用,请使用setTextStyle\n */\n textAlign: string;\n /**\n * @deprecated textBaseline方法不建议使用,请使用setTextStyle\n */\n textBaseline: string;\n nativeContext: CanvasRenderingContext2D | any;\n canvas: ICanvas;\n [key: string]: any; //类型没有索引签名\n\n getCanvas: () => ICanvas;\n\n getContext: () => any;\n\n /**\n * 设置当前ctx 的transform信息\n */\n setTransformForCurrent: (force?: boolean) => void;\n /**\n * 获取当前矩阵信息\n */\n currentMatrix: IMatrix;\n\n /**\n * 清空画布\n */\n clear: () => void;\n\n restore: () => void;\n highPerformanceRestore: () => void;\n\n /**\n *\n * @param angle 弧度数\n */\n rotate: (angle: number, setTransform?: boolean) => void;\n\n save: () => void;\n highPerformanceSave: () => void;\n\n project?: (x: number, y: number, z?: number) => IPointLike;\n view?: (x: number, y: number, z?: number) => vec3;\n\n scale: (x: number, y: number, setTransform?: boolean) => void;\n\n scalePoint: (sx: number, sy: number, px: number, py: number, setTransform?: boolean) => void;\n transform: (\n m11: number,\n m12: number,\n m21: number,\n m22: number,\n dx: number,\n dy: number,\n setTransform?: boolean\n ) => void;\n transformFromMatrix: (matrix: Matrix, setTransform?: boolean) => void;\n setTransform: (\n m11: number,\n m12: number,\n m21: number,\n m22: number,\n dx: number,\n dy: number,\n setTransform?: boolean,\n dpr?: number\n ) => void;\n setTransformFromMatrix: (matrix: Matrix, setTransform?: boolean, dpr?: number) => void;\n\n resetTransform: (setTransform?: boolean, dpr?: number) => void;\n\n translate: (x: number, y: number, setTransform?: boolean) => void;\n /**\n * 旋转角度,自动转换为弧度\n * @param deg 角度数\n */\n rotateDegrees: (deg: number, setTransform?: boolean) => void;\n\n /**\n * 绕点旋转\n * @param rad 弧度\n * @param x 旋转中心点x\n * @param y 旋转中心点y\n */\n rotateAbout: (rad: number, x: number, y: number, setTransform?: boolean) => void;\n\n /**\n * 绕点旋转\n * @param deg 旋转角度\n * @param x 旋转中心点x\n * @param y 旋转中心点y\n */\n rotateDegreesAbout: (deg: number, x: number, y: number, setTransform?: boolean) => void;\n\n beginPath: () => void;\n\n clip: ((fillRule?: CanvasFillRule) => void) & ((path: Path2D, fillRule?: CanvasFillRule) => void);\n\n arc: (\n x: number,\n y: number,\n radius: number,\n startAngle: number,\n endAngle: number,\n anticlockwise?: boolean,\n z?: number\n ) => void;\n\n arcTo: (x1: number, y1: number, x2: number, y2: number, radius: number) => void;\n\n bezierCurveTo: (cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number) => void;\n\n closePath: () => void;\n\n ellipse: (\n x: number,\n y: number,\n radiusX: number,\n radiusY: number,\n rotation: number,\n startAngle: number,\n endAngle: number,\n anticlockwise?: boolean\n ) => void;\n\n lineTo: (x: number, y: number, z?: number) => void;\n\n moveTo: (x: number, y: number, z?: number) => void;\n\n quadraticCurveTo: (cpx: number, cpy: number, x: number, y: number, z?: number) => void;\n\n rect: (x: number, y: number, w: number, h: number, z?: number) => void;\n\n createImageData: (imageDataOrSw: number | ImageData, sh?: number) => ImageData;\n\n createLinearGradient: (x0: number, y0: number, x1: number, y1: number) => CanvasGradient;\n\n createPattern: (\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ICanvas | any,\n repetition: string\n ) => CanvasPattern | null;\n\n createRadialGradient: (x0: number, y0: number, r0: number, x1: number, y1: number, r1: number) => CanvasGradient;\n\n createConicGradient: (x: number, y: number, startAngle: number, endAngle: number) => IConicalGradientData | null;\n\n // createConicGradient: (x: number, y: number, startAngle: number, endAngle: number) => IConicalGradient | null;\n\n // fill(fillRule?: CanvasFillRule): void;\n fill: (path?: Path2D, fillRule?: CanvasFillRule) => void;\n\n fillRect: (x: number, y: number, w: number, h: number) => void;\n\n clearRect: (x: number, y: number, w: number, h: number) => void;\n\n fillText: (text: string, x: number, y: number, z?: number) => void;\n\n getImageData: (sx: number, sy: number, sw: number, sh: number) => ImageData;\n\n getLineDash: () => number[];\n\n isPointInPath: (x: number, y: number) => boolean;\n isPointInStroke: (x: number, y: number) => boolean;\n\n measureText: (text: string, method?: 'native' | 'simple' | 'quick') => { width: number };\n\n putImageData: (imagedata: ImageData, dx: number, dy: number) => void;\n\n setLineDash: (segments: number[]) => void;\n\n stroke: (path?: Path2D) => void;\n\n strokeRect: (x: number, y: number, w: number, h: number) => void;\n\n strokeText: (text: string, x: number, y: number, z?: number) => void;\n\n drawImage: ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | ICanvas | any,\n dstX: number,\n dstY: number\n ) => void) &\n ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | ICanvas | any,\n dstX: number,\n dstY: number,\n dstW: number,\n dstH: number\n ) => void) &\n ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | ICanvas | any,\n srcX: number,\n srcY: number,\n srcW: number,\n srcH: number,\n dstX: number,\n dstY: number,\n dstW: number,\n dstH: number\n ) => void);\n\n setCommonStyle: (\n params: ISetCommonStyleParams,\n attribute: ICommonStyleParams,\n // 用于渐变色\n offsetX: number,\n offsetY: number,\n defultParams?: ICommonStyleParams | Partial<ICommonStyleParams>[]\n ) => void;\n\n setShadowStyle?: (\n params: ISetCommonStyleParams,\n attribute: ICommonStyleParams,\n defultParams?: ICommonStyleParams | Partial<ICommonStyleParams>[]\n ) => void;\n\n setStrokeStyle: (\n params: ISetStrokeStyleParams,\n attribute: IStrokeStyleParams,\n // 用于渐变色\n offsetX: number,\n offsetY: number,\n defultParams?: Required<IStrokeStyleParams> | Partial<IStrokeStyleParams>[]\n ) => void;\n\n setTextStyle: (params: Partial<ITextStyleParams>, defaultParams?: ITextStyleParams, z?: number) => void;\n setTextStyleWithoutAlignBaseline: (\n params: Partial<ITextStyleParams>,\n defaultParams?: ITextStyleParams,\n z?: number\n ) => void;\n\n draw: (...params: any) => void;\n\n clearMatrix: (setTransform?: boolean, dpr?: number) => void;\n onlyTranslate: (dpr?: number) => boolean;\n}\n\nexport interface IContextLike {\n // 属性代理\n fillStyle: string | CanvasGradient | CanvasPattern;\n /**\n * @deprecated font方法不建议使用,请使用setTextStyle\n */\n font: string;\n globalAlpha: number;\n lineCap: string;\n lineDashOffset: number;\n lineJoin: string;\n lineWidth: number;\n miterLimit: number;\n shadowBlur: number;\n shadowColor: string;\n shadowOffsetX: number;\n shadowOffsetY: number;\n strokeStyle: string | CanvasGradient | CanvasPattern;\n dpr: number;\n /**\n * @deprecated textAlign方法不建议使用,请使用setTextStyle\n */\n textAlign: string;\n /**\n * @deprecated textBaseline方法不建议使用,请使用setTextStyle\n */\n textBaseline: string;\n nativeContext: CanvasRenderingContext2D | any;\n [key: string]: any; //类型没有索引签名\n\n /**\n * 清空画布\n */\n clear: () => void;\n\n restore: () => void;\n\n save: () => void;\n\n // transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n\n translate: (x: number, y: number) => void;\n\n beginPath: () => void;\n\n clip: ((fillRule?: CanvasFillRule) => void) & ((path: Path2D, fillRule?: CanvasFillRule) => void);\n\n arc: (x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean) => void;\n\n arcTo: ((x1: number, y1: number, x2: number, y2: number, radius: number) => void) &\n ((x1: number, y1: number, x2: number, y2: number, radiusX: number, radiusY: number, rotation: number) => void);\n\n bezierCurveTo: (cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number) => void;\n\n closePath: () => void;\n\n ellipse: (\n x: number,\n y: number,\n radiusX: number,\n radiusY: number,\n rotation: number,\n startAngle: number,\n endAngle: number,\n anticlockwise?: boolean\n ) => void;\n\n lineTo: (x: number, y: number) => void;\n\n moveTo: (x: number, y: number) => void;\n\n quadraticCurveTo: (cpx: number, cpy: number, x: number, y: number) => void;\n\n rect: (x: number, y: number, w: number, h: number) => void;\n\n fill: (path?: Path2D, fillRule?: CanvasFillRule) => void;\n\n fillRect: (x: number, y: number, w: number, h: number) => void;\n\n clearRect: (x: number, y: number, w: number, h: number) => void;\n\n fillText: (text: string, x: number, y: number, maxWidth?: number) => void;\n\n getImageData: (sx: number, sy: number, sw: number, sh: number) => ImageData;\n\n getLineDash: () => number[];\n\n isPointInPath: (x: number, y: number) => boolean;\n isPointInStroke: (x: number, y: number) => boolean;\n\n measureText: (text: string, method?: 'native' | 'simple' | 'quick') => { width: number };\n\n putImageData: (\n imagedata: ImageData,\n dx: number,\n dy: number,\n dirtyX?: number,\n dirtyY?: number,\n dirtyWidth?: number,\n dirtyHeight?: number\n ) => void;\n\n setLineDash: (segments: number[]) => void;\n\n stroke: (path?: Path2D) => void;\n\n strokeRect: (x: number, y: number, w: number, h: number) => void;\n\n strokeText: (text: string, x: number, y: number, maxWidth?: number) => void;\n\n drawImage: ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | any,\n dstX: number,\n dstY: number\n ) => void) &\n ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | any,\n dstX: number,\n dstY: number,\n dstW: number,\n dstH: number\n ) => void) &\n ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | any,\n srcX: number,\n srcY: number,\n srcW: number,\n srcH: number,\n dstX: number,\n dstY: number,\n dstW: number,\n dstH: number\n ) => void);\n\n clearMatrix: () => void;\n onlyTranslate: () => boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface/context.ts"],"names":[],"mappings":"","file":"context.js","sourcesContent":["import type { Matrix, IMatrix, IBoundsLike, IPointLike } from '@visactor/vutils';\nimport type { ICamera } from './camera';\nimport type { ICanvas } from './canvas';\nimport type { Releaseable } from './common';\nimport type { mat4, vec3 } from './matrix';\nimport type { IFillType, IStrokeType, ITransform } from './graphic';\n\nexport interface IConicalGradientData {\n addColorStop: (pos: number, color: string) => void;\n readonly stops: [number, string][];\n GetPattern: (minW: number, minH: number, deltaAngle?: number) => CanvasPattern | null;\n}\n\n// 用于commonStyle函数的参数\nexport interface ICommonStyleParams {\n fill?: IFillType;\n fillOpacity?: number;\n shadowBlur?: number;\n shadowColor?: string;\n shadowOffsetX?: number;\n shadowOffsetY?: number;\n globalCompositeOperation?: CanvasRenderingContext2D['globalCompositeOperation'] | '';\n opacity?: number;\n blur?: number;\n}\n\nexport interface IStrokeStyleParams {\n stroke?: IStrokeType | IStrokeType[];\n strokeOpacity?: number;\n lineDash?: number[];\n lineDashOffset?: number;\n lineWidth?: number;\n lineCap?: CanvasLineCap;\n lineJoin?: CanvasLineJoin;\n miterLimit?: number;\n opacity?: number;\n}\nexport interface ITextStyleParams {\n font?: string;\n fontSize: number;\n fontFamily?: string;\n fontWeight?: string | number;\n textAlign?: CanvasTextAlign;\n textBaseline?: CanvasTextBaseline;\n scaleIn3d?: boolean;\n}\n\nexport interface ISetCommonStyleParams {\n attribute: Partial<ICommonStyleParams & ITransform>;\n AABBBounds: IBoundsLike;\n}\n\nexport interface ISetStrokeStyleParams {\n attribute: Partial<IStrokeStyleParams & ITransform>;\n AABBBounds: IBoundsLike;\n}\nexport interface IContext2d extends Releaseable {\n stack: IMatrix[];\n inuse?: boolean;\n camera?: ICamera;\n modelMatrix?: mat4;\n drawPromise?: Promise<any>;\n // 属性代理\n fillStyle: string | CanvasGradient | CanvasPattern;\n disableFill?: boolean;\n disableStroke?: boolean;\n disableBeginPath?: boolean;\n /**\n * @deprecated font方法不建议使用,请使用setTextStyle\n */\n font: string;\n globalAlpha: number;\n lineCap: string;\n lineDashOffset: number;\n lineJoin: string;\n lineWidth: number;\n miterLimit: number;\n shadowBlur: number;\n shadowColor: string;\n shadowOffsetX: number;\n shadowOffsetY: number;\n strokeStyle: string | CanvasGradient | CanvasPattern;\n dpr: number;\n /**\n * @deprecated textAlign方法不建议使用,请使用setTextStyle\n */\n textAlign: string;\n /**\n * @deprecated textBaseline方法不建议使用,请使用setTextStyle\n */\n textBaseline: string;\n nativeContext: CanvasRenderingContext2D | any;\n canvas: ICanvas;\n [key: string]: any; //类型没有索引签名\n\n getCanvas: () => ICanvas;\n\n getContext: () => any;\n\n /**\n * 设置当前ctx 的transform信息\n */\n setTransformForCurrent: (force?: boolean) => void;\n /**\n * 获取当前矩阵信息\n */\n currentMatrix: IMatrix;\n\n /**\n * 清空画布\n */\n clear: () => void;\n\n restore: () => void;\n highPerformanceRestore: () => void;\n\n /**\n *\n * @param angle 弧度数\n */\n rotate: (angle: number, setTransform?: boolean) => void;\n\n save: () => void;\n highPerformanceSave: () => void;\n\n project?: (x: number, y: number, z?: number) => IPointLike;\n view?: (x: number, y: number, z?: number) => vec3;\n\n scale: (x: number, y: number, setTransform?: boolean) => void;\n\n scalePoint: (sx: number, sy: number, px: number, py: number, setTransform?: boolean) => void;\n transform: (\n m11: number,\n m12: number,\n m21: number,\n m22: number,\n dx: number,\n dy: number,\n setTransform?: boolean\n ) => void;\n transformFromMatrix: (matrix: Matrix, setTransform?: boolean) => void;\n setTransform: (\n m11: number,\n m12: number,\n m21: number,\n m22: number,\n dx: number,\n dy: number,\n setTransform?: boolean,\n dpr?: number\n ) => void;\n setTransformFromMatrix: (matrix: Matrix, setTransform?: boolean, dpr?: number) => void;\n\n resetTransform: (setTransform?: boolean, dpr?: number) => void;\n\n translate: (x: number, y: number, setTransform?: boolean) => void;\n /**\n * 旋转角度,自动转换为弧度\n * @param deg 角度数\n */\n rotateDegrees: (deg: number, setTransform?: boolean) => void;\n\n /**\n * 绕点旋转\n * @param rad 弧度\n * @param x 旋转中心点x\n * @param y 旋转中心点y\n */\n rotateAbout: (rad: number, x: number, y: number, setTransform?: boolean) => void;\n\n /**\n * 绕点旋转\n * @param deg 旋转角度\n * @param x 旋转中心点x\n * @param y 旋转中心点y\n */\n rotateDegreesAbout: (deg: number, x: number, y: number, setTransform?: boolean) => void;\n\n beginPath: () => void;\n\n clip: ((fillRule?: CanvasFillRule) => void) & ((path: Path2D, fillRule?: CanvasFillRule) => void);\n\n arc: (\n x: number,\n y: number,\n radius: number,\n startAngle: number,\n endAngle: number,\n anticlockwise?: boolean,\n z?: number\n ) => void;\n\n arcTo: (x1: number, y1: number, x2: number, y2: number, radius: number) => void;\n\n bezierCurveTo: (cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number) => void;\n\n closePath: () => void;\n\n ellipse: (\n x: number,\n y: number,\n radiusX: number,\n radiusY: number,\n rotation: number,\n startAngle: number,\n endAngle: number,\n anticlockwise?: boolean\n ) => void;\n\n lineTo: (x: number, y: number, z?: number) => void;\n\n moveTo: (x: number, y: number, z?: number) => void;\n\n quadraticCurveTo: (cpx: number, cpy: number, x: number, y: number, z?: number) => void;\n\n rect: (x: number, y: number, w: number, h: number, z?: number) => void;\n\n createImageData: (imageDataOrSw: number | ImageData, sh?: number) => ImageData;\n\n createLinearGradient: (x0: number, y0: number, x1: number, y1: number) => CanvasGradient;\n\n createPattern: (\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ICanvas | any,\n repetition: string\n ) => CanvasPattern | null;\n\n createRadialGradient: (x0: number, y0: number, r0: number, x1: number, y1: number, r1: number) => CanvasGradient;\n\n createConicGradient: (x: number, y: number, startAngle: number, endAngle: number) => IConicalGradientData | null;\n\n // createConicGradient: (x: number, y: number, startAngle: number, endAngle: number) => IConicalGradient | null;\n\n // fill(fillRule?: CanvasFillRule): void;\n fill: (path?: Path2D, fillRule?: CanvasFillRule) => void;\n\n fillRect: (x: number, y: number, w: number, h: number) => void;\n\n clearRect: (x: number, y: number, w: number, h: number) => void;\n\n fillText: (text: string, x: number, y: number, z?: number) => void;\n\n getImageData: (sx: number, sy: number, sw: number, sh: number) => ImageData;\n\n getLineDash: () => number[];\n\n isPointInPath: (x: number, y: number) => boolean;\n isPointInStroke: (x: number, y: number) => boolean;\n\n measureText: (text: string, method?: 'native' | 'simple' | 'quick') => { width: number };\n\n putImageData: (imagedata: ImageData, dx: number, dy: number) => void;\n\n setLineDash: (segments: number[]) => void;\n\n stroke: (path?: Path2D) => void;\n\n strokeRect: (x: number, y: number, w: number, h: number) => void;\n\n strokeText: (text: string, x: number, y: number, z?: number) => void;\n\n drawImage: ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | ICanvas | any,\n dstX: number,\n dstY: number\n ) => void) &\n ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | ICanvas | any,\n dstX: number,\n dstY: number,\n dstW: number,\n dstH: number\n ) => void) &\n ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | ICanvas | any,\n srcX: number,\n srcY: number,\n srcW: number,\n srcH: number,\n dstX: number,\n dstY: number,\n dstW: number,\n dstH: number\n ) => void);\n\n setCommonStyle: (\n params: ISetCommonStyleParams,\n attribute: ICommonStyleParams,\n // 用于渐变色\n offsetX: number,\n offsetY: number,\n defultParams?: ICommonStyleParams | Partial<ICommonStyleParams>[]\n ) => void;\n\n setShadowBlendStyle?: (\n params: ISetCommonStyleParams,\n attribute: ICommonStyleParams,\n defultParams?: ICommonStyleParams | Partial<ICommonStyleParams>[]\n ) => void;\n\n setStrokeStyle: (\n params: ISetStrokeStyleParams,\n attribute: IStrokeStyleParams,\n // 用于渐变色\n offsetX: number,\n offsetY: number,\n defultParams?: Required<IStrokeStyleParams> | Partial<IStrokeStyleParams>[]\n ) => void;\n\n setTextStyle: (params: Partial<ITextStyleParams>, defaultParams?: ITextStyleParams, z?: number) => void;\n setTextStyleWithoutAlignBaseline: (\n params: Partial<ITextStyleParams>,\n defaultParams?: ITextStyleParams,\n z?: number\n ) => void;\n\n draw: (...params: any) => void;\n\n clearMatrix: (setTransform?: boolean, dpr?: number) => void;\n onlyTranslate: (dpr?: number) => boolean;\n}\n\nexport interface IContextLike {\n // 属性代理\n fillStyle: string | CanvasGradient | CanvasPattern;\n /**\n * @deprecated font方法不建议使用,请使用setTextStyle\n */\n font: string;\n globalAlpha: number;\n lineCap: string;\n lineDashOffset: number;\n lineJoin: string;\n lineWidth: number;\n miterLimit: number;\n shadowBlur: number;\n shadowColor: string;\n shadowOffsetX: number;\n shadowOffsetY: number;\n strokeStyle: string | CanvasGradient | CanvasPattern;\n dpr: number;\n /**\n * @deprecated textAlign方法不建议使用,请使用setTextStyle\n */\n textAlign: string;\n /**\n * @deprecated textBaseline方法不建议使用,请使用setTextStyle\n */\n textBaseline: string;\n nativeContext: CanvasRenderingContext2D | any;\n [key: string]: any; //类型没有索引签名\n\n /**\n * 清空画布\n */\n clear: () => void;\n\n restore: () => void;\n\n save: () => void;\n\n // transform(m11: number, m12: number, m21: number, m22: number, dx: number, dy: number): void;\n\n translate: (x: number, y: number) => void;\n\n beginPath: () => void;\n\n clip: ((fillRule?: CanvasFillRule) => void) & ((path: Path2D, fillRule?: CanvasFillRule) => void);\n\n arc: (x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean) => void;\n\n arcTo: ((x1: number, y1: number, x2: number, y2: number, radius: number) => void) &\n ((x1: number, y1: number, x2: number, y2: number, radiusX: number, radiusY: number, rotation: number) => void);\n\n bezierCurveTo: (cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number) => void;\n\n closePath: () => void;\n\n ellipse: (\n x: number,\n y: number,\n radiusX: number,\n radiusY: number,\n rotation: number,\n startAngle: number,\n endAngle: number,\n anticlockwise?: boolean\n ) => void;\n\n lineTo: (x: number, y: number) => void;\n\n moveTo: (x: number, y: number) => void;\n\n quadraticCurveTo: (cpx: number, cpy: number, x: number, y: number) => void;\n\n rect: (x: number, y: number, w: number, h: number) => void;\n\n fill: (path?: Path2D, fillRule?: CanvasFillRule) => void;\n\n fillRect: (x: number, y: number, w: number, h: number) => void;\n\n clearRect: (x: number, y: number, w: number, h: number) => void;\n\n fillText: (text: string, x: number, y: number, maxWidth?: number) => void;\n\n getImageData: (sx: number, sy: number, sw: number, sh: number) => ImageData;\n\n getLineDash: () => number[];\n\n isPointInPath: (x: number, y: number) => boolean;\n isPointInStroke: (x: number, y: number) => boolean;\n\n measureText: (text: string, method?: 'native' | 'simple' | 'quick') => { width: number };\n\n putImageData: (\n imagedata: ImageData,\n dx: number,\n dy: number,\n dirtyX?: number,\n dirtyY?: number,\n dirtyWidth?: number,\n dirtyHeight?: number\n ) => void;\n\n setLineDash: (segments: number[]) => void;\n\n stroke: (path?: Path2D) => void;\n\n strokeRect: (x: number, y: number, w: number, h: number) => void;\n\n strokeText: (text: string, x: number, y: number, maxWidth?: number) => void;\n\n drawImage: ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | any,\n dstX: number,\n dstY: number\n ) => void) &\n ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | any,\n dstX: number,\n dstY: number,\n dstW: number,\n dstH: number\n ) => void) &\n ((\n image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap | any,\n srcX: number,\n srcY: number,\n srcW: number,\n srcH: number,\n dstX: number,\n dstY: number,\n dstW: number,\n dstH: number\n ) => void);\n\n clearMatrix: () => void;\n onlyTranslate: () => boolean;\n}\n"]}
|
package/es/interface/core.d.ts
CHANGED
|
@@ -28,7 +28,8 @@ export interface ITransformUtil {
|
|
|
28
28
|
translate: (dx: number, dy: number) => ITransformUtil;
|
|
29
29
|
}
|
|
30
30
|
export interface ILayerService {
|
|
31
|
-
createLayer: (stage: IStage, options?: ILayerParams) => ILayer;
|
|
31
|
+
createLayer: (stage: IStage, options?: Partial<ILayerParams>) => ILayer;
|
|
32
|
+
prepareStageLayer: (stage: IStage) => void;
|
|
32
33
|
releaseLayer: (stage: IStage, layer: ILayer) => void;
|
|
33
34
|
restLayerCount: (stage: IStage) => number;
|
|
34
35
|
getStageLayer: (stage: IStage) => ILayer[];
|
package/es/interface/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/core.ts"],"names":[],"mappings":"","file":"core.js","sourcesContent":["import type { ICanvas } from './canvas';\nimport type { IContext2d } from './context';\nimport type { IGraphicAttribute } from './graphic';\nimport type { ITextAttribute } from './graphic/text';\nimport type { ILayer, ILayerParams } from './layer';\nimport type { IStage } from './stage';\nimport type { ITextMeasure, TextOptionsType } from './text';\nimport type { IMatrix, IPointLike, ITextMeasureOption, TextMeasure } from '@visactor/vutils';\n\nexport interface IGraphicUtil {\n canvas?: ICanvas;\n context?: IContext2d | null;\n textMeasure: ITextMeasure;\n measureText: (text: string, tc: TextOptionsType) => { width: number; height: number };\n bindTextMeasure: (tm: ITextMeasure) => void;\n createTextMeasureInstance: (\n textSpec?: Partial<ITextAttribute>,\n option?: Partial<ITextMeasureOption>,\n getCanvasForMeasure?: () => any\n ) => TextMeasure<ITextAttribute>;\n}\n\nexport type TransformType = Pick<IGraphicAttribute, 'x' | 'y' | 'scaleX' | 'scaleY' | 'angle' | 'dx' | 'dy'> & {\n anchor?: IGraphicAttribute['anchor'];\n};\nexport interface ITransformUtil {\n init: (origin: TransformType) => ITransformUtil;\n fromMatrix: (source: IMatrix, target: IMatrix) => ITransformUtil;\n scale: (sx: number, sy: number, center?: IPointLike) => ITransformUtil;\n rotate: (angle: number, center?: IPointLike) => ITransformUtil;\n translate: (dx: number, dy: number) => ITransformUtil;\n}\n\nexport interface ILayerService {\n createLayer: (stage: IStage, options?: ILayerParams) => ILayer;\n releaseLayer: (stage: IStage, layer: ILayer) => void;\n restLayerCount: (stage: IStage) => number;\n getStageLayer: (stage: IStage) => ILayer[];\n layerCount: (stage: IStage) => number;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface/core.ts"],"names":[],"mappings":"","file":"core.js","sourcesContent":["import type { ICanvas } from './canvas';\nimport type { IContext2d } from './context';\nimport type { IGraphicAttribute } from './graphic';\nimport type { ITextAttribute } from './graphic/text';\nimport type { ILayer, ILayerParams } from './layer';\nimport type { IStage } from './stage';\nimport type { ITextMeasure, TextOptionsType } from './text';\nimport type { IMatrix, IPointLike, ITextMeasureOption, TextMeasure } from '@visactor/vutils';\n\nexport interface IGraphicUtil {\n canvas?: ICanvas;\n context?: IContext2d | null;\n textMeasure: ITextMeasure;\n measureText: (text: string, tc: TextOptionsType) => { width: number; height: number };\n bindTextMeasure: (tm: ITextMeasure) => void;\n createTextMeasureInstance: (\n textSpec?: Partial<ITextAttribute>,\n option?: Partial<ITextMeasureOption>,\n getCanvasForMeasure?: () => any\n ) => TextMeasure<ITextAttribute>;\n}\n\nexport type TransformType = Pick<IGraphicAttribute, 'x' | 'y' | 'scaleX' | 'scaleY' | 'angle' | 'dx' | 'dy'> & {\n anchor?: IGraphicAttribute['anchor'];\n};\nexport interface ITransformUtil {\n init: (origin: TransformType) => ITransformUtil;\n fromMatrix: (source: IMatrix, target: IMatrix) => ITransformUtil;\n scale: (sx: number, sy: number, center?: IPointLike) => ITransformUtil;\n rotate: (angle: number, center?: IPointLike) => ITransformUtil;\n translate: (dx: number, dy: number) => ITransformUtil;\n}\n\nexport interface ILayerService {\n createLayer: (stage: IStage, options?: Partial<ILayerParams>) => ILayer;\n // stage绘制前调用\n prepareStageLayer: (stage: IStage) => void;\n releaseLayer: (stage: IStage, layer: ILayer) => void;\n restLayerCount: (stage: IStage) => number;\n getStageLayer: (stage: IStage) => ILayer[];\n layerCount: (stage: IStage) => number;\n}\n"]}
|
package/es/interface/event.d.ts
CHANGED
|
@@ -191,3 +191,4 @@ export type RenderConfig = {
|
|
|
191
191
|
};
|
|
192
192
|
};
|
|
193
193
|
export type NativeEvent = MouseEvent | PointerEvent | TouchEvent;
|
|
194
|
+
export type GraphicEventType = 'pointerdown' | 'pointerup' | 'pointerupoutside' | 'pointertap' | 'pointerover' | 'pointerenter' | 'pointerleave' | 'pointerout' | 'mousedown' | 'mouseup' | 'mouseupoutside' | 'rightdown' | 'rightup' | 'rightupoutside' | 'click' | 'dblclick' | 'mousemove' | 'mouseover' | 'mouseout' | 'mouseenter' | 'mouseleave' | 'wheel' | 'tap' | 'touchstart' | 'touchend' | 'touchendoutside' | 'touchmove' | 'touchcancel' | 'dragstart' | 'drag' | 'dragenter' | 'dragleave' | 'dragover' | 'dragend' | 'drop' | 'pan' | 'panstart' | 'panend' | 'press' | 'pressup' | 'pressend' | 'pinch' | 'pinchstart' | 'pinchend' | 'swipe';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/event.ts"],"names":[],"mappings":"","file":"event.js","sourcesContent":["import type { INode } from './node-tree';\nimport type { Dict, IBounds, IPointLike } from '@visactor/vutils';\nimport type { Cursor, IGraphicAttribute } from './graphic';\nimport type { IDomRectLike, IEventElement } from './common';\nimport type { ICanvas } from './canvas';\nimport type { IGlobal } from './global';\n\nexport interface IEventManager {\n rootTarget: IEventTarget;\n dispatch: any;\n cursor: Cursor | string;\n addEventMapping: (type: string, fn: (e: IFederatedEvent, target: IEventTarget) => void) => void;\n dispatchEvent: (e: IFederatedEvent, type?: string) => void;\n mapEvent: (e: IFederatedEvent) => void;\n propagate: (e: IFederatedEvent, type?: string) => void;\n propagationPath: (target: IEventTarget) => IEventTarget[];\n copyWheelData: (from: IFederatedWheelEvent, to: IFederatedWheelEvent) => void;\n copyPointerData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n copyMouseData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n copyData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n}\n\nexport interface IFederatedEvent<N = Event> {\n bubbles: boolean;\n cancelBubble: boolean;\n cancelable: boolean;\n composed: boolean;\n currentTarget: IEventTarget | null;\n defaultPrevented: boolean;\n eventPhase: number;\n isTrusted: boolean;\n returnValue: boolean;\n srcElement: IEventTarget;\n target: IEventTarget | null;\n timeStamp: number;\n type: string;\n nativeEvent: N;\n originalEvent: IFederatedEvent<N> | null;\n propagationStopped: boolean;\n propagationImmediatelyStopped: boolean;\n path: IEventTarget[];\n manager?: IEventManager;\n detail: any;\n view: any;\n layer: IPointLike;\n get layerX(): number;\n get layerY(): number;\n page: IPointLike;\n get pageX(): number;\n get pageY(): number;\n canvas: IPointLike;\n get x(): number;\n get y(): number;\n get canvasX(): number;\n get canvasY(): number;\n viewport: IPointLike;\n get viewX(): number;\n get viewY(): number;\n composedPath: () => IEventTarget[];\n preventDefault: () => void;\n stopImmediatePropagation: () => void;\n stopPropagation: () => void;\n initEvent: () => void;\n initUIEvent: () => void;\n clone: () => void;\n which: number;\n}\n\nexport interface IFederatedMouseEvent extends IFederatedEvent {\n altKey: boolean;\n button: number;\n buttons: number;\n ctrlKey: boolean;\n metaKey: boolean;\n relatedTarget: EventTarget | null;\n shiftKey: boolean;\n client: IPointLike;\n get clientX(): number;\n get clientY(): number;\n detail: number;\n movement: IPointLike;\n get movementX(): number;\n get movementY(): number;\n offset: IPointLike;\n get offsetX(): number;\n get offsetY(): number;\n global: IPointLike;\n get globalX(): number;\n get globalY(): number;\n screen: IPointLike;\n get screenX(): number;\n get screenY(): number;\n getModifierState: (key: string) => boolean;\n initMouseEvent: (\n _typeArg: string,\n _canBubbleArg: boolean,\n _cancelableArg: boolean,\n _viewArg: Window,\n _detailArg: number,\n _screenXArg: number,\n _screenYArg: number,\n _clientXArg: number,\n _clientYArg: number,\n _ctrlKeyArg: boolean,\n _altKeyArg: boolean,\n _shiftKeyArg: boolean,\n _metaKeyArg: boolean,\n _buttonArg: number,\n _relatedTargetArg: EventTarget\n ) => void;\n}\n\nexport interface IFederatedWheelEvent extends IFederatedMouseEvent {\n deltaMode: number;\n deltaX: number;\n deltaY: number;\n deltaZ: number;\n clone: () => IFederatedWheelEvent;\n}\n\nexport interface IFederatedPointerEvent extends IFederatedMouseEvent {\n pointerId: number;\n width: number;\n height: number;\n isPrimary: boolean;\n pointerType: string;\n pressure: number;\n tangentialPressure: number;\n tiltX: number;\n tiltY: number;\n twist: number;\n detail: number;\n getCoalescedEvents: () => PointerEvent[];\n getPredictedEvents: () => PointerEvent[];\n clone: () => IFederatedPointerEvent;\n}\n\n/**\n * 代码参考自 https://github.com/pixijs/pixijs\n * The MIT License\n\n Copyright (c) 2013-2023 Mathew Groves, Chad Engler\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\nexport interface IEventTarget extends INode {\n /** Whether this event target should fire UI events. */\n pickable: boolean;\n /** The parent of this event target. */\n parent: IEventTarget | null;\n /** Whether this event target should be visible. */\n visible: boolean;\n\n /** The children of this event target. */\n children?: IEventTarget[];\n\n /** Whether this event target has any children that need UI events. This can be used optimize event propagation. */\n childrenPickable?: boolean;\n\n attribute?: Partial<IGraphicAttribute>;\n\n emit: (eventName: any, data: Dict<any>) => boolean;\n\n getCursor: () => string;\n setCursor: (c?: string) => void;\n}\n\nexport interface IRender {\n visualCanvas: {\n getCanvas: () => HTMLElement;\n };\n pickEvent: (position: [number, number], children: IEventTarget[], geoPick?: boolean) => IEventTarget | null;\n [key: string]: any;\n}\n\n// 事件系统扩展接口\nexport interface IEventExtension {\n /**\n * bind events\n */\n initEvents: () => void;\n /**\n * unbind events\n */\n removeEvents: () => void;\n /**\n * release\n */\n release: () => void;\n}\n\nexport type GestureDirection = 'none' | 'left' | 'right' | 'down' | 'up';\n\nexport interface GestureEvent extends IFederatedPointerEvent {\n points: IPointLike[];\n direction: GestureDirection;\n deltaX: number;\n deltaY: number;\n scale: number;\n center: IPointLike;\n velocity: number;\n}\n\nexport interface GestureConfig {\n press?: {\n /**\n * @default 251\n * Minimal press time in ms.\n * @see http://hammerjs.github.io/recognizer-press/\n */\n time?: number;\n /**\n * @default 10\n * Minimal movement that is allowed while pressing.\n * @see http://hammerjs.github.io/recognizer-press/\n */\n threshold?: number;\n };\n swipe?: {\n /**\n * Minimal distance required before recognizing.\n * @default 10\n * @see https://hammerjs.github.io/recognizer-swipe/\n */\n threshold?: number;\n /**\n * Minimal velocity required before recognizing, unit is in px per ms.\n * @default 0.3\n * @see http://hammerjs.github.io/recognizer-swipe/\n */\n velocity?: number;\n };\n}\n\nexport interface DefaultGestureConfig {\n press: {\n time: number;\n threshold: number;\n };\n swipe: {\n threshold: number;\n velocity: number;\n };\n}\n\nexport interface EmitEventObject {\n type: string;\n ev: GestureEvent;\n}\n\nexport type LooseFunction = (...args: any[]) => any;\n\nexport type IElementLike = Omit<IEventElement, 'on' | 'off' | 'once' | 'emit' | 'removeAllListeners'> & {\n style: CSSStyleDeclaration | Record<string, any>;\n getNativeHandler?: () => ICanvas;\n getBoundingClientRect: () => IDomRectLike;\n};\n\nexport type RenderConfig = {\n /**\n * 事件绑定的 canvas 元素\n */\n targetElement: IElementLike;\n /**\n * 环境分辨率\n */\n resolution: number;\n /**\n * 场景树根节点\n */\n rootNode: IEventTarget;\n global: IGlobal;\n /** 是否自动阻止事件 */\n autoPreventDefault?: boolean;\n /** 绘图视口 */\n viewport: {\n x: number;\n y: number;\n width: number;\n height: number;\n viewBox?: IBounds;\n };\n};\n\nexport type NativeEvent = MouseEvent | PointerEvent | TouchEvent;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface/event.ts"],"names":[],"mappings":"","file":"event.js","sourcesContent":["import type { INode } from './node-tree';\nimport type { Dict, IBounds, IPointLike } from '@visactor/vutils';\nimport type { Cursor, IGraphicAttribute } from './graphic';\nimport type { IDomRectLike, IEventElement } from './common';\nimport type { ICanvas } from './canvas';\nimport type { IGlobal } from './global';\n\nexport interface IEventManager {\n rootTarget: IEventTarget;\n dispatch: any;\n cursor: Cursor | string;\n addEventMapping: (type: string, fn: (e: IFederatedEvent, target: IEventTarget) => void) => void;\n dispatchEvent: (e: IFederatedEvent, type?: string) => void;\n mapEvent: (e: IFederatedEvent) => void;\n propagate: (e: IFederatedEvent, type?: string) => void;\n propagationPath: (target: IEventTarget) => IEventTarget[];\n copyWheelData: (from: IFederatedWheelEvent, to: IFederatedWheelEvent) => void;\n copyPointerData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n copyMouseData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n copyData: (from: IFederatedEvent, to: IFederatedEvent) => void;\n}\n\nexport interface IFederatedEvent<N = Event> {\n bubbles: boolean;\n cancelBubble: boolean;\n cancelable: boolean;\n composed: boolean;\n currentTarget: IEventTarget | null;\n defaultPrevented: boolean;\n eventPhase: number;\n isTrusted: boolean;\n returnValue: boolean;\n srcElement: IEventTarget;\n target: IEventTarget | null;\n timeStamp: number;\n type: string;\n nativeEvent: N;\n originalEvent: IFederatedEvent<N> | null;\n propagationStopped: boolean;\n propagationImmediatelyStopped: boolean;\n path: IEventTarget[];\n manager?: IEventManager;\n detail: any;\n view: any;\n layer: IPointLike;\n get layerX(): number;\n get layerY(): number;\n page: IPointLike;\n get pageX(): number;\n get pageY(): number;\n canvas: IPointLike;\n get x(): number;\n get y(): number;\n get canvasX(): number;\n get canvasY(): number;\n viewport: IPointLike;\n get viewX(): number;\n get viewY(): number;\n composedPath: () => IEventTarget[];\n preventDefault: () => void;\n stopImmediatePropagation: () => void;\n stopPropagation: () => void;\n initEvent: () => void;\n initUIEvent: () => void;\n clone: () => void;\n which: number;\n}\n\nexport interface IFederatedMouseEvent extends IFederatedEvent {\n altKey: boolean;\n button: number;\n buttons: number;\n ctrlKey: boolean;\n metaKey: boolean;\n relatedTarget: EventTarget | null;\n shiftKey: boolean;\n client: IPointLike;\n get clientX(): number;\n get clientY(): number;\n detail: number;\n movement: IPointLike;\n get movementX(): number;\n get movementY(): number;\n offset: IPointLike;\n get offsetX(): number;\n get offsetY(): number;\n global: IPointLike;\n get globalX(): number;\n get globalY(): number;\n screen: IPointLike;\n get screenX(): number;\n get screenY(): number;\n getModifierState: (key: string) => boolean;\n initMouseEvent: (\n _typeArg: string,\n _canBubbleArg: boolean,\n _cancelableArg: boolean,\n _viewArg: Window,\n _detailArg: number,\n _screenXArg: number,\n _screenYArg: number,\n _clientXArg: number,\n _clientYArg: number,\n _ctrlKeyArg: boolean,\n _altKeyArg: boolean,\n _shiftKeyArg: boolean,\n _metaKeyArg: boolean,\n _buttonArg: number,\n _relatedTargetArg: EventTarget\n ) => void;\n}\n\nexport interface IFederatedWheelEvent extends IFederatedMouseEvent {\n deltaMode: number;\n deltaX: number;\n deltaY: number;\n deltaZ: number;\n clone: () => IFederatedWheelEvent;\n}\n\nexport interface IFederatedPointerEvent extends IFederatedMouseEvent {\n pointerId: number;\n width: number;\n height: number;\n isPrimary: boolean;\n pointerType: string;\n pressure: number;\n tangentialPressure: number;\n tiltX: number;\n tiltY: number;\n twist: number;\n detail: number;\n getCoalescedEvents: () => PointerEvent[];\n getPredictedEvents: () => PointerEvent[];\n clone: () => IFederatedPointerEvent;\n}\n\n/**\n * 代码参考自 https://github.com/pixijs/pixijs\n * The MIT License\n\n Copyright (c) 2013-2023 Mathew Groves, Chad Engler\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n */\n\nexport interface IEventTarget extends INode {\n /** Whether this event target should fire UI events. */\n pickable: boolean;\n /** The parent of this event target. */\n parent: IEventTarget | null;\n /** Whether this event target should be visible. */\n visible: boolean;\n\n /** The children of this event target. */\n children?: IEventTarget[];\n\n /** Whether this event target has any children that need UI events. This can be used optimize event propagation. */\n childrenPickable?: boolean;\n\n attribute?: Partial<IGraphicAttribute>;\n\n emit: (eventName: any, data: Dict<any>) => boolean;\n\n getCursor: () => string;\n setCursor: (c?: string) => void;\n}\n\nexport interface IRender {\n visualCanvas: {\n getCanvas: () => HTMLElement;\n };\n pickEvent: (position: [number, number], children: IEventTarget[], geoPick?: boolean) => IEventTarget | null;\n [key: string]: any;\n}\n\n// 事件系统扩展接口\nexport interface IEventExtension {\n /**\n * bind events\n */\n initEvents: () => void;\n /**\n * unbind events\n */\n removeEvents: () => void;\n /**\n * release\n */\n release: () => void;\n}\n\nexport type GestureDirection = 'none' | 'left' | 'right' | 'down' | 'up';\n\nexport interface GestureEvent extends IFederatedPointerEvent {\n points: IPointLike[];\n direction: GestureDirection;\n deltaX: number;\n deltaY: number;\n scale: number;\n center: IPointLike;\n velocity: number;\n}\n\nexport interface GestureConfig {\n press?: {\n /**\n * @default 251\n * Minimal press time in ms.\n * @see http://hammerjs.github.io/recognizer-press/\n */\n time?: number;\n /**\n * @default 10\n * Minimal movement that is allowed while pressing.\n * @see http://hammerjs.github.io/recognizer-press/\n */\n threshold?: number;\n };\n swipe?: {\n /**\n * Minimal distance required before recognizing.\n * @default 10\n * @see https://hammerjs.github.io/recognizer-swipe/\n */\n threshold?: number;\n /**\n * Minimal velocity required before recognizing, unit is in px per ms.\n * @default 0.3\n * @see http://hammerjs.github.io/recognizer-swipe/\n */\n velocity?: number;\n };\n}\n\nexport interface DefaultGestureConfig {\n press: {\n time: number;\n threshold: number;\n };\n swipe: {\n threshold: number;\n velocity: number;\n };\n}\n\nexport interface EmitEventObject {\n type: string;\n ev: GestureEvent;\n}\n\nexport type LooseFunction = (...args: any[]) => any;\n\nexport type IElementLike = Omit<IEventElement, 'on' | 'off' | 'once' | 'emit' | 'removeAllListeners'> & {\n style: CSSStyleDeclaration | Record<string, any>;\n getNativeHandler?: () => ICanvas;\n getBoundingClientRect: () => IDomRectLike;\n};\n\nexport type RenderConfig = {\n /**\n * 事件绑定的 canvas 元素\n */\n targetElement: IElementLike;\n /**\n * 环境分辨率\n */\n resolution: number;\n /**\n * 场景树根节点\n */\n rootNode: IEventTarget;\n global: IGlobal;\n /** 是否自动阻止事件 */\n autoPreventDefault?: boolean;\n /** 绘图视口 */\n viewport: {\n x: number;\n y: number;\n width: number;\n height: number;\n viewBox?: IBounds;\n };\n};\n\nexport type NativeEvent = MouseEvent | PointerEvent | TouchEvent;\n\nexport type GraphicEventType =\n | 'pointerdown'\n | 'pointerup'\n // 指针抬起与按下的图形不同时触发\n | 'pointerupoutside'\n | 'pointertap'\n | 'pointerover'\n | 'pointerenter'\n | 'pointerleave'\n | 'pointerout'\n | 'mousedown'\n | 'mouseup'\n | 'mouseupoutside'\n // 右键操作\n | 'rightdown'\n | 'rightup'\n | 'rightupoutside'\n | 'click'\n // 双击\n | 'dblclick'\n | 'mousemove'\n | 'mouseover'\n | 'mouseout'\n // 不会冒泡\n | 'mouseenter'\n // 不会冒泡\n | 'mouseleave'\n | 'wheel'\n | 'tap'\n | 'touchstart'\n | 'touchend'\n | 'touchendoutside'\n | 'touchmove'\n | 'touchcancel'\n // dragNdrop\n | 'dragstart'\n | 'drag'\n | 'dragenter'\n | 'dragleave'\n | 'dragover'\n | 'dragend'\n | 'drop'\n // gesture\n | 'pan'\n | 'panstart'\n | 'panend'\n | 'press'\n | 'pressup'\n | 'pressend'\n | 'pinch'\n | 'pinchstart'\n | 'pinchend'\n | 'swipe';\n"]}
|
|
@@ -41,6 +41,7 @@ export type ITextAttribute = {
|
|
|
41
41
|
lineThrough: number;
|
|
42
42
|
scaleIn3d: boolean;
|
|
43
43
|
direction: 'horizontal' | 'vertical';
|
|
44
|
+
verticalMode: number;
|
|
44
45
|
wordBreak: 'break-word' | 'break-all';
|
|
45
46
|
ignoreBuf: boolean;
|
|
46
47
|
};
|
|
@@ -66,6 +67,8 @@ export interface IText extends IGraphic<ITextGraphicAttribute> {
|
|
|
66
67
|
multilineLayout?: LayoutType;
|
|
67
68
|
font?: string;
|
|
68
69
|
cache?: ITextCache;
|
|
70
|
+
getBaselineMapAlign: () => Record<string, string>;
|
|
71
|
+
getAlignMapBaseline: () => Record<string, string>;
|
|
69
72
|
updateMultilineAABBBounds: (text: (number | string)[]) => IAABBBounds;
|
|
70
73
|
updateSingallineAABBBounds: (text: number | string) => IAABBBounds;
|
|
71
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/graphic/text.ts"],"names":[],"mappings":"","file":"text.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\n\nexport interface TextLayoutBBox {\n width: number; // 包围盒的宽度\n height: number; // 包围盒的高度\n xOffset: number;\n yOffset: number;\n}\n\nexport interface LayoutItemType {\n str: string; // 这行的字符串\n leftOffset?: number; // 该行距离左侧的偏移\n topOffset?: number; // 该行距离右侧的偏移\n width: number;\n}\n\nexport interface SimplifyLayoutType {\n lines: LayoutItemType[];\n}\n\nexport interface LayoutType {\n bbox: TextLayoutBBox;\n lines: LayoutItemType[];\n fontFamily: string;\n fontSize: number;\n fontWeight?: string | number;\n lineHeight: number;\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n}\n\nexport type ITextAttribute = {\n text: string | number | string[] | number[];\n maxLineWidth: number;\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n fontSize: number;\n fontFamily: string;\n fontWeight: string | number;\n ellipsis: boolean | string;\n fontVariant: string;\n fontStyle: string;\n lineHeight: number;\n underline: number;\n lineThrough: number;\n scaleIn3d: boolean;\n direction: 'horizontal' | 'vertical';\n wordBreak: 'break-word' | 'break-all';\n ignoreBuf: boolean;\n // textDecoration: number;\n // textDecorationWidth: number;\n // padding?: number | number[];\n};\nexport type ITextCache = {\n // 单行文本的时候缓存用\n clipedText?: string;\n clipedWidth?: number;\n // 多行文本的布局缓存\n layoutData?: LayoutType;\n verticalList?: { text: string; width?: number; direction: number }[][];\n};\n\nexport type ITextGraphicAttribute = Partial<IGraphicAttribute> & Partial<ITextAttribute>;\n\nexport type IWrapTextGraphicAttribute = ITextGraphicAttribute & {\n heightLimit?: number;\n lineClamp?: number;\n};\n\nexport interface IText extends IGraphic<ITextGraphicAttribute> {\n // 判断是否被ellipisised\n clipedText?: string;\n clipedWidth?: number;\n cliped?: boolean;\n multilineLayout?: LayoutType;\n font?: string;\n cache?: ITextCache;\n\n updateMultilineAABBBounds: (text: (number | string)[]) => IAABBBounds;\n updateSingallineAABBBounds: (text: number | string) => IAABBBounds;\n}\n\nexport type TextAlignType = 'left' | 'right' | 'center' | 'start' | 'end';\nexport type TextBaselineType = 'top' | 'middle' | 'bottom' | 'alphabetic';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface/graphic/text.ts"],"names":[],"mappings":"","file":"text.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\nimport type { IGraphicAttribute, IGraphic } from '../graphic';\n\nexport interface TextLayoutBBox {\n width: number; // 包围盒的宽度\n height: number; // 包围盒的高度\n xOffset: number;\n yOffset: number;\n}\n\nexport interface LayoutItemType {\n str: string; // 这行的字符串\n leftOffset?: number; // 该行距离左侧的偏移\n topOffset?: number; // 该行距离右侧的偏移\n width: number;\n}\n\nexport interface SimplifyLayoutType {\n lines: LayoutItemType[];\n}\n\nexport interface LayoutType {\n bbox: TextLayoutBBox;\n lines: LayoutItemType[];\n fontFamily: string;\n fontSize: number;\n fontWeight?: string | number;\n lineHeight: number;\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n}\n\nexport type ITextAttribute = {\n text: string | number | string[] | number[];\n maxLineWidth: number;\n textAlign: TextAlignType;\n textBaseline: TextBaselineType;\n fontSize: number;\n fontFamily: string;\n fontWeight: string | number;\n ellipsis: boolean | string;\n fontVariant: string;\n fontStyle: string;\n lineHeight: number;\n underline: number;\n lineThrough: number;\n scaleIn3d: boolean;\n direction: 'horizontal' | 'vertical';\n verticalMode: number; // 垂直布局的模式,0代表默认(横向textAlign,纵向textBaseline),1代表特殊(横向textBaseline,纵向textAlign)\n wordBreak: 'break-word' | 'break-all';\n ignoreBuf: boolean;\n // textDecoration: number;\n // textDecorationWidth: number;\n // padding?: number | number[];\n};\nexport type ITextCache = {\n // 单行文本的时候缓存用\n clipedText?: string;\n clipedWidth?: number;\n // 多行文本的布局缓存\n layoutData?: LayoutType;\n verticalList?: { text: string; width?: number; direction: number }[][];\n};\n\nexport type ITextGraphicAttribute = Partial<IGraphicAttribute> & Partial<ITextAttribute>;\n\nexport type IWrapTextGraphicAttribute = ITextGraphicAttribute & {\n heightLimit?: number;\n lineClamp?: number;\n};\n\nexport interface IText extends IGraphic<ITextGraphicAttribute> {\n // 判断是否被ellipisised\n clipedText?: string;\n clipedWidth?: number;\n cliped?: boolean;\n multilineLayout?: LayoutType;\n font?: string;\n cache?: ITextCache;\n\n getBaselineMapAlign: () => Record<string, string>;\n getAlignMapBaseline: () => Record<string, string>;\n\n updateMultilineAABBBounds: (text: (number | string)[]) => IAABBBounds;\n updateSingallineAABBBounds: (text: number | string) => IAABBBounds;\n}\n\nexport type TextAlignType = 'left' | 'right' | 'center' | 'start' | 'end';\nexport type TextBaselineType = 'top' | 'middle' | 'bottom' | 'alphabetic';\n"]}
|
|
@@ -7,12 +7,14 @@ export interface IGraphicService {
|
|
|
7
7
|
onAttributeUpdate: (graphic: IGraphic) => void;
|
|
8
8
|
onSetStage: (graphic: IGraphic, stage: IStage) => void;
|
|
9
9
|
onRemove: (graphic: IGraphic) => void;
|
|
10
|
+
onRelease: (graphic: IGraphic) => void;
|
|
10
11
|
onAddIncremental: (graphic: IGraphic, group: IGroup, stage: IStage) => void;
|
|
11
12
|
onClearIncremental: (group: IGroup, stage: IStage) => void;
|
|
12
13
|
hooks: {
|
|
13
14
|
onAttributeUpdate: ISyncHook<[IGraphic]>;
|
|
14
15
|
onSetStage: ISyncHook<[IGraphic, IStage]>;
|
|
15
16
|
onRemove: ISyncHook<[IGraphic]>;
|
|
17
|
+
onRelease: ISyncHook<[IGraphic]>;
|
|
16
18
|
onAddIncremental: ISyncHook<[IGraphic, IGroup, IStage]>;
|
|
17
19
|
onClearIncremental: ISyncHook<[IGroup, IStage]>;
|
|
18
20
|
beforeUpdateAABBBounds: ISyncHook<[IGraphic, IStage, boolean, IAABBBounds]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/interface/graphic-service.ts"],"names":[],"mappings":"","file":"graphic-service.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\n\nimport type { ISyncHook } from './sync-hook';\nimport type { IGraphic } from './graphic';\nimport type { IStage } from './stage';\nimport type {\n IRectGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IGlyphGraphicAttribute,\n ISymbolGraphicAttribute,\n ICircleGraphicAttribute,\n ICircle,\n IGlyph,\n ISymbol,\n IArcGraphicAttribute,\n IArc,\n IArc3dGraphicAttribute,\n IAreaGraphicAttribute,\n IArc3d,\n IArea,\n ILineGraphicAttribute,\n IPathGraphicAttribute,\n ILine,\n IPath,\n IPolygonGraphicAttribute,\n IPolygon,\n IPyramid3dGraphicAttribute,\n IPyramid3d,\n ITextGraphicAttribute,\n IText,\n IRichTextGraphicAttribute,\n IRichText,\n IImageGraphicAttribute,\n IImage,\n IRect3dGraphicAttribute,\n IRect,\n IRect3d,\n IShadowRoot,\n IWrapTextGraphicAttribute\n} from './graphic/index';\n\nexport interface IGraphicService {\n // themeService: IThemeService;\n onAttributeUpdate: (graphic: IGraphic) => void;\n onSetStage: (graphic: IGraphic, stage: IStage) => void;\n onRemove: (graphic: IGraphic) => void;\n onAddIncremental: (graphic: IGraphic, group: IGroup, stage: IStage) => void;\n onClearIncremental: (group: IGroup, stage: IStage) => void;\n hooks: {\n onAttributeUpdate: ISyncHook<[IGraphic]>;\n onSetStage: ISyncHook<[IGraphic, IStage]>;\n onRemove: ISyncHook<[IGraphic]>;\n onAddIncremental: ISyncHook<[IGraphic, IGroup, IStage]>;\n onClearIncremental: ISyncHook<[IGroup, IStage]>;\n beforeUpdateAABBBounds: ISyncHook<[IGraphic, IStage, boolean, IAABBBounds]>;\n afterUpdateAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds, { globalAABBBounds: IAABBBounds }, boolean]>;\n };\n beforeUpdateAABBBounds: (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => void;\n afterUpdateAABBBounds: (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => void;\n\n creator: IGraphicCreator;\n\n updateRectAABBBounds: (\n attribute: IRectGraphicAttribute,\n rectTheme: Required<IRectGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n\n updateGroupAABBBounds: (\n attribute: IGroupGraphicAttribute,\n groupTheme: Required<IGroupGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGroup\n ) => IAABBBounds;\n\n updateGlyphAABBBounds: (\n attribute: IGlyphGraphicAttribute,\n groupTheme: Required<IGlyphGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGlyph\n ) => IAABBBounds;\n\n updateSymbolAABBBounds: (\n attribute: ISymbolGraphicAttribute,\n symbolTheme: Required<ISymbolGraphicAttribute>,\n aabbBounds: IAABBBounds,\n full?: boolean,\n graphic?: ISymbol\n ) => IAABBBounds;\n\n updateCircleAABBBounds: (\n attribute: ICircleGraphicAttribute,\n circleTheme: Required<ICircleGraphicAttribute>,\n aabbBounds: IAABBBounds,\n full?: boolean,\n graphic?: ICircle\n ) => IAABBBounds;\n\n updateArcAABBBounds: (\n attribute: IArcGraphicAttribute,\n arcTheme: Required<IArcGraphicAttribute>,\n aabbBounds: IAABBBounds,\n full?: boolean,\n graphic?: IArc\n ) => IAABBBounds;\n\n updateArc3dAABBBounds: (\n attribute: IArc3dGraphicAttribute,\n arcTheme: Required<IArc3dGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IArc3d\n ) => IAABBBounds;\n\n updateAreaAABBBounds: (\n attribute: IAreaGraphicAttribute,\n areaTheme: Required<IAreaGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IArea\n ) => IAABBBounds;\n\n updateLineAABBBounds: (\n attribute: ILineGraphicAttribute,\n lineTheme: Required<ILineGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: ILine\n ) => IAABBBounds;\n\n updatePathAABBBounds: (\n attribute: IPathGraphicAttribute,\n pathTheme: Required<IPathGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IPath\n ) => IAABBBounds;\n\n updatePolygonAABBBounds: (\n attribute: IPolygonGraphicAttribute,\n polygonTheme: Required<IPolygonGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IPolygon\n ) => IAABBBounds;\n\n updatePyramid3dAABBBounds: (\n attribute: IPyramid3dGraphicAttribute,\n polygonTheme: Required<IPyramid3dGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IPyramid3d\n ) => IAABBBounds;\n\n updateTextAABBBounds: (\n attribute: ITextGraphicAttribute,\n textTheme: Required<ITextGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IText\n ) => IAABBBounds;\n\n updateRichTextAABBBounds: (\n attribute: IRichTextGraphicAttribute,\n textTheme: Required<IRichTextGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IRichText\n ) => IAABBBounds;\n\n updateImageAABBBounds: (\n attribute: IImageGraphicAttribute,\n textTheme: Required<IImageGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IImage\n ) => IAABBBounds;\n}\n\nexport type IGraphicCreator = {\n arc: (attributes: IArcGraphicAttribute) => IArc;\n area: (attributes: IAreaGraphicAttribute) => IArea;\n circle: (attributes: ICircleGraphicAttribute) => ICircle;\n group: (attributes: IGroupGraphicAttribute) => IGroup;\n image: (attributes: IImageGraphicAttribute) => IImage;\n line: (attributes: ILineGraphicAttribute) => ILine;\n path: (attributes: IPathGraphicAttribute) => IPath;\n rect: (attributes: IRectGraphicAttribute) => IRect;\n rect3d: (attributes: IRect3dGraphicAttribute) => IRect3d;\n symbol: (attributes: ISymbolGraphicAttribute) => ISymbol;\n text: (attributes: ITextGraphicAttribute) => IText;\n richtext: (attributes: IRichTextGraphicAttribute) => IRichText;\n polygon: (attributes: IPolygonGraphicAttribute) => IPolygon;\n shadowRoot: (graphic?: IGraphic) => IShadowRoot;\n wrapText: (attributes: IWrapTextGraphicAttribute) => IText;\n};\n\nexport interface IArcBoundsContribution {\n updateBounds: (\n attribute: IArcGraphicAttribute,\n arcTheme: Required<IArcGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IAreaBoundsContribution {\n updateBounds: (\n attribute: IAreaGraphicAttribute,\n arcTheme: Required<IAreaGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface ICircleBoundsContribution {\n updateBounds: (\n attribute: ICircleGraphicAttribute,\n circleTheme: Required<ICircleGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IPathBoundsContribution {\n updateBounds: (\n attribute: IPathGraphicAttribute,\n pathTheme: Required<IPathGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IRectBoundsContribution {\n updateBounds: (\n attribute: IRectGraphicAttribute,\n rectTheme: Required<IRectGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface ISymbolBoundsContribution {\n updateBounds: (\n attribute: ISymbolGraphicAttribute,\n SymbolTheme: Required<ISymbolGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/interface/graphic-service.ts"],"names":[],"mappings":"","file":"graphic-service.js","sourcesContent":["import type { IAABBBounds } from '@visactor/vutils';\n\nimport type { ISyncHook } from './sync-hook';\nimport type { IGraphic } from './graphic';\nimport type { IStage } from './stage';\nimport type {\n IRectGraphicAttribute,\n IGroup,\n IGroupGraphicAttribute,\n IGlyphGraphicAttribute,\n ISymbolGraphicAttribute,\n ICircleGraphicAttribute,\n ICircle,\n IGlyph,\n ISymbol,\n IArcGraphicAttribute,\n IArc,\n IArc3dGraphicAttribute,\n IAreaGraphicAttribute,\n IArc3d,\n IArea,\n ILineGraphicAttribute,\n IPathGraphicAttribute,\n ILine,\n IPath,\n IPolygonGraphicAttribute,\n IPolygon,\n IPyramid3dGraphicAttribute,\n IPyramid3d,\n ITextGraphicAttribute,\n IText,\n IRichTextGraphicAttribute,\n IRichText,\n IImageGraphicAttribute,\n IImage,\n IRect3dGraphicAttribute,\n IRect,\n IRect3d,\n IShadowRoot,\n IWrapTextGraphicAttribute\n} from './graphic/index';\n\nexport interface IGraphicService {\n // themeService: IThemeService;\n onAttributeUpdate: (graphic: IGraphic) => void;\n onSetStage: (graphic: IGraphic, stage: IStage) => void;\n onRemove: (graphic: IGraphic) => void;\n onRelease: (graphic: IGraphic) => void;\n onAddIncremental: (graphic: IGraphic, group: IGroup, stage: IStage) => void;\n onClearIncremental: (group: IGroup, stage: IStage) => void;\n hooks: {\n onAttributeUpdate: ISyncHook<[IGraphic]>;\n onSetStage: ISyncHook<[IGraphic, IStage]>;\n onRemove: ISyncHook<[IGraphic]>;\n onRelease: ISyncHook<[IGraphic]>;\n onAddIncremental: ISyncHook<[IGraphic, IGroup, IStage]>;\n onClearIncremental: ISyncHook<[IGroup, IStage]>;\n beforeUpdateAABBBounds: ISyncHook<[IGraphic, IStage, boolean, IAABBBounds]>;\n afterUpdateAABBBounds: ISyncHook<[IGraphic, IStage, IAABBBounds, { globalAABBBounds: IAABBBounds }, boolean]>;\n };\n beforeUpdateAABBBounds: (graphic: IGraphic, stage: IStage, willUpdate: boolean, bounds: IAABBBounds) => void;\n afterUpdateAABBBounds: (\n graphic: IGraphic,\n stage: IStage,\n bounds: IAABBBounds,\n params: { globalAABBBounds: IAABBBounds },\n selfChange: boolean\n ) => void;\n\n creator: IGraphicCreator;\n\n updateRectAABBBounds: (\n attribute: IRectGraphicAttribute,\n rectTheme: Required<IRectGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n\n updateGroupAABBBounds: (\n attribute: IGroupGraphicAttribute,\n groupTheme: Required<IGroupGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGroup\n ) => IAABBBounds;\n\n updateGlyphAABBBounds: (\n attribute: IGlyphGraphicAttribute,\n groupTheme: Required<IGlyphGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGlyph\n ) => IAABBBounds;\n\n updateSymbolAABBBounds: (\n attribute: ISymbolGraphicAttribute,\n symbolTheme: Required<ISymbolGraphicAttribute>,\n aabbBounds: IAABBBounds,\n full?: boolean,\n graphic?: ISymbol\n ) => IAABBBounds;\n\n updateCircleAABBBounds: (\n attribute: ICircleGraphicAttribute,\n circleTheme: Required<ICircleGraphicAttribute>,\n aabbBounds: IAABBBounds,\n full?: boolean,\n graphic?: ICircle\n ) => IAABBBounds;\n\n updateArcAABBBounds: (\n attribute: IArcGraphicAttribute,\n arcTheme: Required<IArcGraphicAttribute>,\n aabbBounds: IAABBBounds,\n full?: boolean,\n graphic?: IArc\n ) => IAABBBounds;\n\n updateArc3dAABBBounds: (\n attribute: IArc3dGraphicAttribute,\n arcTheme: Required<IArc3dGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IArc3d\n ) => IAABBBounds;\n\n updateAreaAABBBounds: (\n attribute: IAreaGraphicAttribute,\n areaTheme: Required<IAreaGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IArea\n ) => IAABBBounds;\n\n updateLineAABBBounds: (\n attribute: ILineGraphicAttribute,\n lineTheme: Required<ILineGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: ILine\n ) => IAABBBounds;\n\n updatePathAABBBounds: (\n attribute: IPathGraphicAttribute,\n pathTheme: Required<IPathGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IPath\n ) => IAABBBounds;\n\n updatePolygonAABBBounds: (\n attribute: IPolygonGraphicAttribute,\n polygonTheme: Required<IPolygonGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IPolygon\n ) => IAABBBounds;\n\n updatePyramid3dAABBBounds: (\n attribute: IPyramid3dGraphicAttribute,\n polygonTheme: Required<IPyramid3dGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IPyramid3d\n ) => IAABBBounds;\n\n updateTextAABBBounds: (\n attribute: ITextGraphicAttribute,\n textTheme: Required<ITextGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IText\n ) => IAABBBounds;\n\n updateRichTextAABBBounds: (\n attribute: IRichTextGraphicAttribute,\n textTheme: Required<IRichTextGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IRichText\n ) => IAABBBounds;\n\n updateImageAABBBounds: (\n attribute: IImageGraphicAttribute,\n textTheme: Required<IImageGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IImage\n ) => IAABBBounds;\n}\n\nexport type IGraphicCreator = {\n arc: (attributes: IArcGraphicAttribute) => IArc;\n area: (attributes: IAreaGraphicAttribute) => IArea;\n circle: (attributes: ICircleGraphicAttribute) => ICircle;\n group: (attributes: IGroupGraphicAttribute) => IGroup;\n image: (attributes: IImageGraphicAttribute) => IImage;\n line: (attributes: ILineGraphicAttribute) => ILine;\n path: (attributes: IPathGraphicAttribute) => IPath;\n rect: (attributes: IRectGraphicAttribute) => IRect;\n rect3d: (attributes: IRect3dGraphicAttribute) => IRect3d;\n symbol: (attributes: ISymbolGraphicAttribute) => ISymbol;\n text: (attributes: ITextGraphicAttribute) => IText;\n richtext: (attributes: IRichTextGraphicAttribute) => IRichText;\n polygon: (attributes: IPolygonGraphicAttribute) => IPolygon;\n shadowRoot: (graphic?: IGraphic) => IShadowRoot;\n wrapText: (attributes: IWrapTextGraphicAttribute) => IText;\n};\n\nexport interface IArcBoundsContribution {\n updateBounds: (\n attribute: IArcGraphicAttribute,\n arcTheme: Required<IArcGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IAreaBoundsContribution {\n updateBounds: (\n attribute: IAreaGraphicAttribute,\n arcTheme: Required<IAreaGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface ICircleBoundsContribution {\n updateBounds: (\n attribute: ICircleGraphicAttribute,\n circleTheme: Required<ICircleGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IPathBoundsContribution {\n updateBounds: (\n attribute: IPathGraphicAttribute,\n pathTheme: Required<IPathGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface IRectBoundsContribution {\n updateBounds: (\n attribute: IRectGraphicAttribute,\n rectTheme: Required<IRectGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n\nexport interface ISymbolBoundsContribution {\n updateBounds: (\n attribute: ISymbolGraphicAttribute,\n SymbolTheme: Required<ISymbolGraphicAttribute>,\n aabbBounds: IAABBBounds,\n graphic?: IGraphic\n ) => IAABBBounds;\n}\n"]}
|
|
@@ -32,7 +32,7 @@ export type ITransform = {
|
|
|
32
32
|
angle: number;
|
|
33
33
|
alpha: number;
|
|
34
34
|
beta: number;
|
|
35
|
-
scaleCenter: [number, number];
|
|
35
|
+
scaleCenter: [number | string, number | string];
|
|
36
36
|
anchor: [number | string, number | string];
|
|
37
37
|
anchor3d: [number | string, number | string, number] | [number | string, number | string];
|
|
38
38
|
postMatrix: IMatrix;
|
|
@@ -112,7 +112,10 @@ export type IGraphicStyle = IFillStyle & IStrokeStyle & {
|
|
|
112
112
|
anchorType?: 'position' | 'boundsLeftTop';
|
|
113
113
|
} | null;
|
|
114
114
|
};
|
|
115
|
-
export type
|
|
115
|
+
export type IDebugType = {
|
|
116
|
+
_debug_bounds: boolean | ((c: any, g: any) => void);
|
|
117
|
+
};
|
|
118
|
+
export type IGraphicAttribute = IDebugType & IGraphicStyle & ITransform & {
|
|
116
119
|
strokeSeg: IStrokeSeg | null;
|
|
117
120
|
boundsPadding: number | number[];
|
|
118
121
|
pickMode: 'accurate' | 'imprecise' | 'custom';
|
|
@@ -125,6 +128,9 @@ export type IGraphicAttribute = IGraphicStyle & ITransform & {
|
|
|
125
128
|
layout: any;
|
|
126
129
|
keepDirIn3d?: boolean;
|
|
127
130
|
shadowRootIdx: number;
|
|
131
|
+
globalZIndex: number;
|
|
132
|
+
globalCompositeOperation: CanvasRenderingContext2D['globalCompositeOperation'] | '';
|
|
133
|
+
overflow: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';
|
|
128
134
|
};
|
|
129
135
|
export interface IGraphicJson<T extends Partial<IGraphicAttribute> = Partial<IGraphicAttribute>> {
|
|
130
136
|
attribute: Partial<T>;
|
|
@@ -141,6 +147,7 @@ export type ISetAttributeContext = {
|
|
|
141
147
|
ratio?: number;
|
|
142
148
|
end?: boolean;
|
|
143
149
|
};
|
|
150
|
+
skipUpdateCallback?: boolean;
|
|
144
151
|
};
|
|
145
152
|
export type IGraphicAnimateParams = {
|
|
146
153
|
id?: number | string;
|