New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@antv/g-plugin-canvas-path-generator

Package Overview
Dependencies
Maintainers
64
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-plugin-canvas-path-generator - npm Package Compare versions

Comparing version 1.1.49 to 1.1.50

214

dist/index.esm.js
import { isDisplayObject, Shape, AbstractRendererPlugin } from '@antv/g-lite';
import { clamp } from '@antv/util';
function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {

@@ -96,77 +16,2 @@ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {

}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}

@@ -256,5 +101,4 @@ function generatePath(context, parsedStyle) {

var _markerStart$parentNo = markerStart.parentNode.getStartTangent(),
_markerStart$parentNo2 = _slicedToArray(_markerStart$parentNo, 2),
p1 = _markerStart$parentNo2[0],
p2 = _markerStart$parentNo2[1];
p1 = _markerStart$parentNo[0],
p2 = _markerStart$parentNo[1];
x = p1[0] - p2[0];

@@ -268,5 +112,4 @@ y = p1[1] - p2[1];

var _markerEnd$parentNode = markerEnd.parentNode.getEndTangent(),
_markerEnd$parentNode2 = _slicedToArray(_markerEnd$parentNode, 2),
_p = _markerEnd$parentNode2[0],
_p2 = _markerEnd$parentNode2[1];
_p = _markerEnd$parentNode[0],
_p2 = _markerEnd$parentNode[1];
x = _p[0] - _p2[0];

@@ -459,7 +302,6 @@ y = _p[1] - _p2[1];

}),
_radius$map2 = _slicedToArray(_radius$map, 4),
tlr = _radius$map2[0],
trr = _radius$map2[1],
brr = _radius$map2[2],
blr = _radius$map2[3];
tlr = _radius$map[0],
trr = _radius$map[1],
brr = _radius$map[2],
blr = _radius$map[3];
context.moveTo(signX * tlr, 0);

@@ -486,29 +328,23 @@ context.lineTo(w - signX * trr, 0);

var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
_inherits(Plugin, _AbstractRendererPlug);
var _super = _createSuper(Plugin);
_inheritsLoose(Plugin, _AbstractRendererPlug);
function Plugin() {
var _this;
_classCallCheck(this, Plugin);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
_this.name = 'canvas-path-generator';
return _this;
}
_createClass(Plugin, [{
key: "init",
value: function init() {
var _pathGeneratorFactory;
var pathGeneratorFactory = (_pathGeneratorFactory = {}, _defineProperty(_pathGeneratorFactory, Shape.CIRCLE, generatePath), _defineProperty(_pathGeneratorFactory, Shape.ELLIPSE, generatePath$1), _defineProperty(_pathGeneratorFactory, Shape.RECT, generatePath$6), _defineProperty(_pathGeneratorFactory, Shape.LINE, generatePath$2), _defineProperty(_pathGeneratorFactory, Shape.POLYLINE, generatePath$5), _defineProperty(_pathGeneratorFactory, Shape.POLYGON, generatePath$4), _defineProperty(_pathGeneratorFactory, Shape.PATH, generatePath$3), _defineProperty(_pathGeneratorFactory, Shape.TEXT, undefined), _defineProperty(_pathGeneratorFactory, Shape.GROUP, undefined), _defineProperty(_pathGeneratorFactory, Shape.IMAGE, undefined), _defineProperty(_pathGeneratorFactory, Shape.HTML, undefined), _defineProperty(_pathGeneratorFactory, Shape.MESH, undefined), _pathGeneratorFactory);
// @ts-ignore
this.context.pathGeneratorFactory = pathGeneratorFactory;
}
}, {
key: "destroy",
value: function destroy() {
// @ts-ignore
delete this.context.pathGeneratorFactory;
}
}]);
var _proto = Plugin.prototype;
_proto.init = function init() {
var _pathGeneratorFactory;
var pathGeneratorFactory = (_pathGeneratorFactory = {}, _pathGeneratorFactory[Shape.CIRCLE] = generatePath, _pathGeneratorFactory[Shape.ELLIPSE] = generatePath$1, _pathGeneratorFactory[Shape.RECT] = generatePath$6, _pathGeneratorFactory[Shape.LINE] = generatePath$2, _pathGeneratorFactory[Shape.POLYLINE] = generatePath$5, _pathGeneratorFactory[Shape.POLYGON] = generatePath$4, _pathGeneratorFactory[Shape.PATH] = generatePath$3, _pathGeneratorFactory[Shape.TEXT] = undefined, _pathGeneratorFactory[Shape.GROUP] = undefined, _pathGeneratorFactory[Shape.IMAGE] = undefined, _pathGeneratorFactory[Shape.HTML] = undefined, _pathGeneratorFactory[Shape.MESH] = undefined, _pathGeneratorFactory);
// @ts-ignore
this.context.pathGeneratorFactory = pathGeneratorFactory;
};
_proto.destroy = function destroy() {
// @ts-ignore
delete this.context.pathGeneratorFactory;
};
return Plugin;

