@visactor/vrender-components 0.22.7-alpha.7 → 0.22.7-alpha.9
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/axis/util.js +7 -6
- package/cjs/axis/util.js.map +1 -1
- package/cjs/brush/type.js +1 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/marker/animate/animate.d.ts +3 -3
- package/cjs/marker/animate/animate.js.map +1 -1
- package/cjs/marker/animate/clip-in.d.ts +1 -1
- package/cjs/marker/animate/clip-in.js +6 -3
- package/cjs/marker/animate/clip-in.js.map +1 -1
- package/cjs/marker/animate/fade-in.d.ts +3 -3
- package/cjs/marker/animate/fade-in.js +10 -4
- package/cjs/marker/animate/fade-in.js.map +1 -1
- package/cjs/marker/animate/fade-out.d.ts +3 -3
- package/cjs/marker/animate/fade-out.js +10 -4
- package/cjs/marker/animate/fade-out.js.map +1 -1
- package/cjs/marker/arc-area.d.ts +8 -5
- package/cjs/marker/arc-area.js +18 -39
- package/cjs/marker/arc-area.js.map +1 -1
- package/cjs/marker/arc-line.d.ts +6 -4
- package/cjs/marker/arc-line.js +12 -9
- package/cjs/marker/arc-line.js.map +1 -1
- package/cjs/marker/area.d.ts +6 -4
- package/cjs/marker/area.js +14 -32
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +2 -3
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/common-line.d.ts +11 -7
- package/cjs/marker/common-line.js +11 -31
- package/cjs/marker/common-line.js.map +1 -1
- package/cjs/marker/config.d.ts +2 -0
- package/cjs/marker/config.js +2 -0
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/line.d.ts +6 -4
- package/cjs/marker/line.js +10 -4
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/mixin/label.d.ts +16 -0
- package/cjs/marker/mixin/label.js +57 -0
- package/cjs/marker/mixin/label.js.map +1 -0
- package/cjs/marker/type.d.ts +19 -16
- package/cjs/marker/type.js.map +1 -1
- package/cjs/poptip/contribution.js +4 -2
- package/cjs/poptip/contribution.js.map +1 -1
- package/cjs/poptip/poptip.d.ts +5 -0
- package/cjs/poptip/poptip.js +87 -18
- package/cjs/poptip/poptip.js.map +1 -1
- package/cjs/poptip/type.d.ts +4 -1
- package/cjs/poptip/type.js.map +1 -1
- package/cjs/switch/switch.js +2 -2
- package/cjs/switch/switch.js.map +1 -1
- package/dist/index.es.js +287 -173
- package/es/axis/util.js +7 -7
- package/es/axis/util.js.map +1 -1
- package/es/brush/type.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/marker/animate/animate.d.ts +3 -3
- package/es/marker/animate/animate.js.map +1 -1
- package/es/marker/animate/clip-in.d.ts +1 -1
- package/es/marker/animate/clip-in.js +6 -2
- package/es/marker/animate/clip-in.js.map +1 -1
- package/es/marker/animate/fade-in.d.ts +3 -3
- package/es/marker/animate/fade-in.js +11 -3
- package/es/marker/animate/fade-in.js.map +1 -1
- package/es/marker/animate/fade-out.d.ts +3 -3
- package/es/marker/animate/fade-out.js +11 -3
- package/es/marker/animate/fade-out.js.map +1 -1
- package/es/marker/arc-area.d.ts +8 -5
- package/es/marker/arc-area.js +19 -41
- package/es/marker/arc-area.js.map +1 -1
- package/es/marker/arc-line.d.ts +6 -4
- package/es/marker/arc-line.js +12 -9
- package/es/marker/arc-line.js.map +1 -1
- package/es/marker/area.d.ts +6 -4
- package/es/marker/area.js +15 -34
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +2 -3
- package/es/marker/base.js.map +1 -1
- package/es/marker/common-line.d.ts +11 -7
- package/es/marker/common-line.js +14 -34
- package/es/marker/common-line.js.map +1 -1
- package/es/marker/config.d.ts +2 -0
- package/es/marker/config.js +2 -0
- package/es/marker/config.js.map +1 -1
- package/es/marker/line.d.ts +6 -4
- package/es/marker/line.js +10 -4
- package/es/marker/line.js.map +1 -1
- package/es/marker/mixin/label.d.ts +16 -0
- package/es/marker/mixin/label.js +45 -0
- package/es/marker/mixin/label.js.map +1 -0
- package/es/marker/type.d.ts +19 -16
- package/es/marker/type.js.map +1 -1
- package/es/poptip/contribution.js +4 -2
- package/es/poptip/contribution.js.map +1 -1
- package/es/poptip/poptip.d.ts +5 -0
- package/es/poptip/poptip.js +85 -19
- package/es/poptip/poptip.js.map +1 -1
- package/es/poptip/type.d.ts +4 -1
- package/es/poptip/type.js.map +1 -1
- package/es/switch/switch.js +2 -2
- package/es/switch/switch.js.map +1 -1
- package/package.json +8 -8
package/cjs/poptip/poptip.js
CHANGED
|
@@ -36,7 +36,7 @@ class PopTip extends base_1.AbstractComponent {
|
|
|
36
36
|
}
|
|
37
37
|
render() {
|
|
38
38
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
39
|
-
const {titleStyle: titleStyle = {}, position: position, contentStyle: contentStyle = {}, panel: panel, logoSymbol: logoSymbol, logoText: logoText, logoTextStyle: logoTextStyle = {}, triangleMode: triangleMode = "default", space: space = 4, minWidth: minWidth = 0, maxWidth: maxWidth = 1 / 0, padding: padding = 4, maxWidthPercent: maxWidthPercent, visible: visible, state: state, dx: dx = 0, dy: dy = 0} = this.attribute;
|
|
39
|
+
const {titleStyle: titleStyle = {}, position: position, contentStyle: contentStyle = {}, panel: panel, logoSymbol: logoSymbol, poptipAnchor: poptipAnchor = "position", logoText: logoText, logoTextStyle: logoTextStyle = {}, triangleMode: triangleMode = "default", space: space = 4, minWidth: minWidth = 0, maxWidth: maxWidth = 1 / 0, padding: padding = 4, maxWidthPercent: maxWidthPercent, visible: visible, state: state, dx: dx = 0, dy: dy = 0, positionBounds: positionBounds} = this.attribute;
|
|
40
40
|
let {title: title = "", content: content = ""} = this.attribute;
|
|
41
41
|
title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title,
|
|
42
42
|
content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;
|
|
@@ -104,19 +104,26 @@ class PopTip extends base_1.AbstractComponent {
|
|
|
104
104
|
poptipHeight += contentShape.AABBBounds.height();
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
const layout = "auto" === position
|
|
107
|
+
const layout = "auto" === position || (0, vutils_1.isArray)(position), positionList = (0,
|
|
108
|
+
vutils_1.isArray)(position) ? position : this.positionList;
|
|
108
109
|
let maxBBoxI, maxBBoxSize = -1 / 0;
|
|
109
|
-
for (let i = 0; i <
|
|
110
|
-
const p = layout ?
|
|
110
|
+
for (let i = 0; i < positionList.length + 1; i++) {
|
|
111
|
+
const p = layout ? positionList[i === positionList.length ? maxBBoxI : i] : position;
|
|
111
112
|
let symbolType = "arrow2Left", offsetX = ((0, vutils_1.isArray)(symbolSize) ? symbolSize[0] : symbolSize) / 4, offsetY = 0;
|
|
112
113
|
"top" === p || "bottom" === p || "left" === p || "right" === p ? symbolType = "arrow2Left" : "concise" === triangleMode && (symbolType = conciseSymbolMap[p],
|
|
113
|
-
offsetX = [ "tl", "bl", "rt", "rb" ].includes(
|
|
114
|
-
vutils_1.isArray)(symbolSize) ? symbolSize[0] : symbolSize) / 2, offsetY = [ "tl", "tr", "lb", "rb" ].includes(
|
|
114
|
+
offsetX = [ "tl", "bl", "rt", "rb" ].includes(p) ? ((0, vutils_1.isArray)(symbolSize) ? symbolSize[0] : symbolSize) / 2 : -((0,
|
|
115
|
+
vutils_1.isArray)(symbolSize) ? symbolSize[0] : symbolSize) / 2, offsetY = [ "tl", "tr", "lb", "rb" ].includes(p) ? -((0,
|
|
115
116
|
vutils_1.isArray)(symbolSize) ? symbolSize[1] : symbolSize) / 2 : ((0, vutils_1.isArray)(symbolSize) ? symbolSize[1] : symbolSize) / 2);
|
|
116
117
|
const {angle: angle, offset: offset} = this.getAngleAndOffset(p, popTipWidth, poptipHeight, (0,
|
|
117
118
|
vutils_1.isArray)(spaceSize) ? spaceSize : [ spaceSize, spaceSize - lineWidth ], symbolType);
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
let bgSymbol, anchorPoint = {
|
|
120
|
+
x: 0,
|
|
121
|
+
y: 0
|
|
122
|
+
};
|
|
123
|
+
if ("bounds" === poptipAnchor && positionBounds && (anchorPoint = this.calculateAnchorPoint(p, positionBounds)),
|
|
124
|
+
(0, vutils_1.isBoolean)(bgVisible)) {
|
|
125
|
+
let bgRect;
|
|
126
|
+
bgSymbol = group.createOrUpdateChild("poptip-symbol-panel", Object.assign(Object.assign({}, backgroundStyle), {
|
|
120
127
|
visible: bgVisible && (contentVisible || titleVisible),
|
|
121
128
|
x: offsetX,
|
|
122
129
|
y: offsetY,
|
|
@@ -129,9 +136,7 @@ class PopTip extends base_1.AbstractComponent {
|
|
|
129
136
|
dy: offset[1] - (null !== (_j = backgroundStyle.space) && void 0 !== _j ? _j : 0),
|
|
130
137
|
size: symbolSize,
|
|
131
138
|
zIndex: 9
|
|
132
|
-
}), "symbol")
|
|
133
|
-
let bgRect;
|
|
134
|
-
(0, vutils_1.isEmpty)(null == state ? void 0 : state.panel) || (bgSymbol.states = state.panel),
|
|
139
|
+
}), "symbol"), (0, vutils_1.isEmpty)(null == state ? void 0 : state.panel) || (bgSymbol.states = state.panel),
|
|
135
140
|
bgRect = panel.panelSymbolType ? group.createOrUpdateChild("poptip-rect-panel", Object.assign(Object.assign({}, backgroundStyle), {
|
|
136
141
|
visible: bgVisible && (contentVisible || titleVisible),
|
|
137
142
|
x: 0,
|
|
@@ -149,8 +154,8 @@ class PopTip extends base_1.AbstractComponent {
|
|
|
149
154
|
}), "rect"), (0, vutils_1.isEmpty)(null == state ? void 0 : state.panel) || (bgRect.states = state.panel);
|
|
150
155
|
}
|
|
151
156
|
if (group.setAttributes({
|
|
152
|
-
x: -offset[0] + dx,
|
|
153
|
-
y: -offset[1] + dy,
|
|
157
|
+
x: -offset[0] + dx + anchorPoint.x,
|
|
158
|
+
y: -offset[1] + dy + anchorPoint.y,
|
|
154
159
|
anchor: [ offsetX, offsetY ]
|
|
155
160
|
}), logoSymbol) {
|
|
156
161
|
const {size: size = 12} = logoSymbol, sizeArray = (0, vutils_1.isArray)(size) ? size : [ size, size ];
|
|
@@ -175,18 +180,82 @@ class PopTip extends base_1.AbstractComponent {
|
|
|
175
180
|
zIndex: 10
|
|
176
181
|
}), "text");
|
|
177
182
|
}
|
|
178
|
-
if (!
|
|
183
|
+
if (!range) break;
|
|
179
184
|
{
|
|
180
185
|
_tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);
|
|
181
186
|
const b = _tBounds, stageBounds = (new vutils_1.Bounds).setValue(0, 0, range[0], range[1]);
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
if (layout) {
|
|
188
|
+
if ((0, vutils_1.rectInsideAnotherRect)(b, stageBounds, !1)) break;
|
|
189
|
+
{
|
|
190
|
+
const bbox = (0, vutils_1.getRectIntersect)(b, stageBounds, !1), size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
|
|
191
|
+
size > maxBBoxSize && (maxBBoxSize = size, maxBBoxI = i);
|
|
192
|
+
}
|
|
186
193
|
}
|
|
194
|
+
if ([ "top", "bottom", "left", "right" ].includes(p)) {
|
|
195
|
+
const isVerticalPosition = "top" === p || "bottom" === p, isHorizontalPosition = "left" === p || "right" === p;
|
|
196
|
+
let mainDirectionOverlap = !1;
|
|
197
|
+
if (isVerticalPosition ? mainDirectionOverlap = "top" === p && b.y1 < 0 || "bottom" === p && b.y2 > stageBounds.y2 : isHorizontalPosition && (mainDirectionOverlap = "left" === p && b.x1 < 0 || "right" === p && b.x2 > stageBounds.x2),
|
|
198
|
+
!mainDirectionOverlap) {
|
|
199
|
+
let secondaryOffset = 0;
|
|
200
|
+
const szNumber = ((0, vutils_1.isArray)(symbolSize) ? symbolSize[1] : symbolSize) / 2;
|
|
201
|
+
isVerticalPosition ? (b.x1 < 0 ? secondaryOffset = -b.x1 : b.x2 > stageBounds.x2 && (secondaryOffset = stageBounds.x2 - b.x2),
|
|
202
|
+
group.setAttribute("x", group.attribute.x + secondaryOffset), bgSymbol.setAttribute("dx", (0,
|
|
203
|
+
vutils_1.min)((0, vutils_1.max)(bgSymbol.attribute.dx - secondaryOffset, szNumber), b.width() - szNumber))) : isHorizontalPosition && (b.y1 < 0 ? secondaryOffset = -b.y1 : b.y2 > stageBounds.y2 && (secondaryOffset = stageBounds.y2 - b.y2),
|
|
204
|
+
group.setAttribute("y", group.attribute.y + secondaryOffset), bgSymbol.setAttribute("dy", (0,
|
|
205
|
+
vutils_1.min)((0, vutils_1.max)(bgSymbol.attribute.dy - secondaryOffset, szNumber), b.height() - szNumber)));
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (!layout) break;
|
|
187
210
|
}
|
|
188
211
|
}
|
|
189
212
|
}
|
|
213
|
+
calculateAnchorPoint(position, positionBounds) {
|
|
214
|
+
if (!positionBounds) return {
|
|
215
|
+
x: 0,
|
|
216
|
+
y: 0
|
|
217
|
+
};
|
|
218
|
+
const {x: x, y: y} = this.attribute, {x1: x1, y1: y1, x2: x2, y2: y2} = positionBounds, width = x2 - x1, height = y2 - y1;
|
|
219
|
+
switch (position) {
|
|
220
|
+
case "top":
|
|
221
|
+
case "tl":
|
|
222
|
+
case "tr":
|
|
223
|
+
return {
|
|
224
|
+
x: x1 + width / 2 - x,
|
|
225
|
+
y: y1 - y
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
case "bottom":
|
|
229
|
+
case "bl":
|
|
230
|
+
case "br":
|
|
231
|
+
return {
|
|
232
|
+
x: x1 + width / 2 - x,
|
|
233
|
+
y: y2 - y
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
case "left":
|
|
237
|
+
case "lt":
|
|
238
|
+
case "lb":
|
|
239
|
+
return {
|
|
240
|
+
x: x1 - x,
|
|
241
|
+
y: y1 + height / 2 - y
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
case "right":
|
|
245
|
+
case "rt":
|
|
246
|
+
case "rb":
|
|
247
|
+
return {
|
|
248
|
+
x: x2 - x,
|
|
249
|
+
y: y1 + height / 2 - y
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
default:
|
|
253
|
+
return {
|
|
254
|
+
x: 0,
|
|
255
|
+
y: 0
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
190
259
|
getAngleAndOffset(position, width, height, size, symbolType) {
|
|
191
260
|
const sizeH = "arrow2Left" === symbolType ? size[1] / 2 : size[1];
|
|
192
261
|
switch (position) {
|
package/cjs/poptip/poptip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/poptip/poptip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,yDAWgC;AAChC,6CAa0B;AAC1B,uCAAiD;AAGjD,yCAAiD;AAEjD,MAAM,QAAQ,GAAG,IAAI,mBAAU,EAAE,CAAC;AAElC,IAAA,8BAAmB,GAAE,CAAC;AAEtB,MAAM,KAAK,GAAG,wCAAwC,CAAC;AACvD,MAAM,KAAK,GAAG,uCAAuC,CAAC;AACtD,MAAM,KAAK,GAAG,uCAAuC,CAAC;AACtD,MAAM,KAAK,GAAG,sCAAsC,CAAC;AAErD,MAAM,gBAAgB,GAAG;IACvB,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;CACV,CAAC;AACF,MAAa,MAAO,SAAQ,wBAA6C;IA8BvE,YAAY,UAA4B,EAAE,OAA0B;QAClE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,MAAM,CAAC,iBAAiB,EAAE,UA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AAE;QACZ,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,KAAK,EAAE,EAAS;IAChB,eAAe,EAAE,GAAG;IACpB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,EAAE;CACZ,CAAC","file":"poptip.js","sourcesContent":["/**\n * @description PopTip组件\n */\nimport {\n InputText,\n type IGraphic,\n type IGroup,\n type IRect,\n type ISymbol,\n type ISymbolGraphicAttribute,\n type IText,\n type ITextGraphicAttribute,\n type TextAlignType,\n type TextBaselineType\n} from '@visactor/vrender-core';\nimport {\n AABBBounds,\n Bounds,\n getRectIntersect,\n isArray,\n isBoolean,\n isEmpty,\n isValid,\n max,\n merge,\n normalizePadding,\n pi,\n rectInsideAnotherRect\n} from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { BackgroundAttributes, ComponentOptions } from '../interface';\nimport type { PopTipAttributes } from './type';\nimport { loadPoptipComponent } from './register';\n\nconst _tBounds = new AABBBounds();\n\nloadPoptipComponent();\n\nconst tlStr = 'M -0.5 -0.5, L -0.5 0.5, L 0.5 -0.5, Z';\nconst blStr = 'M -0.5 -0.5, L -0.5 0.5, L 0.5 0.5, Z';\nconst trStr = 'M -0.5 -0.5, L 0.5 -0.5, L 0.5 0.5, Z';\nconst brStr = 'M 0.5 -0.5, L 0.5 0.5, L -0.5 0.5, Z';\n\nconst conciseSymbolMap = {\n tl: tlStr,\n tr: trStr,\n bl: blStr,\n br: brStr,\n lt: tlStr,\n lb: blStr,\n rt: trStr,\n rb: brStr\n};\nexport class PopTip extends AbstractComponent<Required<PopTipAttributes>> {\n name = 'poptip';\n\n static defaultAttributes: Partial<PopTipAttributes> = {\n position: 'rt',\n visible: true,\n title: null,\n content: null,\n titleStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n contentStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n panel: {} as any,\n maxWidthPercent: 0.8,\n space: 8,\n padding: 10\n };\n\n titleShape?: IText;\n contentShape?: IText;\n group?: IGroup;\n\n constructor(attributes: PopTipAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, PopTip.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n titleStyle = {} as ITextGraphicAttribute,\n position,\n contentStyle = {} as ITextGraphicAttribute,\n panel,\n logoSymbol,\n logoText,\n logoTextStyle = {} as ITextGraphicAttribute,\n triangleMode = 'default',\n space = 4,\n minWidth = 0,\n maxWidth = Infinity,\n padding = 4,\n maxWidthPercent,\n visible,\n state,\n dx = 0,\n dy = 0\n } = this.attribute as PopTipAttributes;\n\n let { title = '', content = '' } = this.attribute as PopTipAttributes;\n\n title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title;\n content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild('poptip-content', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n this.group = group;\n\n const maxLineWidth = maxWidth - parsedPadding[1] - parsedPadding[3];\n\n const titleVisible = isValid(title) && visible !== false;\n const titleAttrs = {\n text: isArray(title) ? title : ([title] as any),\n visible: titleVisible,\n wrap: true,\n ...titleStyle,\n x: parsedPadding[3],\n y: parsedPadding[0],\n maxLineWidth,\n textAlign: 'left' as TextAlignType,\n textBaseline: 'top' as TextBaselineType\n };\n\n const titleShape = group.createOrUpdateChild('poptip-title', titleAttrs, 'text') as IText;\n if (!isEmpty(state?.title)) {\n titleShape.states = state.title;\n }\n\n const titleBounds = titleShape.AABBBounds;\n const titleHeight = titleBounds.height();\n const titleWidth = titleBounds.width();\n let height = titleHeight + space;\n if (!titleVisible) {\n height = 0;\n }\n\n const contentVisible = isValid(content) && visible !== false;\n const contentAttrs = {\n text: isArray(content) ? content : ([content] as any),\n visible: contentVisible,\n wrap: true,\n ...contentStyle,\n x: parsedPadding[3],\n y: parsedPadding[0] + height,\n maxLineWidth,\n textAlign: 'left' as TextAlignType,\n textBaseline: 'top' as TextBaselineType\n };\n\n const contentShape = group.createOrUpdateChild('poptip-content', contentAttrs, 'text') as IText;\n if (!isEmpty(state?.content)) {\n contentShape.states = state.content;\n }\n\n const contentBounds = contentShape.AABBBounds;\n const contentHeight = contentBounds.height();\n const contentWidth = contentBounds.width();\n\n if (contentVisible) {\n height += contentHeight;\n }\n\n this.titleShape = titleShape;\n this.contentShape = contentShape;\n\n // 计算整个popTip的宽高\n let popTipWidth = max(\n titleWidth + parsedPadding[1] + parsedPadding[3],\n contentWidth + parsedPadding[1] + parsedPadding[3]\n );\n if (popTipWidth > maxWidth) {\n popTipWidth = maxWidth;\n } else if (popTipWidth < minWidth) {\n popTipWidth = minWidth;\n }\n let poptipHeight = parsedPadding[0] + parsedPadding[2] + height;\n\n // 绘制背景层\n const { visible: bgVisible, square, ...backgroundStyle } = panel;\n // 如果是正方形,取宽高的最大值,同时文字也需要居中\n if (square) {\n const maxWH = max(popTipWidth, poptipHeight);\n popTipWidth = maxWH;\n const deltaH = maxWH - poptipHeight;\n poptipHeight = maxWH;\n titleShape.setAttributes({ dy: deltaH / 2 });\n contentShape.setAttributes({ dy: deltaH / 2 });\n }\n const symbolSize = backgroundStyle.size ?? 12;\n const spaceSize: number | [number, number] = isArray(symbolSize)\n ? [symbolSize[0] + (backgroundStyle.space ?? 0), symbolSize[1] + (backgroundStyle.space ?? 0)]\n : (symbolSize as number) + (backgroundStyle.space ?? 0);\n const lineWidth = backgroundStyle.lineWidth ?? 1;\n const range: [number, number] | undefined = (this as any).stage\n ? [\n (this as any).stage.viewWidth ?? (this as any).stage.width,\n (this as any).stage.viewHeight ?? (this as any).stage.height\n ]\n : undefined;\n\n if (range) {\n // 尝试进行换行\n const b = (this as any).AABBBounds;\n const leftWidth = this.attribute.x ?? b.x1;\n const rightWidth = range[0] - b.x1;\n let maxSpace = Math.max(leftWidth, rightWidth);\n // 减一些buffer,buffer不能超过maxSpace的20%\n const buf = (isArray(symbolSize) ? symbolSize[0] : 12) + 3;\n maxSpace = Math.min(maxSpace - buf, maxSpace * maxWidthPercent);\n // 需要进行换行\n if (maxSpace < popTipWidth) {\n popTipWidth = maxSpace;\n const buf = parsedPadding[1] + parsedPadding[3];\n titleShape.setAttribute('maxLineWidth', maxSpace - buf);\n contentShape.setAttribute('maxLineWidth', maxSpace - buf);\n poptipHeight = parsedPadding[0] + parsedPadding[2];\n if (titleVisible) {\n poptipHeight += titleShape.AABBBounds.height() + space;\n }\n poptipHeight += contentShape.AABBBounds.height();\n }\n }\n\n const layout = position === 'auto';\n // 最多循环this.positionList次\n let maxBBoxI: number;\n let maxBBoxSize: number = -Infinity;\n\n for (let i = 0; i < this.positionList.length + 1; i++) {\n const p = layout ? this.positionList[i === this.positionList.length ? maxBBoxI : i] : position;\n let symbolType = 'arrow2Left';\n let offsetX = (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4;\n let offsetY = 0;\n if (p === 'top' || p === 'bottom' || p === 'left' || p === 'right') {\n symbolType = 'arrow2Left';\n } else if (triangleMode === 'concise') {\n symbolType = (conciseSymbolMap as any)[p];\n offsetX = ['tl', 'bl', 'rt', 'rb'].includes(position)\n ? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2\n : -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2;\n offsetY = ['tl', 'tr', 'lb', 'rb'].includes(position)\n ? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2\n : (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;\n }\n\n const { angle, offset } = this.getAngleAndOffset(\n p,\n popTipWidth,\n poptipHeight,\n isArray(spaceSize) ? (spaceSize as [number, number]) : [spaceSize, spaceSize - lineWidth],\n symbolType\n );\n if (isBoolean(bgVisible)) {\n const bgSymbol = group.createOrUpdateChild(\n 'poptip-symbol-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: offsetX,\n y: offsetY,\n strokeBoundsBuffer: -1,\n boundsPadding: -2,\n anchor: [0, 0],\n symbolType,\n angle: angle,\n dx: offset[0],\n // 标签和背景同时移动\n dy: offset[1] - (backgroundStyle.space ?? 0),\n size: symbolSize,\n zIndex: 9\n },\n 'symbol'\n ) as ISymbol;\n if (!isEmpty(state?.panel)) {\n bgSymbol.states = state.panel;\n }\n\n let bgRect: IGraphic;\n if (panel.panelSymbolType) {\n bgRect = group.createOrUpdateChild(\n 'poptip-rect-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: 0,\n y: 0,\n symbolType: 'rect',\n size: [popTipWidth, poptipHeight],\n zIndex: -8\n },\n 'symbol'\n ) as ISymbol;\n } else {\n bgRect = group.createOrUpdateChild(\n 'poptip-rect-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: 0,\n y: 0,\n width: popTipWidth,\n height: poptipHeight,\n zIndex: -8\n },\n 'rect'\n ) as IRect;\n }\n if (!isEmpty(state?.panel)) {\n bgRect.states = state.panel;\n }\n }\n\n group.setAttributes({\n x: -offset[0] + dx,\n y: -offset[1] + dy,\n anchor: [offsetX, offsetY]\n });\n\n // 添加logo和logo内的text\n if (logoSymbol) {\n const { size = 12 } = logoSymbol;\n const sizeArray = isArray(size) ? (size as [number | string, number | string]) : [size, size];\n if (sizeArray[1] === 'auto') {\n sizeArray[1] = poptipHeight;\n }\n if (sizeArray[0] === 'auto') {\n sizeArray[0] = poptipHeight;\n }\n const sizeW = sizeArray[0] as number;\n group.createOrUpdateChild(\n 'poptip-logo',\n {\n ...logoSymbol,\n x: 0,\n y: poptipHeight / 2,\n visible: bgVisible && (contentVisible || titleVisible),\n zIndex: 10,\n size: sizeArray as [number, number]\n },\n 'symbol'\n );\n group.setAttributes({\n x: -offset[0] + dx + sizeW / 2,\n y: -offset[1] + dy\n });\n if (logoText) {\n group.createOrUpdateChild(\n 'poptip-logo-text',\n {\n ...logoTextStyle,\n x: 0,\n y: poptipHeight / 2,\n visible: bgVisible && (contentVisible || titleVisible),\n text: logoText,\n textAlign: 'center',\n textBaseline: 'middle',\n zIndex: 10\n },\n 'text'\n );\n }\n }\n\n if (layout && range) {\n _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);\n const b = _tBounds;\n const stageBounds = new Bounds().setValue(0, 0, range[0], range[1]);\n if (rectInsideAnotherRect(b, stageBounds, false)) {\n break;\n } else {\n const bbox = getRectIntersect(b, stageBounds, false);\n const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);\n if (size > maxBBoxSize) {\n maxBBoxSize = size;\n maxBBoxI = i;\n }\n }\n } else {\n break;\n }\n }\n }\n\n positionList = ['top', 'tl', 'tr', 'bottom', 'bl', 'br', 'left', 'lt', 'lb', 'right', 'rt', 'rb'];\n\n getAngleAndOffset(\n position: string,\n width: number,\n height: number,\n size: [number, number],\n symbolType: 'arrow2Left' | string\n ): { angle: number; offset: [number, number] } {\n // const sizeW = size[0];\n const sizeH = symbolType === 'arrow2Left' ? size[1] / 2 : size[1];\n switch (position) {\n case 'tl':\n return {\n angle: symbolType === 'arrow2Left' ? (pi / 2) * 3 : 0,\n offset: symbolType === 'arrow2Left' ? [width / 4, height + sizeH] : [0, height + sizeH]\n };\n case 'top':\n return { angle: (pi / 2) * 3, offset: [width / 2, height + sizeH] };\n case 'tr':\n return {\n angle: symbolType === 'arrow2Left' ? (pi / 2) * 3 : 0,\n offset: symbolType === 'arrow2Left' ? [(width / 4) * 3, height + sizeH] : [width, height + sizeH]\n };\n case 'rt':\n return {\n angle: 0,\n offset: symbolType === 'arrow2Left' ? [-sizeH, height / 5] : [-sizeH, 0]\n };\n case 'right':\n return { angle: 0, offset: [-sizeH, height / 2] };\n case 'rb':\n return {\n angle: 0,\n offset: symbolType === 'arrow2Left' ? [-sizeH, (height / 5) * 4] : [-sizeH, height]\n };\n case 'bl':\n return {\n angle: symbolType === 'arrow2Left' ? pi / 2 : 0,\n offset: symbolType === 'arrow2Left' ? [width / 4, -sizeH] : [0, -sizeH]\n };\n case 'bottom':\n return { angle: pi / 2, offset: [width / 2, -sizeH] };\n case 'br':\n return {\n angle: symbolType === 'arrow2Left' ? pi / 2 : 0,\n offset: symbolType === 'arrow2Left' ? [(width / 4) * 3, -sizeH] : [width, -sizeH]\n };\n case 'lt':\n return {\n angle: symbolType === 'arrow2Left' ? pi : 0,\n offset: symbolType === 'arrow2Left' ? [width + sizeH, height / 5] : [width + sizeH, 0]\n };\n case 'left':\n return { angle: pi, offset: [width + sizeH, height / 2] };\n case 'lb':\n return {\n angle: symbolType === 'arrow2Left' ? pi : 0,\n offset: symbolType === 'arrow2Left' ? [width + sizeH, (height / 5) * 4] : [width + sizeH, height]\n };\n }\n }\n\n appearAnimate(animateConfig: { duration?: number; easing?: string; wave?: number }) {\n // 基准时间,line[0, 500], point[100, 600] 100 onebyone, pointNormal[600, 1000] 90+90 onebyone, activeLine[500, 700]\n // line和activeLine的clipRange\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n this.setAttributes({ scaleX: 0, scaleY: 0 });\n this.animate().to({ scaleX: 1, scaleY: 1 }, (duration / 3) * 2, easing as any);\n this.titleShape &&\n this.titleShape\n .animate()\n .play(new InputText({ text: '' }, { text: this.titleShape.attribute.text as string }, duration, easing as any));\n this.contentShape &&\n this.contentShape\n .animate()\n .play(\n new InputText({ text: '' }, { text: this.contentShape.attribute.text as string }, duration, easing as any)\n );\n\n // 摇摆\n if (animateConfig.wave) {\n const dur = duration / 6;\n this.group\n .animate()\n .to({ angle: animateConfig.wave }, dur, easing as any)\n .to({ angle: -animateConfig.wave }, dur * 2, easing as any)\n .to({ angle: animateConfig.wave }, dur * 2, easing as any)\n .to({ angle: 0 }, dur, easing as any);\n }\n }\n\n disappearAnimate(animateConfig: { duration?: number; easing?: string }) {\n // 基准时间,line[0, 500], point[100, 600] 100 onebyone, pointNormal[600, 1000] 90+90 onebyone, activeLine[500, 700]\n // line和activeLine的clipRange\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n this.animate().to({ scaleX: 0, scaleY: 0 }, duration, easing as any);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/poptip/poptip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,yDAUgC;AAChC,6CAe0B;AAC1B,uCAAiD;AAGjD,yCAAiD;AAEjD,MAAM,QAAQ,GAAG,IAAI,mBAAU,EAAE,CAAC;AAElC,IAAA,8BAAmB,GAAE,CAAC;AAEtB,MAAM,KAAK,GAAG,wCAAwC,CAAC;AACvD,MAAM,KAAK,GAAG,uCAAuC,CAAC;AACtD,MAAM,KAAK,GAAG,uCAAuC,CAAC;AACtD,MAAM,KAAK,GAAG,sCAAsC,CAAC;AAErD,MAAM,gBAAgB,GAAG;IACvB,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;CACV,CAAC;AACF,MAAa,MAAO,SAAQ,wBAA6C;IA8BvE,YAAY,UAA4B,EAAE,OAA0B;QAClE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,MAAM,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QA9B7F,SAAI,GAAG,QAAQ,CAAC;QAwZhB,iBAAY,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAzXlG,CAAC;IAES,MAAM;;QACd,MAAM,EACJ,UAA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QACZ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,KAAK,EAAE,EAAS;IAChB,eAAe,EAAE,GAAG;IACpB,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,EAAE;CACZ,CAAC","file":"poptip.js","sourcesContent":["/**\n * @description PopTip组件\n */\nimport {\n InputText,\n type IGraphic,\n type IGroup,\n type IRect,\n type ISymbol,\n type IText,\n type ITextGraphicAttribute,\n type TextAlignType,\n type TextBaselineType\n} from '@visactor/vrender-core';\nimport {\n AABBBounds,\n Bounds,\n getRectIntersect,\n isArray,\n isBoolean,\n isEmpty,\n isValid,\n max,\n merge,\n min,\n normalizePadding,\n pi,\n rectInsideAnotherRect,\n type IAABBBoundsLike\n} from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { ComponentOptions } from '../interface';\nimport type { PopTipAttributes } from './type';\nimport { loadPoptipComponent } from './register';\n\nconst _tBounds = new AABBBounds();\n\nloadPoptipComponent();\n\nconst tlStr = 'M -0.5 -0.5, L -0.5 0.5, L 0.5 -0.5, Z';\nconst blStr = 'M -0.5 -0.5, L -0.5 0.5, L 0.5 0.5, Z';\nconst trStr = 'M -0.5 -0.5, L 0.5 -0.5, L 0.5 0.5, Z';\nconst brStr = 'M 0.5 -0.5, L 0.5 0.5, L -0.5 0.5, Z';\n\nconst conciseSymbolMap = {\n tl: tlStr,\n tr: trStr,\n bl: blStr,\n br: brStr,\n lt: tlStr,\n lb: blStr,\n rt: trStr,\n rb: brStr\n};\nexport class PopTip extends AbstractComponent<Required<PopTipAttributes>> {\n name = 'poptip';\n\n static defaultAttributes: Partial<PopTipAttributes> = {\n position: 'rt',\n visible: true,\n title: null,\n content: null,\n titleStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n contentStyle: {\n fontSize: 12,\n fill: '#000',\n textAlign: 'left',\n textBaseline: 'top'\n },\n panel: {} as any,\n maxWidthPercent: 0.8,\n space: 8,\n padding: 10\n };\n\n titleShape?: IText;\n contentShape?: IText;\n group?: IGroup;\n\n constructor(attributes: PopTipAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, PopTip.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n titleStyle = {} as ITextGraphicAttribute,\n position,\n contentStyle = {} as ITextGraphicAttribute,\n panel,\n logoSymbol,\n poptipAnchor = 'position',\n logoText,\n logoTextStyle = {} as ITextGraphicAttribute,\n triangleMode = 'default',\n space = 4,\n minWidth = 0,\n maxWidth = Infinity,\n padding = 4,\n maxWidthPercent,\n visible,\n state,\n dx = 0,\n dy = 0,\n positionBounds\n } = this.attribute as PopTipAttributes;\n\n let { title = '', content = '' } = this.attribute as PopTipAttributes;\n\n title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title;\n content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild('poptip-content', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n this.group = group;\n\n const maxLineWidth = maxWidth - parsedPadding[1] - parsedPadding[3];\n\n const titleVisible = isValid(title) && visible !== false;\n const titleAttrs = {\n text: isArray(title) ? title : ([title] as any),\n visible: titleVisible,\n wrap: true,\n ...titleStyle,\n x: parsedPadding[3],\n y: parsedPadding[0],\n maxLineWidth,\n textAlign: 'left' as TextAlignType,\n textBaseline: 'top' as TextBaselineType\n };\n\n const titleShape = group.createOrUpdateChild('poptip-title', titleAttrs, 'text') as IText;\n if (!isEmpty(state?.title)) {\n titleShape.states = state.title;\n }\n\n const titleBounds = titleShape.AABBBounds;\n const titleHeight = titleBounds.height();\n const titleWidth = titleBounds.width();\n let height = titleHeight + space;\n if (!titleVisible) {\n height = 0;\n }\n\n const contentVisible = isValid(content) && visible !== false;\n const contentAttrs = {\n text: isArray(content) ? content : ([content] as any),\n visible: contentVisible,\n wrap: true,\n ...contentStyle,\n x: parsedPadding[3],\n y: parsedPadding[0] + height,\n maxLineWidth,\n textAlign: 'left' as TextAlignType,\n textBaseline: 'top' as TextBaselineType\n };\n\n const contentShape = group.createOrUpdateChild('poptip-content', contentAttrs, 'text') as IText;\n if (!isEmpty(state?.content)) {\n contentShape.states = state.content;\n }\n\n const contentBounds = contentShape.AABBBounds;\n const contentHeight = contentBounds.height();\n const contentWidth = contentBounds.width();\n\n if (contentVisible) {\n height += contentHeight;\n }\n\n this.titleShape = titleShape;\n this.contentShape = contentShape;\n\n // 计算整个popTip的宽高\n let popTipWidth = max(\n titleWidth + parsedPadding[1] + parsedPadding[3],\n contentWidth + parsedPadding[1] + parsedPadding[3]\n );\n if (popTipWidth > maxWidth) {\n popTipWidth = maxWidth;\n } else if (popTipWidth < minWidth) {\n popTipWidth = minWidth;\n }\n let poptipHeight = parsedPadding[0] + parsedPadding[2] + height;\n\n // 绘制背景层\n const { visible: bgVisible, square, ...backgroundStyle } = panel;\n // 如果是正方形,取宽高的最大值,同时文字也需要居中\n if (square) {\n const maxWH = max(popTipWidth, poptipHeight);\n popTipWidth = maxWH;\n const deltaH = maxWH - poptipHeight;\n poptipHeight = maxWH;\n titleShape.setAttributes({ dy: deltaH / 2 });\n contentShape.setAttributes({ dy: deltaH / 2 });\n }\n const symbolSize = backgroundStyle.size ?? 12;\n const spaceSize: number | [number, number] = isArray(symbolSize)\n ? [symbolSize[0] + (backgroundStyle.space ?? 0), symbolSize[1] + (backgroundStyle.space ?? 0)]\n : (symbolSize as number) + (backgroundStyle.space ?? 0);\n const lineWidth = backgroundStyle.lineWidth ?? 1;\n const range: [number, number] | undefined = (this as any).stage\n ? [\n (this as any).stage.viewWidth ?? (this as any).stage.width,\n (this as any).stage.viewHeight ?? (this as any).stage.height\n ]\n : undefined;\n\n if (range) {\n // 尝试进行换行\n const b = (this as any).AABBBounds;\n const leftWidth = this.attribute.x ?? b.x1;\n const rightWidth = range[0] - b.x1;\n let maxSpace = Math.max(leftWidth, rightWidth);\n // 减一些buffer,buffer不能超过maxSpace的20%\n const buf = (isArray(symbolSize) ? symbolSize[0] : 12) + 3;\n maxSpace = Math.min(maxSpace - buf, maxSpace * maxWidthPercent);\n // 需要进行换行\n if (maxSpace < popTipWidth) {\n popTipWidth = maxSpace;\n const buf = parsedPadding[1] + parsedPadding[3];\n titleShape.setAttribute('maxLineWidth', maxSpace - buf);\n contentShape.setAttribute('maxLineWidth', maxSpace - buf);\n poptipHeight = parsedPadding[0] + parsedPadding[2];\n if (titleVisible) {\n poptipHeight += titleShape.AABBBounds.height() + space;\n }\n poptipHeight += contentShape.AABBBounds.height();\n }\n }\n\n const layout = position === 'auto' || isArray(position);\n const positionList = isArray(position) ? position : this.positionList;\n // 最多循环this.positionList次\n let maxBBoxI: number;\n let maxBBoxSize: number = -Infinity;\n\n for (let i = 0; i < positionList.length + 1; i++) {\n const p = layout ? positionList[i === positionList.length ? maxBBoxI : i] : position;\n let symbolType = 'arrow2Left';\n let offsetX = (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4;\n let offsetY = 0;\n if (p === 'top' || p === 'bottom' || p === 'left' || p === 'right') {\n symbolType = 'arrow2Left';\n } else if (triangleMode === 'concise') {\n symbolType = (conciseSymbolMap as any)[p];\n offsetX = ['tl', 'bl', 'rt', 'rb'].includes(p)\n ? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2\n : -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2;\n offsetY = ['tl', 'tr', 'lb', 'rb'].includes(p)\n ? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2\n : (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;\n }\n\n const { angle, offset } = this.getAngleAndOffset(\n p,\n popTipWidth,\n poptipHeight,\n isArray(spaceSize) ? (spaceSize as [number, number]) : [spaceSize, spaceSize - lineWidth],\n symbolType\n );\n\n // Calculate anchor point if using bounds\n let anchorPoint = { x: 0, y: 0 };\n if (poptipAnchor === 'bounds' && positionBounds) {\n anchorPoint = this.calculateAnchorPoint(p, positionBounds);\n }\n\n // 后续可能需要偏移,所以需要保存\n let bgSymbol: ISymbol;\n if (isBoolean(bgVisible)) {\n bgSymbol = group.createOrUpdateChild(\n 'poptip-symbol-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: offsetX,\n y: offsetY,\n strokeBoundsBuffer: -1,\n boundsPadding: -2,\n anchor: [0, 0],\n symbolType,\n angle: angle,\n dx: offset[0],\n // 标签和背景同时移动\n dy: offset[1] - (backgroundStyle.space ?? 0),\n size: symbolSize,\n zIndex: 9\n },\n 'symbol'\n ) as ISymbol;\n if (!isEmpty(state?.panel)) {\n bgSymbol.states = state.panel;\n }\n\n let bgRect: IGraphic;\n if (panel.panelSymbolType) {\n bgRect = group.createOrUpdateChild(\n 'poptip-rect-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: 0,\n y: 0,\n symbolType: 'rect',\n size: [popTipWidth, poptipHeight],\n zIndex: -8\n },\n 'symbol'\n ) as ISymbol;\n } else {\n bgRect = group.createOrUpdateChild(\n 'poptip-rect-panel',\n {\n ...backgroundStyle,\n visible: bgVisible && (contentVisible || titleVisible),\n x: 0,\n y: 0,\n width: popTipWidth,\n height: poptipHeight,\n zIndex: -8\n },\n 'rect'\n ) as IRect;\n }\n if (!isEmpty(state?.panel)) {\n bgRect.states = state.panel;\n }\n }\n\n group.setAttributes({\n x: -offset[0] + dx + anchorPoint.x,\n y: -offset[1] + dy + anchorPoint.y,\n anchor: [offsetX, offsetY]\n });\n\n // 添加logo和logo内的text\n if (logoSymbol) {\n const { size = 12 } = logoSymbol;\n const sizeArray = isArray(size) ? (size as [number | string, number | string]) : [size, size];\n if (sizeArray[1] === 'auto') {\n sizeArray[1] = poptipHeight;\n }\n if (sizeArray[0] === 'auto') {\n sizeArray[0] = poptipHeight;\n }\n const sizeW = sizeArray[0] as number;\n group.createOrUpdateChild(\n 'poptip-logo',\n {\n ...logoSymbol,\n x: 0,\n y: poptipHeight / 2,\n visible: bgVisible && (contentVisible || titleVisible),\n zIndex: 10,\n size: sizeArray as [number, number]\n },\n 'symbol'\n );\n group.setAttributes({\n x: -offset[0] + dx + sizeW / 2,\n y: -offset[1] + dy\n });\n if (logoText) {\n group.createOrUpdateChild(\n 'poptip-logo-text',\n {\n ...logoTextStyle,\n x: 0,\n y: poptipHeight / 2,\n visible: bgVisible && (contentVisible || titleVisible),\n text: logoText,\n textAlign: 'center',\n textBaseline: 'middle',\n zIndex: 10\n },\n 'text'\n );\n }\n }\n\n if (range) {\n _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);\n const b = _tBounds;\n const stageBounds = new Bounds().setValue(0, 0, range[0], range[1]);\n if (layout) {\n if (rectInsideAnotherRect(b, stageBounds, false)) {\n break;\n } else {\n const bbox = getRectIntersect(b, stageBounds, false);\n\n const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);\n if (size > maxBBoxSize) {\n maxBBoxSize = size;\n maxBBoxI = i;\n }\n }\n }\n\n // 检测是否是'top' | 'bottom' | 'left' | 'right',如果是,则需要进行偏移\n // 1. 判断主方向上有没有重叠(top|bottom的话就是垂直方向,left|right的话就是水平方向),如果重叠就无法偏移\n // 2. 找到次方向上的偏移量(top|bottom的话就是水平方向,left|right的话就是垂直方向),然后对group进行偏移即可\n if (['top', 'bottom', 'left', 'right'].includes(p)) {\n const isVerticalPosition = p === 'top' || p === 'bottom';\n const isHorizontalPosition = p === 'left' || p === 'right';\n\n // 判断主方向上有没有偏移\n let mainDirectionOverlap = false;\n if (isVerticalPosition) {\n mainDirectionOverlap = (p === 'top' && b.y1 < 0) || (p === 'bottom' && b.y2 > stageBounds.y2);\n } else if (isHorizontalPosition) {\n mainDirectionOverlap = (p === 'left' && b.x1 < 0) || (p === 'right' && b.x2 > stageBounds.x2);\n }\n\n // 如果主方向上没有偏移,则可以尝试在次方向上找到合适的偏移量\n if (!mainDirectionOverlap) {\n let secondaryOffset = 0;\n\n const szNumber = (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;\n if (isVerticalPosition) {\n // 水平偏移\n if (b.x1 < 0) {\n secondaryOffset = -b.x1;\n } else if (b.x2 > stageBounds.x2) {\n secondaryOffset = stageBounds.x2 - b.x2;\n }\n group.setAttribute('x', group.attribute.x + secondaryOffset);\n bgSymbol.setAttribute(\n 'dx',\n min(max(bgSymbol.attribute.dx - secondaryOffset, szNumber), b.width() - szNumber)\n );\n } else if (isHorizontalPosition) {\n // 垂直偏移\n if (b.y1 < 0) {\n secondaryOffset = -b.y1;\n } else if (b.y2 > stageBounds.y2) {\n secondaryOffset = stageBounds.y2 - b.y2;\n }\n\n group.setAttribute('y', group.attribute.y + secondaryOffset);\n bgSymbol.setAttribute(\n 'dy',\n min(max(bgSymbol.attribute.dy - secondaryOffset, szNumber), b.height() - szNumber)\n );\n }\n break;\n }\n }\n\n if (!layout) {\n break;\n }\n } else {\n break;\n }\n }\n }\n\n positionList = ['top', 'tl', 'tr', 'bottom', 'bl', 'br', 'left', 'lt', 'lb', 'right', 'rt', 'rb'];\n\n /**\n * Calculate anchor point based on positionBounds and position\n */\n calculateAnchorPoint(position: string, positionBounds?: IAABBBoundsLike): { x: number; y: number } {\n if (!positionBounds) {\n return { x: 0, y: 0 };\n }\n\n const { x, y } = this.attribute;\n\n const { x1, y1, x2, y2 } = positionBounds;\n const width = x2 - x1;\n const height = y2 - y1;\n\n // Calculate anchor point based on position\n switch (position) {\n case 'top':\n case 'tl':\n case 'tr':\n return { x: x1 + width / 2 - x, y: y1 - y };\n case 'bottom':\n case 'bl':\n case 'br':\n return { x: x1 + width / 2 - x, y: y2 - y };\n case 'left':\n case 'lt':\n case 'lb':\n return { x: x1 - x, y: y1 + height / 2 - y };\n case 'right':\n case 'rt':\n case 'rb':\n return { x: x2 - x, y: y1 + height / 2 - y };\n default:\n return { x: 0, y: 0 };\n }\n }\n\n getAngleAndOffset(\n position: string,\n width: number,\n height: number,\n size: [number, number],\n symbolType: 'arrow2Left' | string\n ): { angle: number; offset: [number, number] } {\n // const sizeW = size[0];\n const sizeH = symbolType === 'arrow2Left' ? size[1] / 2 : size[1];\n switch (position) {\n case 'tl':\n return {\n angle: symbolType === 'arrow2Left' ? (pi / 2) * 3 : 0,\n offset: symbolType === 'arrow2Left' ? [width / 4, height + sizeH] : [0, height + sizeH]\n };\n case 'top':\n return { angle: (pi / 2) * 3, offset: [width / 2, height + sizeH] };\n case 'tr':\n return {\n angle: symbolType === 'arrow2Left' ? (pi / 2) * 3 : 0,\n offset: symbolType === 'arrow2Left' ? [(width / 4) * 3, height + sizeH] : [width, height + sizeH]\n };\n case 'rt':\n return {\n angle: 0,\n offset: symbolType === 'arrow2Left' ? [-sizeH, height / 5] : [-sizeH, 0]\n };\n case 'right':\n return { angle: 0, offset: [-sizeH, height / 2] };\n case 'rb':\n return {\n angle: 0,\n offset: symbolType === 'arrow2Left' ? [-sizeH, (height / 5) * 4] : [-sizeH, height]\n };\n case 'bl':\n return {\n angle: symbolType === 'arrow2Left' ? pi / 2 : 0,\n offset: symbolType === 'arrow2Left' ? [width / 4, -sizeH] : [0, -sizeH]\n };\n case 'bottom':\n return { angle: pi / 2, offset: [width / 2, -sizeH] };\n case 'br':\n return {\n angle: symbolType === 'arrow2Left' ? pi / 2 : 0,\n offset: symbolType === 'arrow2Left' ? [(width / 4) * 3, -sizeH] : [width, -sizeH]\n };\n case 'lt':\n return {\n angle: symbolType === 'arrow2Left' ? pi : 0,\n offset: symbolType === 'arrow2Left' ? [width + sizeH, height / 5] : [width + sizeH, 0]\n };\n case 'left':\n return { angle: pi, offset: [width + sizeH, height / 2] };\n case 'lb':\n return {\n angle: symbolType === 'arrow2Left' ? pi : 0,\n offset: symbolType === 'arrow2Left' ? [width + sizeH, (height / 5) * 4] : [width + sizeH, height]\n };\n }\n }\n\n appearAnimate(animateConfig: { duration?: number; easing?: string; wave?: number }) {\n // 基准时间,line[0, 500], point[100, 600] 100 onebyone, pointNormal[600, 1000] 90+90 onebyone, activeLine[500, 700]\n // line和activeLine的clipRange\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n this.setAttributes({ scaleX: 0, scaleY: 0 });\n this.animate().to({ scaleX: 1, scaleY: 1 }, (duration / 3) * 2, easing as any);\n this.titleShape &&\n this.titleShape\n .animate()\n .play(new InputText({ text: '' }, { text: this.titleShape.attribute.text as string }, duration, easing as any));\n this.contentShape &&\n this.contentShape\n .animate()\n .play(\n new InputText({ text: '' }, { text: this.contentShape.attribute.text as string }, duration, easing as any)\n );\n\n // 摇摆\n if (animateConfig.wave) {\n const dur = duration / 6;\n this.group\n .animate()\n .to({ angle: animateConfig.wave }, dur, easing as any)\n .to({ angle: -animateConfig.wave }, dur * 2, easing as any)\n .to({ angle: animateConfig.wave }, dur * 2, easing as any)\n .to({ angle: 0 }, dur, easing as any);\n }\n }\n\n disappearAnimate(animateConfig: { duration?: number; easing?: string }) {\n // 基准时间,line[0, 500], point[100, 600] 100 onebyone, pointNormal[600, 1000] 90+90 onebyone, activeLine[500, 700]\n // line和activeLine的clipRange\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n this.animate().to({ scaleX: 0, scaleY: 0 }, duration, easing as any);\n }\n}\n"]}
|
package/cjs/poptip/type.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { IGraphic, IGroupGraphicAttribute, IRectGraphicAttribute, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';
|
|
2
2
|
import type { Padding, State } from '../core/type';
|
|
3
3
|
import type { BackgroundAttributes } from '../interface';
|
|
4
|
+
import type { IAABBBoundsLike } from '@visactor/vutils';
|
|
4
5
|
type StateStyle = {
|
|
5
6
|
title?: State<Partial<ITextGraphicAttribute>>;
|
|
6
7
|
content?: State<Partial<ITextGraphicAttribute>>;
|
|
7
8
|
panel?: State<Partial<IRectGraphicAttribute>>;
|
|
8
9
|
};
|
|
9
10
|
export type PopTipAttributes = {
|
|
10
|
-
position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb';
|
|
11
|
+
position?: 'auto' | 'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br' | 'left' | 'lt' | 'lb' | 'right' | 'rt' | 'rb' | string[];
|
|
12
|
+
poptipAnchor?: 'position' | 'bounds';
|
|
13
|
+
positionBounds?: IAABBBoundsLike;
|
|
11
14
|
title?: string | string[] | number | number[];
|
|
12
15
|
titleStyle?: Partial<ITextGraphicAttribute>;
|
|
13
16
|
titleFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];
|
package/cjs/poptip/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n /**\n * 弹出框的方位,有 12 个方位可供选择\n */\n position
|
|
1
|
+
{"version":3,"sources":["../src/poptip/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGraphic,\n IGroupGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Padding, State } from '../core/type';\nimport type { BackgroundAttributes } from '../interface';\nimport type { IAABBBoundsLike } from '@visactor/vutils';\n\ntype StateStyle = {\n /**\n * title 文本的状态配置\n */\n title?: State<Partial<ITextGraphicAttribute>>;\n /**\n * content 文本的状态配置\n */\n content?: State<Partial<ITextGraphicAttribute>>;\n /**\n * panel 背景的状态配置ß\n */\n panel?: State<Partial<IRectGraphicAttribute>>;\n};\n\nexport type PopTipAttributes = {\n /**\n * 弹出框的方位,有 12 个方位可供选择\n */\n position?:\n | 'auto'\n | 'top'\n | 'tl'\n | 'tr'\n | 'bottom'\n | 'bl'\n | 'br'\n | 'left'\n | 'lt'\n | 'lb'\n | 'right'\n | 'rt'\n | 'rb'\n | string[];\n /**\n * @since 0.22.7\n * 锚点,默认是position,即锚点在position的位置,如果设置为bounds,则锚点会基于bounds进行计算\n */\n poptipAnchor?: 'position' | 'bounds';\n /**\n * @since 0.22.7\n * 布局的包围盒\n * positionBounds 是定位的包围盒,如果配置了的话\n * position为'top' | 'tl' | 'tr': 锚点为positionBounds的上方中间位置\n * position为'bottom' | 'bl' | 'br': 锚点为positionBounds的下方中间位置\n * position为'left' | 'lt' | 'lb': 锚点为positionBounds的左侧中间位置\n * position为'right' | 'rt' | 'rb': 锚点为positionBounds的右侧中间位置\n */\n positionBounds?: IAABBBoundsLike;\n /**\n * 标题内容,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n title?: string | string[] | number | number[];\n /**\n * 标题样式\n */\n titleStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 标题的格式化方法\n */\n titleFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 内容文本,如果需要进行换行,则使用数组形式,如 ['abc', '123']\n */\n content?: string | string[] | number | number[];\n /**\n * 内容文本样式\n */\n contentStyle?: Partial<ITextGraphicAttribute>;\n /**\n * 内容的格式化方法\n */\n contentFormatMethod?: (t: string | string[] | number | number[]) => string | string[] | number | number[];\n /**\n * 标题与内容的间距\n */\n space?: number;\n /**\n * 内部边距\n */\n padding?: Padding;\n /**\n * 标签的背景面板配置, TODO: 支持symbol形状\n * space: 与位置之间的距离\n * square: 是否是正方形\n */\n panel?: BackgroundAttributes &\n ISymbolGraphicAttribute & { space?: number; square?: boolean; panelSymbolType?: string };\n\n // 标签三角的模式,默认是default,即默认的三角形状,concise是紧凑型三角形状显得更简洁\n // @since 0.22.0\n triangleMode?: 'default' | 'concise';\n\n // 放置在poptip前方的logo区域\n logoSymbol?: ISymbolGraphicAttribute;\n // logo内的text\n logoText?: string | string[] | number | number[];\n // logo内的text样式\n logoTextStyle?: Partial<ITextGraphicAttribute>;\n\n /**\n * 最小宽度,像素值\n * @default 30\n */\n minWidth?: number;\n /**\n * 最大宽度,像素值。当文字超过最大宽度时,会自动省略。\n */\n maxWidth?: number;\n\n /**\n * 最大宽度比例\n */\n maxWidthPercent?: number;\n /**\n * 是否展示\n */\n visible?: boolean;\n /**\n * 自定义的展示逻辑\n */\n visibleFunc?: (graphic: IGraphic) => boolean;\n state?: StateStyle;\n dx?: number;\n dy?: number;\n} & Omit<IGroupGraphicAttribute, 'background'>;\n\nexport type PoptipShapeAttributes = {\n /**\n * 是否展示 shape\n */\n visible: boolean;\n} & Partial<ISymbolGraphicAttribute>;\n"]}
|
package/cjs/switch/switch.js
CHANGED
|
@@ -62,9 +62,9 @@ class Switch extends base_1.AbstractComponent {
|
|
|
62
62
|
height: maxHeight
|
|
63
63
|
}), this._circle.setAttributes({
|
|
64
64
|
y: circleY,
|
|
65
|
-
x: this.attribute.checked ?
|
|
65
|
+
x: this.attribute.checked ? maxWidth - circleX : circleX
|
|
66
66
|
}), this._text.setAttributes({
|
|
67
|
-
x: this.attribute.checked ?
|
|
67
|
+
x: this.attribute.checked ? maxWidth - textX - textWidth : textX,
|
|
68
68
|
y: textY
|
|
69
69
|
});
|
|
70
70
|
}
|
package/cjs/switch/switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/switch/switch.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,uCAAiD;AAGjD,yDAA4D;AAE5D,yCAAiD;AACjD,kCAA0C;AAE1C,IAAA,8BAAmB,GAAE,CAAC;AACtB,MAAa,MAAO,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5B,MAAM,EAAE;QACN,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB;IACD,GAAG,EAAE;QACH,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE,kBAAkB;QACjC,WAAW,EAAE,SAAS;QACtB,oBAAoB,EAAE,kBAAkB;QACxC,kBAAkB,EAAE,kBAAkB;QACtC,QAAQ,EAAE,KAAK;KAChB;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,yBAAyB,EAAE,CAAC;CAC7B,CAAC","file":"switch.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { SwitchAttributes } from './type';\nimport type { ICircle } from '@visactor/vrender-core';\nimport { Circle, Rect, Text } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadSwitchComponent } from './register';\nimport { measureTextSize } from '../util';\n\nloadSwitchComponent();\nexport class Switch extends AbstractComponent<Required<SwitchAttributes>> {\n static defaultAttributes: Partial<SwitchAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n circle: {\n radius: 8,\n fill: '#FFF',\n pickable: false\n },\n box: {\n width: 40,\n height: 24,\n cornerRadius: 12,\n uncheckedFill: 'rgb(201,205,212)',\n checkedFill: '#165DFF',\n disableUncheckedFill: 'rgb(242,243,245)',\n disableCheckedFill: 'rgb(148,191,255)',\n pickable: false\n },\n text: {\n textAlign: 'left',\n textBaseline: 'top',\n pickable: false\n },\n spaceBetweenTextAndCircle: 6\n };\n _box: Rect;\n _circle: ICircle;\n _text: Text;\n\n name: 'switch';\n\n constructor(attributes: SwitchAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Switch.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderBox();\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n if (this.attribute.disabled && this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill\n });\n } else if (this.attribute.disabled && !this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.disableUncheckedFill\n });\n } else if (this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill\n });\n } else {\n this._box.setAttributes({\n fill: this.attribute.box.uncheckedFill\n });\n }\n this.appendChild(this._box);\n }\n\n renderCircle() {\n this._circle = new Circle(merge({}, this.attribute.circle));\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new Text(merge({}, this.attribute.text ?? {}));\n if (this.attribute.checked && this.attribute.text?.checkedText) {\n this._text.setAttributes({\n text: this.attribute.text.checkedText\n });\n } else if (this.attribute.text?.uncheckedText) {\n this._text.setAttributes({\n text: this.attribute.text.uncheckedText\n });\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const space = this.attribute.spaceBetweenTextAndCircle;\n const radius = this.attribute.circle.radius;\n\n const boxHeight = this.attribute.box.height;\n const circleHeight = radius * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, circleHeight, textHeight);\n const circleY = maxHeight / 2 - circleHeight / 2 + radius;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const circleWidth = radius * 2;\n // const textWidth = this._text.AABBBounds.width();\n const textWidth = measureTextSize(\n (this.attribute.text?.checkedText?.length ?? 0) > (this.attribute.text?.uncheckedText?.length ?? 0)\n ? this.attribute.text?.checkedText ?? ''\n : this.attribute.text?.uncheckedText ?? '',\n this._text.attribute\n ).width;\n const maxWidth = Math.max(boxWidth, circleWidth + textWidth + space * 3); // [circle[space]text[space][space]]\n const circleX = boxHeight / 2 - circleWidth / 2 + radius;\n const textX = circleX + radius + space;\n\n this._box.setAttributes({\n width: maxWidth,\n height: maxHeight\n });\n\n // set circle position\n this._circle.setAttributes({\n y: circleY,\n x: this.attribute.checked ? circleX : maxWidth - circleX\n });\n\n // set text position\n this._text.setAttributes({\n x: this.attribute.checked ? textX : maxWidth - textX - textWidth,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n } else {\n this.setAttribute('checked', true);\n }\n\n this._dispatchEvent('switch_state_change', {\n eventType: 'switch_state_change',\n checked: this.attribute.checked\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: SwitchAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Switch.defaultAttributes, params);\n super.initAttributes(params);\n this.renderGroup();\n this.render();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/switch/switch.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,uCAAiD;AAGjD,yDAA4D;AAE5D,yCAAiD;AACjD,kCAA0C;AAE1C,IAAA,8BAAmB,GAAE,CAAC;AACtB,MAAa,MAAO,SAAQ,wBAA6C;IAmCvE,YAAY,UAA4B,EAAE,OAA0B;QAClE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,MAAM,CAAC,iBAAiB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kBAAkB;QACjC,WAAW,EAAE,SAAS;QACtB,oBAAoB,EAAE,kBAAkB;QACxC,kBAAkB,EAAE,kBAAkB;QACtC,QAAQ,EAAE,KAAK;KAChB;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,yBAAyB,EAAE,CAAC;CAC7B,CAAC","file":"switch.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { SwitchAttributes } from './type';\nimport type { ICircle } from '@visactor/vrender-core';\nimport { Circle, Rect, Text } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadSwitchComponent } from './register';\nimport { measureTextSize } from '../util';\n\nloadSwitchComponent();\nexport class Switch extends AbstractComponent<Required<SwitchAttributes>> {\n static defaultAttributes: Partial<SwitchAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n circle: {\n radius: 8,\n fill: '#FFF',\n pickable: false\n },\n box: {\n width: 40,\n height: 24,\n cornerRadius: 12,\n uncheckedFill: 'rgb(201,205,212)',\n checkedFill: '#165DFF',\n disableUncheckedFill: 'rgb(242,243,245)',\n disableCheckedFill: 'rgb(148,191,255)',\n pickable: false\n },\n text: {\n textAlign: 'left',\n textBaseline: 'top',\n pickable: false\n },\n spaceBetweenTextAndCircle: 6\n };\n _box: Rect;\n _circle: ICircle;\n _text: Text;\n\n name: 'switch';\n\n constructor(attributes: SwitchAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Switch.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderBox();\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n if (this.attribute.disabled && this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill\n });\n } else if (this.attribute.disabled && !this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.disableUncheckedFill\n });\n } else if (this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill\n });\n } else {\n this._box.setAttributes({\n fill: this.attribute.box.uncheckedFill\n });\n }\n this.appendChild(this._box);\n }\n\n renderCircle() {\n this._circle = new Circle(merge({}, this.attribute.circle));\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new Text(merge({}, this.attribute.text ?? {}));\n if (this.attribute.checked && this.attribute.text?.checkedText) {\n this._text.setAttributes({\n text: this.attribute.text.checkedText\n });\n } else if (this.attribute.text?.uncheckedText) {\n this._text.setAttributes({\n text: this.attribute.text.uncheckedText\n });\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const space = this.attribute.spaceBetweenTextAndCircle;\n const radius = this.attribute.circle.radius;\n\n const boxHeight = this.attribute.box.height;\n const circleHeight = radius * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, circleHeight, textHeight);\n const circleY = maxHeight / 2 - circleHeight / 2 + radius;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const circleWidth = radius * 2;\n // const textWidth = this._text.AABBBounds.width();\n const textWidth = measureTextSize(\n (this.attribute.text?.checkedText?.length ?? 0) > (this.attribute.text?.uncheckedText?.length ?? 0)\n ? this.attribute.text?.checkedText ?? ''\n : this.attribute.text?.uncheckedText ?? '',\n this._text.attribute\n ).width;\n const maxWidth = Math.max(boxWidth, circleWidth + textWidth + space * 3); // [circle[space]text[space][space]]\n const circleX = boxHeight / 2 - circleWidth / 2 + radius;\n const textX = circleX + radius + space;\n\n this._box.setAttributes({\n width: maxWidth,\n height: maxHeight\n });\n\n // set circle position\n this._circle.setAttributes({\n y: circleY,\n x: !this.attribute.checked ? circleX : maxWidth - circleX\n });\n\n // set text position\n this._text.setAttributes({\n x: !this.attribute.checked ? textX : maxWidth - textX - textWidth,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n } else {\n this.setAttribute('checked', true);\n }\n\n this._dispatchEvent('switch_state_change', {\n eventType: 'switch_state_change',\n checked: this.attribute.checked\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: SwitchAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Switch.defaultAttributes, params);\n super.initAttributes(params);\n this.renderGroup();\n this.render();\n }\n}\n"]}
|