@visactor/vrender-components 0.15.0-alpha.24 → 0.15.0-alpha.26
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/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/arc.js +1 -1
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.js +8 -8
- package/cjs/label/base.js.map +1 -1
- package/cjs/legend/size/size.d.ts +2 -2
- package/cjs/legend/size/size.js.map +1 -1
- package/cjs/marker/area.d.ts +20 -1
- package/cjs/marker/area.js +37 -37
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +0 -1
- package/cjs/marker/base.js +18 -28
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/config.d.ts +1 -1
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/line.js +14 -27
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +7 -7
- package/cjs/marker/point.js +4 -5
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +5 -8
- package/cjs/marker/type.js.map +1 -1
- package/cjs/segment/segment.d.ts +6 -11
- package/cjs/segment/segment.js +40 -82
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/segment/type.d.ts +3 -5
- package/cjs/segment/type.js.map +1 -1
- package/cjs/util/index.d.ts +1 -1
- package/cjs/util/index.js +1 -1
- package/cjs/util/index.js.map +1 -1
- package/cjs/util/{label-smartInvert.js → labelSmartInvert.js} +1 -1
- package/cjs/util/labelSmartInvert.js.map +1 -0
- package/dist/index.js +145 -262
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/arc.js +1 -1
- package/es/label/arc.js.map +1 -1
- package/es/label/base.js +1 -1
- package/es/label/base.js.map +1 -1
- package/es/legend/size/size.d.ts +2 -2
- package/es/legend/size/size.js.map +1 -1
- package/es/marker/area.d.ts +20 -1
- package/es/marker/area.js +36 -38
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +0 -1
- package/es/marker/base.js +19 -27
- package/es/marker/base.js.map +1 -1
- package/es/marker/config.d.ts +1 -1
- package/es/marker/config.js.map +1 -1
- package/es/marker/line.js +13 -28
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +7 -7
- package/es/marker/point.js +4 -5
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +5 -8
- package/es/marker/type.js.map +1 -1
- package/es/segment/segment.d.ts +6 -11
- package/es/segment/segment.js +41 -81
- package/es/segment/segment.js.map +1 -1
- package/es/segment/type.d.ts +3 -5
- package/es/segment/type.js.map +1 -1
- package/es/util/index.d.ts +1 -1
- package/es/util/index.js +1 -1
- package/es/util/index.js.map +1 -1
- package/es/util/{label-smartInvert.js → labelSmartInvert.js} +1 -1
- package/es/util/labelSmartInvert.js.map +1 -0
- package/package.json +4 -4
- package/cjs/marker/util.d.ts +0 -1
- package/cjs/marker/util.js +0 -3
- package/cjs/marker/util.js.map +0 -1
- package/cjs/util/label-smartInvert.js.map +0 -1
- package/cjs/util/limit-shape.d.ts +0 -3
- package/cjs/util/limit-shape.js +0 -14
- package/cjs/util/limit-shape.js.map +0 -1
- package/es/marker/util.d.ts +0 -1
- package/es/marker/util.js +0 -3
- package/es/marker/util.js.map +0 -1
- package/es/util/label-smartInvert.js.map +0 -1
- package/es/util/limit-shape.d.ts +0 -3
- package/es/util/limit-shape.js +0 -8
- package/es/util/limit-shape.js.map +0 -1
- /package/cjs/util/{label-smartInvert.d.ts → labelSmartInvert.d.ts} +0 -0
- /package/es/util/{label-smartInvert.d.ts → labelSmartInvert.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -2501,8 +2501,8 @@
|
|
|
2501
2501
|
var _a, _b;
|
|
2502
2502
|
const graphicAttribute = currentMark.attribute;
|
|
2503
2503
|
const center = { x: (_a = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.x) !== null && _a !== void 0 ? _a : 0, y: (_b = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.y) !== null && _b !== void 0 ? _b : 0 };
|
|
2504
|
-
const item = data[index];
|
|
2505
|
-
const textBounds = textBoundsArray[index];
|
|
2504
|
+
const item = data[index] ? data[index] : null;
|
|
2505
|
+
const textBounds = textBoundsArray[index] ? textBoundsArray[index] : 0;
|
|
2506
2506
|
const arcMiddleAngle = (graphicAttribute.startAngle + graphicAttribute.endAngle) / 2;
|
|
2507
2507
|
const intervalAngle = graphicAttribute.endAngle - graphicAttribute.startAngle;
|
|
2508
2508
|
const arcQuadrant = computeQuadrant(graphicAttribute.endAngle - intervalAngle / 2);
|
|
@@ -3211,74 +3211,69 @@
|
|
|
3211
3211
|
};
|
|
3212
3212
|
|
|
3213
3213
|
class Segment extends AbstractComponent {
|
|
3214
|
-
getStartAngle() {
|
|
3215
|
-
return this._startAngle;
|
|
3216
|
-
}
|
|
3217
|
-
getEndAngle() {
|
|
3218
|
-
return this._endAngle;
|
|
3219
|
-
}
|
|
3220
|
-
getMainSegmentPoints() {
|
|
3221
|
-
return this._mainSegmentPoints;
|
|
3222
|
-
}
|
|
3223
3214
|
constructor(attributes) {
|
|
3224
3215
|
super(vutils.merge({}, Segment.defaultAttributes, attributes));
|
|
3225
3216
|
this.name = 'segment';
|
|
3226
3217
|
}
|
|
3218
|
+
computeLineAngle() {
|
|
3219
|
+
const { points } = this.attribute;
|
|
3220
|
+
const start = points[0];
|
|
3221
|
+
const startInside = points[1];
|
|
3222
|
+
const endInside = points[points.length - 2];
|
|
3223
|
+
const end = points[points.length - 1];
|
|
3224
|
+
const startVector = [start.x - startInside.x, start.y - startInside.y];
|
|
3225
|
+
const startAngle = Math.atan2(startVector[1], startVector[0]);
|
|
3226
|
+
const endVector = [end.x - endInside.x, end.y - endInside.y];
|
|
3227
|
+
const endAngle = Math.atan2(endVector[1], endVector[0]);
|
|
3228
|
+
this._startAngle = startAngle;
|
|
3229
|
+
this._endAngle = endAngle;
|
|
3230
|
+
}
|
|
3227
3231
|
render() {
|
|
3228
3232
|
this.removeAllChild();
|
|
3229
|
-
this.
|
|
3230
|
-
const { startSymbol, endSymbol, lineStyle, state, visible = true, multiSegment, mainSegmentIndex } = this.attribute;
|
|
3233
|
+
const { points, startSymbol, endSymbol, lineStyle, state, visible = true } = this.attribute;
|
|
3231
3234
|
if (!visible) {
|
|
3232
3235
|
return;
|
|
3233
3236
|
}
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
+
if (points.length > 1) {
|
|
3238
|
+
this.computeLineAngle();
|
|
3239
|
+
}
|
|
3240
|
+
const startSymbolShape = this.renderSymbol(startSymbol, 'start');
|
|
3241
|
+
const endSymbolShape = this.renderSymbol(endSymbol, 'end');
|
|
3237
3242
|
this.startSymbol = startSymbolShape;
|
|
3238
3243
|
this.endSymbol = endSymbolShape;
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
points[points.length - 1][points[points.length - 1].length - 1] =
|
|
3248
|
-
clipPoints[clipPoints.length - 1];
|
|
3249
|
-
}
|
|
3250
|
-
points.forEach((point, index) => {
|
|
3251
|
-
var _a, _b;
|
|
3252
|
-
const line = vrender.createLine(Object.assign(Object.assign({ points: point }, (vutils.isArray(lineStyle) ? (_a = lineStyle[index]) !== null && _a !== void 0 ? _a : lineStyle[lineStyle.length - 1] : lineStyle)), { fill: false }));
|
|
3253
|
-
line.name = `${this.name}-line`;
|
|
3254
|
-
line.id = this._getNodeId('line' + index);
|
|
3255
|
-
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.line)) {
|
|
3256
|
-
line.states = vutils.isArray(state.line) ? (_b = state.line[index]) !== null && _b !== void 0 ? _b : state.line[state.line.length - 1] : state.line;
|
|
3257
|
-
}
|
|
3258
|
-
this.add(line);
|
|
3259
|
-
});
|
|
3244
|
+
let pointsAfterClip = points;
|
|
3245
|
+
if (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.visible) {
|
|
3246
|
+
const startSize = (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.clip) ? (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.size) || 10 : 0;
|
|
3247
|
+
const pointsStart = {
|
|
3248
|
+
x: points[0].x - (startSize / 2) * (Math.cos(this._startAngle) || 0),
|
|
3249
|
+
y: points[0].y - (startSize / 2) * (Math.sin(this._startAngle) || 0)
|
|
3250
|
+
};
|
|
3251
|
+
pointsAfterClip = [pointsStart, ...pointsAfterClip.slice(1)];
|
|
3260
3252
|
}
|
|
3261
|
-
|
|
3262
|
-
const
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
this.add(line);
|
|
3253
|
+
if (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.visible) {
|
|
3254
|
+
const endSize = (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.clip) ? (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.size) || 10 : 0;
|
|
3255
|
+
const pointsEnd = {
|
|
3256
|
+
x: points[points.length - 1].x - (endSize / 2) * (Math.cos(this._endAngle) || 0),
|
|
3257
|
+
y: points[points.length - 1].y - (endSize / 2) * (Math.sin(this._endAngle) || 0)
|
|
3258
|
+
};
|
|
3259
|
+
pointsAfterClip = [...pointsAfterClip.slice(0, pointsAfterClip.length - 1), pointsEnd];
|
|
3269
3260
|
}
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
if (!
|
|
3274
|
-
|
|
3261
|
+
const line = vrender.createLine(Object.assign({ points: pointsAfterClip, fill: false }, lineStyle));
|
|
3262
|
+
line.name = 'line';
|
|
3263
|
+
line.id = this._getNodeId('line');
|
|
3264
|
+
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.line)) {
|
|
3265
|
+
line.states = state.line;
|
|
3275
3266
|
}
|
|
3267
|
+
this.line = line;
|
|
3268
|
+
this.add(line);
|
|
3269
|
+
}
|
|
3270
|
+
renderSymbol(attribute, dim) {
|
|
3276
3271
|
const { autoRotate = true } = attribute;
|
|
3277
3272
|
let symbol;
|
|
3278
3273
|
if (attribute === null || attribute === void 0 ? void 0 : attribute.visible) {
|
|
3279
3274
|
const startAngle = this._startAngle;
|
|
3280
3275
|
const endAngle = this._endAngle;
|
|
3281
|
-
const { state } = this.attribute;
|
|
3276
|
+
const { points, state } = this.attribute;
|
|
3282
3277
|
const start = points[0];
|
|
3283
3278
|
const end = points[points.length - 1];
|
|
3284
3279
|
const { refX = 0, refY = 0, refAngle = 0, style, symbolType, size = 12 } = attribute;
|
|
@@ -3286,22 +3281,20 @@
|
|
|
3286
3281
|
let rotate;
|
|
3287
3282
|
if (dim === 'start') {
|
|
3288
3283
|
position = {
|
|
3289
|
-
x: start.x +
|
|
3290
|
-
|
|
3291
|
-
y: start.y +
|
|
3292
|
-
(vutils.isValidNumber(startAngle) ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
|
|
3284
|
+
x: start.x + (startAngle ? refX * Math.cos(startAngle) + refY * Math.cos(startAngle - Math.PI / 2) : 0),
|
|
3285
|
+
y: start.y + (startAngle ? refX * Math.sin(startAngle) + refY * Math.sin(startAngle - Math.PI / 2) : 0)
|
|
3293
3286
|
};
|
|
3294
3287
|
rotate = startAngle + Math.PI / 2;
|
|
3295
3288
|
}
|
|
3296
3289
|
else {
|
|
3297
3290
|
position = {
|
|
3298
|
-
x: end.x + (
|
|
3299
|
-
y: end.y + (
|
|
3291
|
+
x: end.x + (endAngle ? refX * Math.cos(endAngle) + refY * Math.cos(endAngle - Math.PI / 2) : 0),
|
|
3292
|
+
y: end.y + (endAngle ? refX * Math.sin(endAngle) + refY * Math.sin(endAngle - Math.PI / 2) : 0)
|
|
3300
3293
|
};
|
|
3301
3294
|
rotate = endAngle + Math.PI / 2;
|
|
3302
3295
|
}
|
|
3303
3296
|
symbol = vrender.createSymbol(Object.assign(Object.assign(Object.assign({}, position), { symbolType: symbolType, size, angle: autoRotate ? rotate + refAngle : 0, strokeBoundsBuffer: 0 }), style));
|
|
3304
|
-
symbol.name = `${
|
|
3297
|
+
symbol.name = `${dim}-symbol`;
|
|
3305
3298
|
symbol.id = this._getNodeId(`${dim}-symbol`);
|
|
3306
3299
|
if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.symbol)) {
|
|
3307
3300
|
symbol.states = state.symbol;
|
|
@@ -3310,69 +3303,11 @@
|
|
|
3310
3303
|
}
|
|
3311
3304
|
return symbol;
|
|
3312
3305
|
}
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
return this._mainSegmentPoints;
|
|
3316
|
-
}
|
|
3317
|
-
const { points: originPoints, multiSegment, mainSegmentIndex } = this.attribute;
|
|
3318
|
-
let points;
|
|
3319
|
-
if (multiSegment) {
|
|
3320
|
-
if (vutils.isValidNumber(mainSegmentIndex)) {
|
|
3321
|
-
points = originPoints[mainSegmentIndex];
|
|
3322
|
-
}
|
|
3323
|
-
else {
|
|
3324
|
-
points = vutils.flattenArray(originPoints);
|
|
3325
|
-
}
|
|
3326
|
-
}
|
|
3327
|
-
else {
|
|
3328
|
-
points = originPoints;
|
|
3329
|
-
}
|
|
3330
|
-
this._mainSegmentPoints = points;
|
|
3331
|
-
return points;
|
|
3332
|
-
}
|
|
3333
|
-
_clipPoints(points) {
|
|
3334
|
-
const { startSymbol, endSymbol } = this.attribute;
|
|
3335
|
-
let pointsAfterClip = points;
|
|
3336
|
-
if (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.visible) {
|
|
3337
|
-
const startSize = (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.clip) ? (startSymbol === null || startSymbol === void 0 ? void 0 : startSymbol.size) || 10 : 0;
|
|
3338
|
-
const pointsStart = {
|
|
3339
|
-
x: points[0].x - (startSize / 2) * (Math.cos(this._startAngle) || 0),
|
|
3340
|
-
y: points[0].y - (startSize / 2) * (Math.sin(this._startAngle) || 0)
|
|
3341
|
-
};
|
|
3342
|
-
pointsAfterClip = [pointsStart, ...pointsAfterClip.slice(1)];
|
|
3343
|
-
}
|
|
3344
|
-
if (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.visible) {
|
|
3345
|
-
const endSize = (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.clip) ? (endSymbol === null || endSymbol === void 0 ? void 0 : endSymbol.size) || 10 : 0;
|
|
3346
|
-
const pointsEnd = {
|
|
3347
|
-
x: points[points.length - 1].x - (endSize / 2) * (Math.cos(this._endAngle) || 0),
|
|
3348
|
-
y: points[points.length - 1].y - (endSize / 2) * (Math.sin(this._endAngle) || 0)
|
|
3349
|
-
};
|
|
3350
|
-
pointsAfterClip = [...pointsAfterClip.slice(0, pointsAfterClip.length - 1), pointsEnd];
|
|
3351
|
-
}
|
|
3352
|
-
return pointsAfterClip;
|
|
3353
|
-
}
|
|
3354
|
-
_computeLineAngle() {
|
|
3355
|
-
const points = this._getMainSegmentPoints();
|
|
3356
|
-
if (points.length <= 1) {
|
|
3357
|
-
return;
|
|
3358
|
-
}
|
|
3359
|
-
const start = points[0];
|
|
3360
|
-
const startInside = points[1];
|
|
3361
|
-
const endInside = points[points.length - 2];
|
|
3362
|
-
const end = points[points.length - 1];
|
|
3363
|
-
const startVector = [start.x - startInside.x, start.y - startInside.y];
|
|
3364
|
-
const startAngle = Math.atan2(startVector[1], startVector[0]);
|
|
3365
|
-
const endVector = [end.x - endInside.x, end.y - endInside.y];
|
|
3366
|
-
const endAngle = Math.atan2(endVector[1], endVector[0]);
|
|
3367
|
-
this._startAngle = startAngle;
|
|
3368
|
-
this._endAngle = endAngle;
|
|
3306
|
+
getStartAngle() {
|
|
3307
|
+
return this._startAngle;
|
|
3369
3308
|
}
|
|
3370
|
-
|
|
3371
|
-
this.
|
|
3372
|
-
this.endSymbol = null;
|
|
3373
|
-
this._startAngle = null;
|
|
3374
|
-
this._endAngle = null;
|
|
3375
|
-
this._mainSegmentPoints = null;
|
|
3309
|
+
getEndAngle() {
|
|
3310
|
+
return this._endAngle;
|
|
3376
3311
|
}
|
|
3377
3312
|
}
|
|
3378
3313
|
Segment.defaultAttributes = {
|
|
@@ -6084,41 +6019,25 @@
|
|
|
6084
6019
|
})(exports.IMarkPointItemPosition || (exports.IMarkPointItemPosition = {}));
|
|
6085
6020
|
|
|
6086
6021
|
class Marker extends AbstractComponent {
|
|
6087
|
-
constructor() {
|
|
6088
|
-
super(...arguments);
|
|
6089
|
-
this.name = 'marker';
|
|
6090
|
-
}
|
|
6091
6022
|
_initContainer() {
|
|
6092
|
-
var _a, _b;
|
|
6093
|
-
const {
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
this._containerClip = groupClip;
|
|
6103
|
-
this.add(groupClip);
|
|
6104
|
-
}
|
|
6105
|
-
else {
|
|
6106
|
-
group = vrender.createGroup({
|
|
6107
|
-
x: 0,
|
|
6108
|
-
y: 0
|
|
6109
|
-
});
|
|
6110
|
-
this.add(group);
|
|
6111
|
-
}
|
|
6112
|
-
group.name = 'marker-container';
|
|
6023
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6024
|
+
const groupClip = vrender.createGroup(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
|
|
6025
|
+
groupClip.name = 'marker-container';
|
|
6026
|
+
const group = vrender.createGroup({
|
|
6027
|
+
x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
|
|
6028
|
+
y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
|
|
6029
|
+
});
|
|
6030
|
+
groupClip.add(group);
|
|
6031
|
+
this._containerClip = groupClip;
|
|
6032
|
+
this.add(groupClip);
|
|
6113
6033
|
this._container = group;
|
|
6114
6034
|
}
|
|
6115
6035
|
_updateContainer() {
|
|
6116
|
-
var _a, _b, _c;
|
|
6117
|
-
|
|
6118
|
-
(_a = this._containerClip) === null || _a === void 0 ? void 0 : _a.setAttributes(Object.assign({}, limitRect));
|
|
6036
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6037
|
+
this._containerClip.setAttributes(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
|
|
6119
6038
|
this._container.setAttributes({
|
|
6120
|
-
x:
|
|
6121
|
-
y:
|
|
6039
|
+
x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
|
|
6040
|
+
y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
|
|
6122
6041
|
});
|
|
6123
6042
|
}
|
|
6124
6043
|
render() {
|
|
@@ -6130,7 +6049,7 @@
|
|
|
6130
6049
|
this.setAttribute('childrenPickable', false);
|
|
6131
6050
|
}
|
|
6132
6051
|
if (markerVisible) {
|
|
6133
|
-
if (!this.
|
|
6052
|
+
if (!this._containerClip) {
|
|
6134
6053
|
this._initContainer();
|
|
6135
6054
|
this.initMarker(this._container);
|
|
6136
6055
|
}
|
|
@@ -6367,84 +6286,47 @@
|
|
|
6367
6286
|
}
|
|
6368
6287
|
};
|
|
6369
6288
|
|
|
6370
|
-
function limitShapeInBounds(shape, bounds) {
|
|
6371
|
-
const { x1: regionMinX, y1: regionMinY, x2: regionMaxX, y2: regionMaxY } = bounds;
|
|
6372
|
-
const { x1, y1, x2, y2 } = shape.AABBBounds;
|
|
6373
|
-
const { dx: originDx = 0, dy: originDy = 0 } = shape.attribute;
|
|
6374
|
-
let dx = 0;
|
|
6375
|
-
let dy = 0;
|
|
6376
|
-
if (x1 < regionMinX) {
|
|
6377
|
-
dx = regionMinX - x1;
|
|
6378
|
-
}
|
|
6379
|
-
if (y1 < regionMinY) {
|
|
6380
|
-
dy = regionMinY - y1;
|
|
6381
|
-
}
|
|
6382
|
-
if (x2 > regionMaxX) {
|
|
6383
|
-
dx = regionMaxX - x2;
|
|
6384
|
-
}
|
|
6385
|
-
if (y2 > regionMaxY) {
|
|
6386
|
-
dy = regionMaxY - y2;
|
|
6387
|
-
}
|
|
6388
|
-
if (dx) {
|
|
6389
|
-
shape.setAttribute('dx', dx + originDx);
|
|
6390
|
-
}
|
|
6391
|
-
if (dy) {
|
|
6392
|
-
shape.setAttribute('dy', dy + originDy);
|
|
6393
|
-
}
|
|
6394
|
-
}
|
|
6395
|
-
|
|
6396
6289
|
class MarkLine extends Marker {
|
|
6397
6290
|
constructor(attributes) {
|
|
6398
6291
|
super(vutils.merge({}, MarkLine.defaultAttributes, attributes));
|
|
6399
6292
|
}
|
|
6400
6293
|
setLabelPos() {
|
|
6401
|
-
var _a, _b;
|
|
6402
|
-
const {
|
|
6403
|
-
const
|
|
6404
|
-
const
|
|
6405
|
-
const
|
|
6406
|
-
const
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
if (position.includes('start') || position.includes('Start')) {
|
|
6410
|
-
labelPoint = {
|
|
6294
|
+
var _a, _b, _c, _d, _e;
|
|
6295
|
+
const { points, label } = this.attribute;
|
|
6296
|
+
const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'end';
|
|
6297
|
+
const labelAngle = this._line.getEndAngle();
|
|
6298
|
+
const labelOffsetX = (label === null || label === void 0 ? void 0 : label.refX) * Math.cos(labelAngle) + label.refY * Math.cos(labelAngle - Math.PI / 2);
|
|
6299
|
+
const labelOffsetY = (label === null || label === void 0 ? void 0 : label.refX) * Math.sin(labelAngle) + label.refY * Math.sin(labelAngle - Math.PI / 2);
|
|
6300
|
+
if (labelPosition.includes('start') || labelPosition.includes('Start')) {
|
|
6301
|
+
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes({
|
|
6411
6302
|
x: points[0].x + labelOffsetX,
|
|
6412
6303
|
y: points[0].y + labelOffsetY
|
|
6413
|
-
};
|
|
6304
|
+
});
|
|
6414
6305
|
}
|
|
6415
|
-
else if (
|
|
6416
|
-
|
|
6306
|
+
else if (labelPosition.includes('middle') || labelPosition.includes('Middle')) {
|
|
6307
|
+
(_c = this._label) === null || _c === void 0 ? void 0 : _c.setAttributes({
|
|
6417
6308
|
x: (points[0].x + points[points.length - 1].x) / 2 + labelOffsetX,
|
|
6418
6309
|
y: (points[0].y + points[points.length - 1].y) / 2 + labelOffsetY
|
|
6419
|
-
};
|
|
6310
|
+
});
|
|
6420
6311
|
}
|
|
6421
6312
|
else {
|
|
6422
|
-
|
|
6313
|
+
(_d = this._label) === null || _d === void 0 ? void 0 : _d.setAttributes({
|
|
6423
6314
|
x: points[points.length - 1].x + labelOffsetX,
|
|
6424
6315
|
y: points[points.length - 1].y + labelOffsetY
|
|
6425
|
-
};
|
|
6426
|
-
}
|
|
6427
|
-
this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { angle: label.autoRotate ? labelAngle + ((_b = label === null || label === void 0 ? void 0 : label.refAngle) !== null && _b !== void 0 ? _b : 0) : 0, textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_LINE_TEXT_STYLE_MAP[position]), label.textStyle) }));
|
|
6428
|
-
if (limitRect && confine) {
|
|
6429
|
-
const { x, y, width, height } = limitRect;
|
|
6430
|
-
limitShapeInBounds(this._label, {
|
|
6431
|
-
x1: x,
|
|
6432
|
-
y1: y,
|
|
6433
|
-
x2: x + width,
|
|
6434
|
-
y2: y + height
|
|
6435
6316
|
});
|
|
6436
6317
|
}
|
|
6318
|
+
this._label.setAttributes({
|
|
6319
|
+
angle: label.autoRotate && labelAngle + ((_e = label === null || label === void 0 ? void 0 : label.refAngle) !== null && _e !== void 0 ? _e : 0),
|
|
6320
|
+
textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_LINE_TEXT_STYLE_MAP[labelPosition]), label.textStyle)
|
|
6321
|
+
});
|
|
6437
6322
|
}
|
|
6438
6323
|
initMarker(container) {
|
|
6439
|
-
const { points, startSymbol, endSymbol, label, lineStyle
|
|
6440
|
-
.attribute;
|
|
6324
|
+
const { points, startSymbol, endSymbol, label, lineStyle } = this.attribute;
|
|
6441
6325
|
const line = new Segment({
|
|
6442
6326
|
points,
|
|
6443
6327
|
startSymbol,
|
|
6444
6328
|
endSymbol,
|
|
6445
|
-
lineStyle
|
|
6446
|
-
mainSegmentIndex,
|
|
6447
|
-
multiSegment
|
|
6329
|
+
lineStyle
|
|
6448
6330
|
});
|
|
6449
6331
|
line.name = 'mark-line-line';
|
|
6450
6332
|
this._line = line;
|
|
@@ -6464,7 +6346,7 @@
|
|
|
6464
6346
|
endSymbol,
|
|
6465
6347
|
lineStyle
|
|
6466
6348
|
});
|
|
6467
|
-
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({
|
|
6349
|
+
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, label));
|
|
6468
6350
|
this.setLabelPos();
|
|
6469
6351
|
}
|
|
6470
6352
|
}
|
|
@@ -6474,54 +6356,58 @@
|
|
|
6474
6356
|
constructor(attributes) {
|
|
6475
6357
|
super(vutils.merge({}, MarkArea.defaultAttributes, attributes));
|
|
6476
6358
|
}
|
|
6477
|
-
|
|
6478
|
-
const { x1, x2, y1, y2 } = this._area.AABBBounds;
|
|
6479
|
-
if (direction.includes('left') || direction.includes('Left')) {
|
|
6480
|
-
return {
|
|
6481
|
-
x: x1,
|
|
6482
|
-
y: (y1 + y2) / 2
|
|
6483
|
-
};
|
|
6484
|
-
}
|
|
6485
|
-
if (direction.includes('right') || direction.includes('Right')) {
|
|
6486
|
-
return {
|
|
6487
|
-
x: x2,
|
|
6488
|
-
y: (y1 + y2) / 2
|
|
6489
|
-
};
|
|
6490
|
-
}
|
|
6491
|
-
if (direction.includes('top') || direction.includes('Top')) {
|
|
6492
|
-
return {
|
|
6493
|
-
x: (x1 + x2) / 2,
|
|
6494
|
-
y: y1
|
|
6495
|
-
};
|
|
6496
|
-
}
|
|
6497
|
-
if (direction.includes('bottom') || direction.includes('Bottom')) {
|
|
6498
|
-
return {
|
|
6499
|
-
x: (x1 + x2) / 2,
|
|
6500
|
-
y: y2
|
|
6501
|
-
};
|
|
6502
|
-
}
|
|
6359
|
+
getLeftPos() {
|
|
6503
6360
|
return {
|
|
6504
|
-
x:
|
|
6505
|
-
y: (y1 + y2) / 2
|
|
6361
|
+
x: this._area.AABBBounds.x1,
|
|
6362
|
+
y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
|
|
6363
|
+
};
|
|
6364
|
+
}
|
|
6365
|
+
getRightPos() {
|
|
6366
|
+
return {
|
|
6367
|
+
x: this._area.AABBBounds.x2,
|
|
6368
|
+
y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
|
|
6369
|
+
};
|
|
6370
|
+
}
|
|
6371
|
+
getTopPos() {
|
|
6372
|
+
return {
|
|
6373
|
+
x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
|
|
6374
|
+
y: this._area.AABBBounds.y1
|
|
6375
|
+
};
|
|
6376
|
+
}
|
|
6377
|
+
getBottomPos() {
|
|
6378
|
+
return {
|
|
6379
|
+
x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
|
|
6380
|
+
y: this._area.AABBBounds.y2
|
|
6381
|
+
};
|
|
6382
|
+
}
|
|
6383
|
+
getMiddlePos() {
|
|
6384
|
+
return {
|
|
6385
|
+
x: (this._area.AABBBounds.x1 + this._area.AABBBounds.x2) / 2,
|
|
6386
|
+
y: (this._area.AABBBounds.y1 + this._area.AABBBounds.y2) / 2
|
|
6506
6387
|
};
|
|
6507
6388
|
}
|
|
6508
6389
|
setLabelPos() {
|
|
6509
|
-
var _a;
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle) }));
|
|
6515
|
-
if (this.attribute.limitRect && (label === null || label === void 0 ? void 0 : label.confine)) {
|
|
6516
|
-
const { x, y, width, height } = this.attribute.limitRect;
|
|
6517
|
-
limitShapeInBounds(this._label, {
|
|
6518
|
-
x1: x,
|
|
6519
|
-
y1: y,
|
|
6520
|
-
x2: x + width,
|
|
6521
|
-
y2: y + height
|
|
6522
|
-
});
|
|
6523
|
-
}
|
|
6390
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6391
|
+
const { label } = this.attribute;
|
|
6392
|
+
const labelPosition = (_a = label === null || label === void 0 ? void 0 : label.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
6393
|
+
if (labelPosition.includes('left') || labelPosition.includes('Left')) {
|
|
6394
|
+
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, this.getLeftPos()));
|
|
6524
6395
|
}
|
|
6396
|
+
else if (labelPosition.includes('right') || labelPosition.includes('Right')) {
|
|
6397
|
+
(_c = this._label) === null || _c === void 0 ? void 0 : _c.setAttributes(Object.assign({}, this.getRightPos()));
|
|
6398
|
+
}
|
|
6399
|
+
else if (labelPosition.includes('top') || labelPosition.includes('Top')) {
|
|
6400
|
+
(_d = this._label) === null || _d === void 0 ? void 0 : _d.setAttributes(Object.assign({}, this.getTopPos()));
|
|
6401
|
+
}
|
|
6402
|
+
else if (labelPosition.includes('bottom') || labelPosition.includes('Bottom')) {
|
|
6403
|
+
(_e = this._label) === null || _e === void 0 ? void 0 : _e.setAttributes(Object.assign({}, this.getBottomPos()));
|
|
6404
|
+
}
|
|
6405
|
+
else {
|
|
6406
|
+
(_f = this._label) === null || _f === void 0 ? void 0 : _f.setAttributes(Object.assign({}, this.getMiddlePos()));
|
|
6407
|
+
}
|
|
6408
|
+
(_g = this._label) === null || _g === void 0 ? void 0 : _g.setAttributes({
|
|
6409
|
+
textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle)
|
|
6410
|
+
});
|
|
6525
6411
|
}
|
|
6526
6412
|
initMarker(container) {
|
|
6527
6413
|
const { points, label, areaStyle } = this.attribute;
|
|
@@ -6539,7 +6425,7 @@
|
|
|
6539
6425
|
var _a, _b;
|
|
6540
6426
|
const { points, label, areaStyle } = this.attribute;
|
|
6541
6427
|
(_a = this._area) === null || _a === void 0 ? void 0 : _a.setAttributes(Object.assign({ points: points }, areaStyle));
|
|
6542
|
-
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({
|
|
6428
|
+
(_b = this._label) === null || _b === void 0 ? void 0 : _b.setAttributes(Object.assign({}, label));
|
|
6543
6429
|
this.setLabelPos();
|
|
6544
6430
|
}
|
|
6545
6431
|
}
|
|
@@ -6553,29 +6439,26 @@
|
|
|
6553
6439
|
}
|
|
6554
6440
|
setItemAttributes(item, itemContent, itemPosition, itemType) {
|
|
6555
6441
|
var _a;
|
|
6556
|
-
if (!item) {
|
|
6557
|
-
return;
|
|
6558
|
-
}
|
|
6559
6442
|
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0, textStyle, richTextStyle, imageStyle, position = exports.IMarkPointItemPosition.middle } = itemContent;
|
|
6560
6443
|
const itemAngle = ((_a = this._line) === null || _a === void 0 ? void 0 : _a.getEndAngle()) || 0;
|
|
6561
6444
|
const itemOffsetX = refX * Math.cos(itemAngle) + refY * Math.cos(itemAngle - Math.PI / 2);
|
|
6562
6445
|
const itemOffsetY = refX * Math.sin(itemAngle) + refY * Math.sin(itemAngle - Math.PI / 2);
|
|
6563
6446
|
if (itemType === 'text') {
|
|
6564
|
-
item.setAttributes(Object.assign(Object.assign({}, textStyle), { textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_POINT_TEXT_STYLE_MAP[(itemContent === null || itemContent === void 0 ? void 0 : itemContent.position) || 'end']), textStyle === null || textStyle === void 0 ? void 0 : textStyle.textStyle) }));
|
|
6447
|
+
item === null || item === void 0 ? void 0 : item.setAttributes(Object.assign(Object.assign({}, textStyle), { textStyle: Object.assign(Object.assign({}, DEFAULT_MARK_POINT_TEXT_STYLE_MAP[(itemContent === null || itemContent === void 0 ? void 0 : itemContent.position) || 'end']), textStyle === null || textStyle === void 0 ? void 0 : textStyle.textStyle) }));
|
|
6565
6448
|
}
|
|
6566
6449
|
else if (itemType === 'richText') {
|
|
6567
|
-
item.setAttributes({
|
|
6450
|
+
item === null || item === void 0 ? void 0 : item.setAttributes({
|
|
6568
6451
|
dx: this.getItemDx(item, position, richTextStyle) + ((richTextStyle === null || richTextStyle === void 0 ? void 0 : richTextStyle.dx) || 0),
|
|
6569
6452
|
dy: this.getItemDy(item, position, richTextStyle) + ((richTextStyle === null || richTextStyle === void 0 ? void 0 : richTextStyle.dy) || 0)
|
|
6570
6453
|
});
|
|
6571
6454
|
}
|
|
6572
6455
|
else if (itemType === 'image') {
|
|
6573
|
-
item.setAttributes({
|
|
6456
|
+
item === null || item === void 0 ? void 0 : item.setAttributes({
|
|
6574
6457
|
dx: this.getItemDx(item, position, imageStyle) + ((imageStyle === null || imageStyle === void 0 ? void 0 : imageStyle.dx) || 0),
|
|
6575
6458
|
dy: this.getItemDy(item, position, imageStyle) + ((imageStyle === null || imageStyle === void 0 ? void 0 : imageStyle.dy) || 0)
|
|
6576
6459
|
});
|
|
6577
6460
|
}
|
|
6578
|
-
item.setAttributes({
|
|
6461
|
+
item === null || item === void 0 ? void 0 : item.setAttributes({
|
|
6579
6462
|
x: itemPosition.x + (itemOffsetX || 0),
|
|
6580
6463
|
y: itemPosition.y + (itemOffsetY || 0),
|
|
6581
6464
|
angle: autoRotate && itemAngle + refAngle
|
|
@@ -6587,7 +6470,7 @@
|
|
|
6587
6470
|
if (position.includes('inside')) {
|
|
6588
6471
|
return -width;
|
|
6589
6472
|
}
|
|
6590
|
-
if (position === 'insideTop') {
|
|
6473
|
+
else if (position === 'insideTop') {
|
|
6591
6474
|
return 0;
|
|
6592
6475
|
}
|
|
6593
6476
|
return 0;
|
|
@@ -6598,7 +6481,7 @@
|
|
|
6598
6481
|
if (position.includes('top') || position.includes('Top')) {
|
|
6599
6482
|
return -height;
|
|
6600
6483
|
}
|
|
6601
|
-
if (position.includes('middle') || position.includes('Middle')) {
|
|
6484
|
+
else if (position.includes('middle') || position.includes('Middle')) {
|
|
6602
6485
|
return -height / 2;
|
|
6603
6486
|
}
|
|
6604
6487
|
return 0;
|
|
@@ -10475,7 +10358,7 @@
|
|
|
10475
10358
|
return new Tag(params ? params.attribute : {});
|
|
10476
10359
|
}
|
|
10477
10360
|
|
|
10478
|
-
const version = "0.15.0-alpha.
|
|
10361
|
+
const version = "0.15.0-alpha.26";
|
|
10479
10362
|
|
|
10480
10363
|
exports.AbstractComponent = AbstractComponent;
|
|
10481
10364
|
exports.ArcInfo = ArcInfo;
|