@@ -515,0 +351,0 @@ }(AbstractRendererPlugin);

@@ -8,87 +8,7 @@ 'use strict';

function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {

@@ -101,77 +21,2 @@ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {

}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}

@@ -261,5 +106,4 @@ function generatePath(context, parsedStyle) {

var _markerStart$parentNo = markerStart.parentNode.getStartTangent(),
_markerStart$parentNo2 = _slicedToArray(_markerStart$parentNo, 2),
p1 = _markerStart$parentNo2[0],
p2 = _markerStart$parentNo2[1];
p1 = _markerStart$parentNo[0],
p2 = _markerStart$parentNo[1];
x = p1[0] - p2[0];

@@ -273,5 +117,4 @@ y = p1[1] - p2[1];

var _markerEnd$parentNode = markerEnd.parentNode.getEndTangent(),
_markerEnd$parentNode2 = _slicedToArray(_markerEnd$parentNode, 2),
_p = _markerEnd$parentNode2[0],
_p2 = _markerEnd$parentNode2[1];
_p = _markerEnd$parentNode[0],
_p2 = _markerEnd$parentNode[1];
x = _p[0] - _p2[0];

@@ -464,7 +307,6 @@ y = _p[1] - _p2[1];

}),
_radius$map2 = _slicedToArray(_radius$map, 4),
tlr = _radius$map2[0],
trr = _radius$map2[1],
brr = _radius$map2[2],
blr = _radius$map2[3];
tlr = _radius$map[0],
trr = _radius$map[1],
brr = _radius$map[2],
blr = _radius$map[3];
context.moveTo(signX * tlr, 0);

@@ -491,29 +333,23 @@ context.lineTo(w - signX * trr, 0);

