| 1234567891011121314151617181920212223242526272829303132333435363738 |
- "use strict";
- var __rest = (this && this.__rest) || function (s, e) {
- var t = {};
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
- t[p] = s[p];
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
- t[p[i]] = s[p[i]];
- }
- return t;
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- exports.spider = void 0;
- const coordinate_1 = require("../../../utils/coordinate");
- const outside_1 = require("./outside");
- /**
- * Spider label transform only suitable for the labels in polar coordinate, labels should distinguish coordinate type.
- */
- function spider(position, points, value, coordinate) {
- if (!(0, coordinate_1.isCircular)(coordinate))
- return {};
- const { connectorLength, connectorLength2, connectorDistance } = value;
- const style = __rest((0, outside_1.inferOutsideCircularStyle)('outside', points, value, coordinate), []);
- const center = coordinate.getCenter();
- const radius = (0, outside_1.radiusOf)(points, value, coordinate);
- const angle = (0, outside_1.angleOf)(points, value, coordinate);
- const radius1 = radius + connectorLength + connectorLength2;
- const sign = Math.sin(angle) > 0 ? 1 : -1;
- const newX = center[0] + (radius1 + +connectorDistance) * sign;
- const { x: originX } = style;
- const dx = newX - originX;
- style.x += dx;
- style.connectorPoints[0][0] -= dx;
- return style;
- }
- exports.spider = spider;
- //# sourceMappingURL=spider.js.map
|