var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
_inherits(Plugin, _AbstractRendererPlug);
var _super = _createSuper(Plugin);
_inheritsLoose(Plugin, _AbstractRendererPlug);
function Plugin() {
var _this;
_classCallCheck(this, Plugin);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
_this.name = 'canvas-path-generator';
return _this;
}
_createClass(Plugin, [{
key: "init",
value: function init() {
var _pathGeneratorFactory;
var pathGeneratorFactory = (_pathGeneratorFactory = {}, _defineProperty(_pathGeneratorFactory, gLite.Shape.CIRCLE, generatePath), _defineProperty(_pathGeneratorFactory, gLite.Shape.ELLIPSE, generatePath$1), _defineProperty(_pathGeneratorFactory, gLite.Shape.RECT, generatePath$6), _defineProperty(_pathGeneratorFactory, gLite.Shape.LINE, generatePath$2), _defineProperty(_pathGeneratorFactory, gLite.Shape.POLYLINE, generatePath$5), _defineProperty(_pathGeneratorFactory, gLite.Shape.POLYGON, generatePath$4), _defineProperty(_pathGeneratorFactory, gLite.Shape.PATH, generatePath$3), _defineProperty(_pathGeneratorFactory, gLite.Shape.TEXT, undefined), _defineProperty(_pathGeneratorFactory, gLite.Shape.GROUP, undefined), _defineProperty(_pathGeneratorFactory, gLite.Shape.IMAGE, undefined), _defineProperty(_pathGeneratorFactory, gLite.Shape.HTML, undefined), _defineProperty(_pathGeneratorFactory, gLite.Shape.MESH, undefined), _pathGeneratorFactory);
// @ts-ignore
this.context.pathGeneratorFactory = pathGeneratorFactory;
}
}, {
key: "destroy",
value: function destroy() {
// @ts-ignore
delete this.context.pathGeneratorFactory;
}
}]);
var _proto = Plugin.prototype;
_proto.init = function init() {
var _pathGeneratorFactory;
var pathGeneratorFactory = (_pathGeneratorFactory = {}, _pathGeneratorFactory[gLite.Shape.CIRCLE] = generatePath, _pathGeneratorFactory[gLite.Shape.ELLIPSE] = generatePath$1, _pathGeneratorFactory[gLite.Shape.RECT] = generatePath$6, _pathGeneratorFactory[gLite.Shape.LINE] = generatePath$2, _pathGeneratorFactory[gLite.Shape.POLYLINE] = generatePath$5, _pathGeneratorFactory[gLite.Shape.POLYGON] = generatePath$4, _pathGeneratorFactory[gLite.Shape.PATH] = generatePath$3, _pathGeneratorFactory[gLite.Shape.TEXT] = undefined, _pathGeneratorFactory[gLite.Shape.GROUP] = undefined, _pathGeneratorFactory[gLite.Shape.IMAGE] = undefined, _pathGeneratorFactory[gLite.Shape.HTML] = undefined, _pathGeneratorFactory[gLite.Shape.MESH] = undefined, _pathGeneratorFactory);
// @ts-ignore
this.context.pathGeneratorFactory = pathGeneratorFactory;
};
_proto.destroy = function destroy() {
// @ts-ignore
delete this.context.pathGeneratorFactory;
};
return Plugin;

@@ -520,0 +356,0 @@ }(gLite.AbstractRendererPlugin);

@@ -7,87 +7,7 @@ (function (global, factory) {

function _iterableToArrayLimit(arr, i) {
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
if (null != _i) {
var _s,
_e,
_x,
_r,
_arr = [],
_n = !0,
_d = !1;
try {
if (_x = (_i = _i.call(arr)).next, 0 === i) {
if (Object(_i) !== _i) return;
_n = !1;
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally {
try {
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {

@@ -100,77 +20,2 @@ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {

}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}

@@ -260,5 +105,4 @@ function generatePath(context, parsedStyle) {

var _markerStart$parentNo = markerStart.parentNode.getStartTangent(),
_markerStart$parentNo2 = _slicedToArray(_markerStart$parentNo, 2),
p1 = _markerStart$parentNo2[0],
p2 = _markerStart$parentNo2[1];
p1 = _markerStart$parentNo[0],
p2 = _markerStart$parentNo[1];
x = p1[0] - p2[0];

@@ -272,5 +116,4 @@ y = p1[1] - p2[1];

var _markerEnd$parentNode = markerEnd.parentNode.getEndTangent(),
_markerEnd$parentNode2 = _slicedToArray(_markerEnd$parentNode, 2),
_p = _markerEnd$parentNode2[0],
_p2 = _markerEnd$parentNode2[1];
_p = _markerEnd$parentNode[0],
_p2 = _markerEnd$parentNode[1];
x = _p[0] - _p2[0];

@@ -473,7 +316,6 @@ y = _p[1] - _p2[1];

}),
_radius$map2 = _slicedToArray(_radius$map, 4),
tlr = _radius$map2[0],
trr = _radius$map2[1],
brr = _radius$map2[2],
blr = _radius$map2[3];
tlr = _radius$map[0],
trr = _radius$map[1],
brr = _radius$map[2],
blr = _radius$map[3];
context.moveTo(signX * tlr, 0);

@@ -500,29 +342,23 @@ context.lineTo(w - signX * trr, 0);

var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
_inherits(Plugin, _AbstractRendererPlug);
var _super = _createSuper(Plugin);
_inheritsLoose(Plugin, _AbstractRendererPlug);
function Plugin() {
var _this;
_classCallCheck(this, Plugin);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
_this.name = 'canvas-path-generator';
return _this;
}
_createClass(Plugin, [{
key: "init",
value: function init() {
var _pathGeneratorFactory;
var pathGeneratorFactory = (_pathGeneratorFactory = {}, _defineProperty(_pathGeneratorFactory, gLite.Shape.CIRCLE, generatePath), _defineProperty(_pathGeneratorFactory, gLite.Shape.ELLIPSE, generatePath$1), _defineProperty(_pathGeneratorFactory, gLite.Shape.RECT, generatePath$6), _defineProperty(_pathGeneratorFactory, gLite.Shape.LINE, generatePath$2), _defineProperty(_pathGeneratorFactory, gLite.Shape.POLYLINE, generatePath$5), _defineProperty(_pathGeneratorFactory, gLite.Shape.POLYGON, generatePath$4), _defineProperty(_pathGeneratorFactory, gLite.Shape.PATH, generatePath$3), _defineProperty(_pathGeneratorFactory, gLite.Shape.TEXT, undefined), _defineProperty(_pathGeneratorFactory, gLite.Shape.GROUP, undefined), _defineProperty(_pathGeneratorFactory, gLite.Shape.IMAGE, undefined), _defineProperty(_pathGeneratorFactory, gLite.Shape.HTML, undefined), _defineProperty(_pathGeneratorFactory, gLite.Shape.MESH, undefined), _pathGeneratorFactory);
// @ts-ignore
this.context.pathGeneratorFactory = pathGeneratorFactory;
}
}, {
key: "destroy",
value: function destroy() {
// @ts-ignore
delete this.context.pathGeneratorFactory;
}
}]);
var _proto = Plugin.prototype;
_proto.init = function init() {
var _pathGeneratorFactory;
var pathGeneratorFactory = (_pathGeneratorFactory = {}, _pathGeneratorFactory[gLite.Shape.CIRCLE] = generatePath, _pathGeneratorFactory[gLite.Shape.ELLIPSE] = generatePath$1, _pathGeneratorFactory[gLite.Shape.RECT] = generatePath$6, _pathGeneratorFactory[gLite.Shape.LINE] = generatePath$2, _pathGeneratorFactory[gLite.Shape.POLYLINE] = generatePath$5, _pathGeneratorFactory[gLite.Shape.POLYGON] = generatePath$4, _pathGeneratorFactory[gLite.Shape.PATH] = generatePath$3, _pathGeneratorFactory[gLite.Shape.TEXT] = undefined, _pathGeneratorFactory[gLite.Shape.GROUP] = undefined, _pathGeneratorFactory[gLite.Shape.IMAGE] = undefined, _pathGeneratorFactory[gLite.Shape.HTML] = undefined, _pathGeneratorFactory[gLite.Shape.MESH] = undefined, _pathGeneratorFactory);
// @ts-ignore
this.context.pathGeneratorFactory = pathGeneratorFactory;
};
_proto.destroy = function destroy() {
// @ts-ignore
delete this.context.pathGeneratorFactory;
};
return Plugin;

@@ -529,0 +365,0 @@ }(gLite.AbstractRendererPlugin);

2

dist/index.umd.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.CanvasPathGenerator={}),t.window.G)}(this,(function(t,e){"use strict";function r(t,e){for(var r=0;e.length>r;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function n(t,e,r){return(e=u(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function c(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=a(t);if(e){var o=a(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return i(this,r)}}function f(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,c=[],f=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;f=!1}else for(;!(f=(n=o.call(r)).done)&&(c.push(n.value),c.length!==e);f=!0);}catch(t){l=!0,a=t}finally{try{if(!f&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw a}}return c}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);e>r;r++)n[r]=t[r];return n}function u(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function s(t,e){var r=e.r;t.arc(r,r,r,0,2*Math.PI,!1)}function h(t,e){var r=e.rx,n=e.ry;if(t.ellipse)t.ellipse(r,n,r,n,0,0,2*Math.PI,!1);else{var a=r>n?r:n,o=r>n?1:r/n,i=r>n?n/r:1;t.save(),t.scale(o,i),t.arc(0,0,a,0,2*Math.PI)}}function p(t,r){var n=r.x1,a=r.y1,o=r.x2,i=r.y2,c=r.defX,f=void 0===c?0:c,l=r.defY,u=void 0===l?0:l,s=r.markerStart,h=r.markerEnd,p=r.markerStartOffset,v=r.markerEndOffset,y=0,d=0,b=0,m=0,M=0;s&&e.isDisplayObject(s)&&p&&(y=Math.cos(M=Math.atan2(i-a,o-n))*(p||0),d=Math.sin(M)*(p||0)),h&&e.isDisplayObject(h)&&v&&(b=Math.cos(M=Math.atan2(a-i,n-o))*(v||0),m=Math.sin(M)*(v||0)),t.moveTo(n-f+y,a-u+d),t.lineTo(o-f+b,i-u+m)}function v(t,r){var n=r.defX,a=void 0===n?0:n,o=r.defY,i=void 0===o?0:o,c=r.markerStart,l=r.markerEnd,u=r.markerStartOffset,s=r.markerEndOffset,h=r.path,p=h.absolutePath,v=h.segments,y=0,d=0,b=0,m=0,M=0;if(c&&e.isDisplayObject(c)&&u){var O=f(c.parentNode.getStartTangent(),2),P=O[0],T=O[1];y=Math.cos(M=Math.atan2(P[1]-T[1],P[0]-T[0]))*(u||0),d=Math.sin(M)*(u||0)}if(l&&e.isDisplayObject(l)&&s){var g=f(l.parentNode.getEndTangent(),2),S=g[0],j=g[1];b=Math.cos(M=Math.atan2(S[1]-j[1],S[0]-j[0]))*(s||0),m=Math.sin(M)*(s||0)}for(var k=0;p.length>k;k++){var E=p[k],w=p[k+1],I=0===k&&(0!==y||0!==d),x=(k===p.length-1||w&&("M"===w[0]||"Z"===w[0]))&&0!==b&&0!==m;switch(E[0]){case"M":I?(t.moveTo(E[1]-a+y,E[2]-i+d),t.lineTo(E[1]-a,E[2]-i)):t.moveTo(E[1]-a,E[2]-i);break;case"L":x?t.lineTo(E[1]-a+b,E[2]-i+m):t.lineTo(E[1]-a,E[2]-i);break;case"Q":t.quadraticCurveTo(E[1]-a,E[2]-i,E[3]-a,E[4]-i),x&&t.lineTo(E[3]-a+b,E[4]-i+m);break;case"C":t.bezierCurveTo(E[1]-a,E[2]-i,E[3]-a,E[4]-i,E[5]-a,E[6]-i),x&&t.lineTo(E[5]-a+b,E[6]-i+m);break;case"A":var A=v[k].arcParams,R=A.cx,G=A.cy,_=A.rx,C=A.ry,D=A.startAngle,L=A.endAngle,N=A.xRotation,Y=A.sweepFlag;if(t.ellipse)t.ellipse(R-a,G-i,_,C,N,D,L,!!(1-Y));else{var X=_>C?_:C,F=_>C?1:_/C,H=_>C?C/_:1;t.translate(R-a,G-i),t.rotate(N),t.scale(F,H),t.arc(0,0,X,D,L,!!(1-Y)),t.scale(1/F,1/H),t.rotate(-N),t.translate(-(R-a),-(G-i))}x&&t.lineTo(E[6]-a+b,E[7]-i+m);break;case"Z":t.closePath()}}}function y(t,r){var n=r.defX,a=void 0===n?0:n,o=r.defY,i=void 0===o?0:o,c=r.markerStart,f=r.markerEnd,l=r.markerStartOffset,u=r.markerEndOffset,s=r.points.points,h=s.length,p=s[0][0]-a,v=s[0][1]-i,y=s[h-1][0]-a,d=s[h-1][1]-i,b=0,m=0,M=0,O=0,P=0;c&&e.isDisplayObject(c)&&l&&(b=Math.cos(P=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(l||0),m=Math.sin(P)*(l||0)),f&&e.isDisplayObject(f)&&u&&(M=Math.cos(P=Math.atan2(s[h-1][1]-s[0][1],s[h-1][0]-s[0][0]))*(u||0),O=Math.sin(P)*(u||0)),t.moveTo(p+(b||M),v+(m||O));for(var T=1;h-1>T;T++){var g=s[T];t.lineTo(g[0]-a,g[1]-i)}t.lineTo(y,d)}function d(t,r){var n=r.defX,a=void 0===n?0:n,o=r.defY,i=void 0===o?0:o,c=r.markerStart,f=r.markerEnd,l=r.markerStartOffset,u=r.markerEndOffset,s=r.points.points,h=s.length,p=s[0][0]-a,v=s[0][1]-i,y=s[h-1][0]-a,d=s[h-1][1]-i,b=0,m=0,M=0,O=0,P=0;c&&e.isDisplayObject(c)&&l&&(b=Math.cos(P=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]))*(l||0),m=Math.sin(P)*(l||0)),f&&e.isDisplayObject(f)&&u&&(M=Math.cos(P=Math.atan2(s[h-2][1]-s[h-1][1],s[h-2][0]-s[h-1][0]))*(u||0),O=Math.sin(P)*(u||0)),t.moveTo(p+b,v+m);for(var T=1;h-1>T;T++){var g=s[T];t.lineTo(g[0]-a,g[1]-i)}t.lineTo(y+M,d+O)}function b(t,e){var r=e.radius,n=e.width,a=e.height,o=n,i=a;if(r&&r.some((function(t){return 0!==t}))){var c=n>0?1:-1,l=a>0?1:-1,u=c+l===0,s=f(r.map((function(t){return e=t,r=0,n=Math.min(Math.abs(o)/2,Math.abs(i)/2),r>e?r:e>n?n:e;var e,r,n})),4),h=s[0],p=s[1],v=s[2],y=s[3];t.moveTo(c*h,0),t.lineTo(o-c*p,0),0!==p&&t.arc(o-c*p,l*p,p,-l*Math.PI/2,c>0?0:Math.PI,u),t.lineTo(o,i-l*v),0!==v&&t.arc(o-c*v,i-l*v,v,c>0?0:Math.PI,l>0?Math.PI/2:1.5*Math.PI,u),t.lineTo(c*y,i),0!==y&&t.arc(c*y,i-l*y,y,l>0?Math.PI/2:-Math.PI/2,c>0?Math.PI:0,u),t.lineTo(0,l*h),0!==h&&t.arc(c*h,l*h,h,c>0?Math.PI:0,l>0?1.5*Math.PI:Math.PI/2,u)}else t.rect(0,0,o,i)}var m=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var a,i,f,l=c(u);function u(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);for(var e=arguments.length,r=Array(e),n=0;e>n;n++)r[n]=arguments[n];return(t=l.call.apply(l,[this].concat(r))).name="canvas-path-generator",t}return a=u,(i=[{key:"init",value:function(){var t,r=(n(t={},e.Shape.CIRCLE,s),n(t,e.Shape.ELLIPSE,h),n(t,e.Shape.RECT,b),n(t,e.Shape.LINE,p),n(t,e.Shape.POLYLINE,d),n(t,e.Shape.POLYGON,y),n(t,e.Shape.PATH,v),n(t,e.Shape.TEXT,void 0),n(t,e.Shape.GROUP,void 0),n(t,e.Shape.IMAGE,void 0),n(t,e.Shape.HTML,void 0),n(t,e.Shape.MESH,void 0),t);this.context.pathGeneratorFactory=r}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])&&r(a.prototype,i),f&&r(a,f),Object.defineProperty(a,"prototype",{writable:!1}),u}(e.AbstractRendererPlugin);t.Plugin=m,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.CanvasPathGenerator={}),t.window.G)}(this,(function(t,e){"use strict";function a(t,e){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},a(t,e)}function r(t,e){var a=e.r;t.arc(a,a,a,0,2*Math.PI,!1)}function n(t,e){var a=e.rx,r=e.ry;if(t.ellipse)t.ellipse(a,r,a,r,0,0,2*Math.PI,!1);else{var n=a>r?a:r,o=a>r?1:a/r,i=a>r?r/a:1;t.save(),t.scale(o,i),t.arc(0,0,n,0,2*Math.PI)}}function o(t,a){var r=a.x1,n=a.y1,o=a.x2,i=a.y2,s=a.defX,h=void 0===s?0:s,c=a.defY,l=void 0===c?0:c,f=a.markerStart,p=a.markerEnd,d=a.markerStartOffset,v=a.markerEndOffset,M=0,u=0,T=0,m=0,y=0;f&&e.isDisplayObject(f)&&d&&(M=Math.cos(y=Math.atan2(i-n,o-r))*(d||0),u=Math.sin(y)*(d||0)),p&&e.isDisplayObject(p)&&v&&(T=Math.cos(y=Math.atan2(n-i,r-o))*(v||0),m=Math.sin(y)*(v||0)),t.moveTo(r-h+M,n-l+u),t.lineTo(o-h+T,i-l+m)}function i(t,a){var r=a.defX,n=void 0===r?0:r,o=a.defY,i=void 0===o?0:o,s=a.markerStart,h=a.markerEnd,c=a.markerStartOffset,l=a.markerEndOffset,f=a.path,p=f.absolutePath,d=f.segments,v=0,M=0,u=0,T=0,m=0;if(s&&e.isDisplayObject(s)&&c){var y=s.parentNode.getStartTangent(),P=y[0],b=y[1];v=Math.cos(m=Math.atan2(P[1]-b[1],P[0]-b[0]))*(c||0),M=Math.sin(m)*(c||0)}if(h&&e.isDisplayObject(h)&&l){var O=h.parentNode.getEndTangent(),S=O[0],g=O[1];u=Math.cos(m=Math.atan2(S[1]-g[1],S[0]-g[0]))*(l||0),T=Math.sin(m)*(l||0)}for(var k=0;p.length>k;k++){var I=p[k],E=p[k+1],j=0===k&&(0!==v||0!==M),x=(k===p.length-1||E&&("M"===E[0]||"Z"===E[0]))&&0!==u&&0!==T;switch(I[0]){case"M":j?(t.moveTo(I[1]-n+v,I[2]-i+M),t.lineTo(I[1]-n,I[2]-i)):t.moveTo(I[1]-n,I[2]-i);break;case"L":x?t.lineTo(I[1]-n+u,I[2]-i+T):t.lineTo(I[1]-n,I[2]-i);break;case"Q":t.quadraticCurveTo(I[1]-n,I[2]-i,I[3]-n,I[4]-i),x&&t.lineTo(I[3]-n+u,I[4]-i+T);break;case"C":t.bezierCurveTo(I[1]-n,I[2]-i,I[3]-n,I[4]-i,I[5]-n,I[6]-i),x&&t.lineTo(I[5]-n+u,I[6]-i+T);break;case"A":var G=d[k].arcParams,L=G.cx,D=G.cy,A=G.rx,C=G.ry,Y=G.startAngle,_=G.endAngle,w=G.xRotation,N=G.sweepFlag;if(t.ellipse)t.ellipse(L-n,D-i,A,C,w,Y,_,!!(1-N));else{var R=A>C?A:C,X=A>C?1:A/C,F=A>C?C/A:1;t.translate(L-n,D-i),t.rotate(w),t.scale(X,F),t.arc(0,0,R,Y,_,!!(1-N)),t.scale(1/X,1/F),t.rotate(-w),t.translate(-(L-n),-(D-i))}x&&t.lineTo(I[6]-n+u,I[7]-i+T);break;case"Z":t.closePath()}}}function s(t,a){var r=a.defX,n=void 0===r?0:r,o=a.defY,i=void 0===o?0:o,s=a.markerStart,h=a.markerEnd,c=a.markerStartOffset,l=a.markerEndOffset,f=a.points.points,p=f.length,d=f[0][0]-n,v=f[0][1]-i,M=f[p-1][0]-n,u=f[p-1][1]-i,T=0,m=0,y=0,P=0,b=0;s&&e.isDisplayObject(s)&&c&&(T=Math.cos(b=Math.atan2(f[1][1]-f[0][1],f[1][0]-f[0][0]))*(c||0),m=Math.sin(b)*(c||0)),h&&e.isDisplayObject(h)&&l&&(y=Math.cos(b=Math.atan2(f[p-1][1]-f[0][1],f[p-1][0]-f[0][0]))*(l||0),P=Math.sin(b)*(l||0)),t.moveTo(d+(T||y),v+(m||P));for(var O=1;p-1>O;O++){var S=f[O];t.lineTo(S[0]-n,S[1]-i)}t.lineTo(M,u)}function h(t,a){var r=a.defX,n=void 0===r?0:r,o=a.defY,i=void 0===o?0:o,s=a.markerStart,h=a.markerEnd,c=a.markerStartOffset,l=a.markerEndOffset,f=a.points.points,p=f.length,d=f[0][0]-n,v=f[0][1]-i,M=f[p-1][0]-n,u=f[p-1][1]-i,T=0,m=0,y=0,P=0,b=0;s&&e.isDisplayObject(s)&&c&&(T=Math.cos(b=Math.atan2(f[1][1]-f[0][1],f[1][0]-f[0][0]))*(c||0),m=Math.sin(b)*(c||0)),h&&e.isDisplayObject(h)&&l&&(y=Math.cos(b=Math.atan2(f[p-2][1]-f[p-1][1],f[p-2][0]-f[p-1][0]))*(l||0),P=Math.sin(b)*(l||0)),t.moveTo(d+T,v+m);for(var O=1;p-1>O;O++){var S=f[O];t.lineTo(S[0]-n,S[1]-i)}t.lineTo(M+y,u+P)}function c(t,e){var a=e.radius,r=e.width,n=e.height,o=r,i=n;if(a&&a.some((function(t){return 0!==t}))){var s=r>0?1:-1,h=n>0?1:-1,c=s+h===0,l=a.map((function(t){return e=t,a=0,r=Math.min(Math.abs(o)/2,Math.abs(i)/2),a>e?a:e>r?r:e;var e,a,r})),f=l[0],p=l[1],d=l[2],v=l[3];t.moveTo(s*f,0),t.lineTo(o-s*p,0),0!==p&&t.arc(o-s*p,h*p,p,-h*Math.PI/2,s>0?0:Math.PI,c),t.lineTo(o,i-h*d),0!==d&&t.arc(o-s*d,i-h*d,d,s>0?0:Math.PI,h>0?Math.PI/2:1.5*Math.PI,c),t.lineTo(s*v,i),0!==v&&t.arc(s*v,i-h*v,v,h>0?Math.PI/2:-Math.PI/2,s>0?Math.PI:0,c),t.lineTo(0,h*f),0!==f&&t.arc(s*f,h*f,f,s>0?Math.PI:0,h>0?1.5*Math.PI:Math.PI/2,c)}else t.rect(0,0,o,i)}var l=function(t){var l,f;function p(){for(var e,a=arguments.length,r=Array(a),n=0;a>n;n++)r[n]=arguments[n];return(e=t.call.apply(t,[this].concat(r))||this).name="canvas-path-generator",e}(l=p).prototype=Object.create((f=t).prototype),l.prototype.constructor=l,a(l,f);var d=p.prototype;return d.init=function(){var t,a=((t={})[e.Shape.CIRCLE]=r,t[e.Shape.ELLIPSE]=n,t[e.Shape.RECT]=c,t[e.Shape.LINE]=o,t[e.Shape.POLYLINE]=h,t[e.Shape.POLYGON]=s,t[e.Shape.PATH]=i,t[e.Shape.TEXT]=void 0,t[e.Shape.GROUP]=void 0,t[e.Shape.IMAGE]=void 0,t[e.Shape.HTML]=void 0,t[e.Shape.MESH]=void 0,t);this.context.pathGeneratorFactory=a},d.destroy=function(){delete this.context.pathGeneratorFactory},p}(e.AbstractRendererPlugin);t.Plugin=l,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "@antv/g-plugin-canvas-path-generator",
"version": "1.1.49",
"version": "1.1.50",
"description": "A G plugin of path generator with Canvas2D API",

@@ -33,3 +33,3 @@ "keywords": [

"dependencies": {
"@antv/g-math": "^1.7.47",
"@antv/g-math": "^1.7.48",
"@antv/util": "^3.3.1",

@@ -47,3 +47,3 @@ "tslib": "^2.3.1"

},
"gitHead": "059286bbeff21a63e75a41811b89623c37f511f4"
"gitHead": "b9efa0d349c3cb699065f407e45f6aa7e0a3336d"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc