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

@antv/g-plugin-canvas-picker

Package Overview
Dependencies
Maintainers
0
Versions
247
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-plugin-canvas-picker - npm Package Compare versions

Comparing version 2.0.14 to 2.0.15

242

dist/index.esm.js
/*!
* @antv/g-plugin-canvas-picker
* @description A G plugin for picking in canvas
* @version 2.0.14
* @date 10/23/2024, 7:15:38 AM
* @version 2.0.15
* @date 10/23/2024, 11:16:32 AM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/
import { Point, findClosestClipPathTarget, isFillOrStrokeAffected, getOrCalculatePathTotalLength, Shape, AbstractRendererPlugin } from '@antv/g-lite';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
import _createClass from '@babel/runtime/helpers/createClass';
import _callSuper from '@babel/runtime/helpers/callSuper';
import _inherits from '@babel/runtime/helpers/inherits';
import { findClosestClipPathTarget, Point, isFillOrStrokeAffected, getOrCalculatePathTotalLength, Shape, AbstractRendererPlugin } from '@antv/g-lite';
import _createForOfIteratorHelper from '@babel/runtime/helpers/createForOfIteratorHelper';

@@ -29,7 +34,9 @@ import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime';

*/
class CanvasPickerPlugin {
constructor() {
this.isHit = (displayObject, position, worldTransform, isClipPath) => {
var CanvasPickerPlugin = /*#__PURE__*/function () {
function CanvasPickerPlugin() {
var _this = this;
_classCallCheck(this, CanvasPickerPlugin);
this.isHit = function (displayObject, position, worldTransform, isClipPath) {
// use picker for current shape's type
var pick = this.context.pointInPathPickerFactory[displayObject.nodeName];
var pick = _this.context.pointInPathPickerFactory[displayObject.nodeName];
if (pick) {

@@ -41,3 +48,3 @@ // invert with world matrix

var localPosition = vec3.transformMat4(tmpVec3b, vec3.set(tmpVec3c, position[0], position[1], 0), invertWorldMat);
if (pick(displayObject, new Point(localPosition[0], localPosition[1]), isClipPath, this.isPointInPath, this.context, this.runtime)) {
if (pick(displayObject, new Point(localPosition[0], localPosition[1]), isClipPath, _this.isPointInPath, _this.context, _this.runtime)) {
return true;

@@ -52,5 +59,5 @@ }

*/
this.isPointInPath = (displayObject, position) => {
var context = this.runtime.offscreenCanvasCreator.getOrCreateContext(this.context.config.offscreenCanvas);
var generatePath = this.context.pathGeneratorFactory[displayObject.nodeName];
this.isPointInPath = function (displayObject, position) {
var context = _this.runtime.offscreenCanvasCreator.getOrCreateContext(_this.context.config.offscreenCanvas);
var generatePath = _this.context.pathGeneratorFactory[displayObject.nodeName];
if (generatePath) {

@@ -64,60 +71,71 @@ context.beginPath();

}
apply(context, runtime) {
var _renderingContext$roo,
_this = this;
var renderingService = context.renderingService,
renderingContext = context.renderingContext;
this.context = context;
this.runtime = runtime;
var document = (_renderingContext$roo = renderingContext.root) === null || _renderingContext$roo === void 0 ? void 0 : _renderingContext$roo.ownerDocument;
renderingService.hooks.pick.tapPromise(CanvasPickerPlugin.tag, /*#__PURE__*/function () {
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(result) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", _this.pick(document, result));
case 1:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}());
renderingService.hooks.pickSync.tap(CanvasPickerPlugin.tag, result => {
return this.pick(document, result);
});
}
pick(document, result) {
var topmost = result.topmost,
_result$position = result.position,
x = _result$position.x,
y = _result$position.y;
return _createClass(CanvasPickerPlugin, [{
key: "apply",
value: function apply(context, runtime) {
var _renderingContext$roo,
_this2 = this;
var renderingService = context.renderingService,
renderingContext = context.renderingContext;
this.context = context;
this.runtime = runtime;
var document = (_renderingContext$roo = renderingContext.root) === null || _renderingContext$roo === void 0 ? void 0 : _renderingContext$roo.ownerDocument;
renderingService.hooks.pick.tapPromise(CanvasPickerPlugin.tag, /*#__PURE__*/function () {
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(result) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", _this2.pick(document, result));
case 1:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}());
renderingService.hooks.pickSync.tap(CanvasPickerPlugin.tag, function (result) {
return _this2.pick(document, result);
});
}
}, {
key: "pick",
value: function pick(document, result) {
var topmost = result.topmost,
_result$position = result.position,
x = _result$position.x,
y = _result$position.y;
// position in world space
var position = vec3.set(tmpVec3a, x, y, 0);
// position in world space
var position = vec3.set(tmpVec3a, x, y, 0);
// query by AABB first with spatial index(r-tree)
var hitTestList = document.elementsFromBBox(position[0], position[1], position[0], position[1]);
// query by AABB first with spatial index(r-tree)
var hitTestList = document.elementsFromBBox(position[0], position[1], position[0], position[1]);
// test with clip path & origin shape
// @see https://github.com/antvis/g/issues/1064
var pickedDisplayObjects = [];
var _iterator = _createForOfIteratorHelper(hitTestList),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _displayObject = _step.value;
var worldTransform = _displayObject.getWorldTransform();
var isHitOriginShape = this.isHit(_displayObject, position, worldTransform, false);
if (isHitOriginShape) {
// should look up in the ancestor node
var clipped = findClosestClipPathTarget(_displayObject);
if (clipped) {
var _ref2 = clipped.parsedStyle,
clipPath = _ref2.clipPath;
var isHitClipPath = this.isHit(clipPath, position, clipPath.getWorldTransform(), true);
if (isHitClipPath) {
// test with clip path & origin shape
// @see https://github.com/antvis/g/issues/1064
var pickedDisplayObjects = [];
var _iterator = _createForOfIteratorHelper(hitTestList),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _displayObject = _step.value;
var worldTransform = _displayObject.getWorldTransform();
var isHitOriginShape = this.isHit(_displayObject, position, worldTransform, false);
if (isHitOriginShape) {
// should look up in the ancestor node
var clipped = findClosestClipPathTarget(_displayObject);
if (clipped) {
var _ref2 = clipped.parsedStyle,
clipPath = _ref2.clipPath;
var isHitClipPath = this.isHit(clipPath, position, clipPath.getWorldTransform(), true);
if (isHitClipPath) {
if (topmost) {
result.picked = [_displayObject];
return result;
}
pickedDisplayObjects.push(_displayObject);
}
} else {
if (topmost) {

@@ -129,20 +147,14 @@ result.picked = [_displayObject];

}
} else {
if (topmost) {
result.picked = [_displayObject];
return result;
}
pickedDisplayObjects.push(_displayObject);
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
result.picked = pickedDisplayObjects;
return result;
}
result.picked = pickedDisplayObjects;
return result;
}
}
}]);
}();
CanvasPickerPlugin.tag = 'CanvasPicker';

@@ -535,3 +547,5 @@

hasStroke = _isFillOrStrokeAffect2[1];
var hasRadius = radius && radius.some(r => r !== 0);
var hasRadius = radius && radius.some(function (r) {
return r !== 0;
});
var lineWidthForHitTesting = lineWidth + increasedLineWidthForHitTesting;

@@ -556,3 +570,5 @@

if (hasStroke || isClipPath) {
isHit = inRectWithRadius(x, y, width, height, radius.map(r => clamp(r, 0, Math.min(Math.abs(width) / 2, Math.abs(height) / 2))), lineWidthForHitTesting, position.x, position.y);
isHit = inRectWithRadius(x, y, width, height, radius.map(function (r) {
return clamp(r, 0, Math.min(Math.abs(width) / 2, Math.abs(height) / 2));
}), lineWidthForHitTesting, position.x, position.y);
}

@@ -600,3 +616,5 @@ // 仅填充时带有圆角的矩形直接通过图形拾取

var imagedata = context.getImageData(position.x - x, position.y - y, 1, 1).data;
return imagedata.every(component => component !== 0);
return imagedata.every(function (component) {
return component !== 0;
});
}

@@ -613,35 +631,35 @@ return true;

class Plugin extends AbstractRendererPlugin {
constructor() {
super(...arguments);
this.name = 'canvas-picker';
var Plugin = /*#__PURE__*/function (_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 = _callSuper(this, Plugin, [].concat(args));
_this.name = 'canvas-picker';
return _this;
}
init() {
var pointInPathPickerFactory = {
[Shape.CIRCLE]: isPointInPath$8,
[Shape.ELLIPSE]: isPointInPath$7,
[Shape.RECT]: isPointInPath$2,
[Shape.LINE]: isPointInPath$6,
[Shape.POLYLINE]: isPointInPath$3,
[Shape.POLYGON]: isPointInPath$4,
[Shape.PATH]: isPointInPath$5,
[Shape.TEXT]: isPointInPath,
[Shape.GROUP]: null,
[Shape.IMAGE]: isPointInPath$1,
[Shape.HTML]: null,
[Shape.MESH]: null
};
_inherits(Plugin, _AbstractRendererPlug);
return _createClass(Plugin, [{
key: "init",
value: function init() {
var _pointInPathPickerFac;
var pointInPathPickerFactory = (_pointInPathPickerFac = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_pointInPathPickerFac, Shape.CIRCLE, isPointInPath$8), Shape.ELLIPSE, isPointInPath$7), Shape.RECT, isPointInPath$2), Shape.LINE, isPointInPath$6), Shape.POLYLINE, isPointInPath$3), Shape.POLYGON, isPointInPath$4), Shape.PATH, isPointInPath$5), Shape.TEXT, isPointInPath), Shape.GROUP, null), Shape.IMAGE, isPointInPath$1), _defineProperty(_defineProperty(_pointInPathPickerFac, Shape.HTML, null), Shape.MESH, null));
// @ts-ignore
this.context.pointInPathPickerFactory = pointInPathPickerFactory;
this.addRenderingPlugin(new CanvasPickerPlugin());
}
destroy() {
// @ts-ignore
delete this.context.pointInPathPickerFactory;
this.removeAllRenderingPlugins();
}
}
// @ts-ignore
this.context.pointInPathPickerFactory = pointInPathPickerFactory;
this.addRenderingPlugin(new CanvasPickerPlugin());
}
}, {
key: "destroy",
value: function destroy() {
// @ts-ignore
delete this.context.pointInPathPickerFactory;
this.removeAllRenderingPlugins();
}
}]);
}(AbstractRendererPlugin);
export { Plugin };
//# sourceMappingURL=index.esm.js.map
/*!
* @antv/g-plugin-canvas-picker
* @description A G plugin for picking in canvas
* @version 2.0.14
* @date 10/23/2024, 7:15:38 AM
* @version 2.0.15
* @date 10/23/2024, 11:16:32 AM
* @author AntVis

@@ -11,2 +11,7 @@ * @docs https://g.antv.antgroup.com/

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
var _createClass = require('@babel/runtime/helpers/createClass');
var _callSuper = require('@babel/runtime/helpers/callSuper');
var _inherits = require('@babel/runtime/helpers/inherits');
var gLite = require('@antv/g-lite');

@@ -32,7 +37,9 @@ var _createForOfIteratorHelper = require('@babel/runtime/helpers/createForOfIteratorHelper');

*/
class CanvasPickerPlugin {
constructor() {
this.isHit = (displayObject, position, worldTransform, isClipPath) => {
var CanvasPickerPlugin = /*#__PURE__*/function () {
function CanvasPickerPlugin() {
var _this = this;
_classCallCheck(this, CanvasPickerPlugin);
this.isHit = function (displayObject, position, worldTransform, isClipPath) {
// use picker for current shape's type
var pick = this.context.pointInPathPickerFactory[displayObject.nodeName];
var pick = _this.context.pointInPathPickerFactory[displayObject.nodeName];
if (pick) {

@@ -44,3 +51,3 @@ // invert with world matrix

var localPosition = glMatrix.vec3.transformMat4(tmpVec3b, glMatrix.vec3.set(tmpVec3c, position[0], position[1], 0), invertWorldMat);
if (pick(displayObject, new gLite.Point(localPosition[0], localPosition[1]), isClipPath, this.isPointInPath, this.context, this.runtime)) {
if (pick(displayObject, new gLite.Point(localPosition[0], localPosition[1]), isClipPath, _this.isPointInPath, _this.context, _this.runtime)) {
return true;

@@ -55,5 +62,5 @@ }

*/
this.isPointInPath = (displayObject, position) => {
var context = this.runtime.offscreenCanvasCreator.getOrCreateContext(this.context.config.offscreenCanvas);
var generatePath = this.context.pathGeneratorFactory[displayObject.nodeName];
this.isPointInPath = function (displayObject, position) {
var context = _this.runtime.offscreenCanvasCreator.getOrCreateContext(_this.context.config.offscreenCanvas);
var generatePath = _this.context.pathGeneratorFactory[displayObject.nodeName];
if (generatePath) {

@@ -67,60 +74,71 @@ context.beginPath();

}
apply(context, runtime) {
var _renderingContext$roo,
_this = this;
var renderingService = context.renderingService,
renderingContext = context.renderingContext;
this.context = context;
this.runtime = runtime;
var document = (_renderingContext$roo = renderingContext.root) === null || _renderingContext$roo === void 0 ? void 0 : _renderingContext$roo.ownerDocument;
renderingService.hooks.pick.tapPromise(CanvasPickerPlugin.tag, /*#__PURE__*/function () {
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(result) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", _this.pick(document, result));
case 1:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}());
renderingService.hooks.pickSync.tap(CanvasPickerPlugin.tag, result => {
return this.pick(document, result);
});
}
pick(document, result) {
var topmost = result.topmost,
_result$position = result.position,
x = _result$position.x,
y = _result$position.y;
return _createClass(CanvasPickerPlugin, [{
key: "apply",
value: function apply(context, runtime) {
var _renderingContext$roo,
_this2 = this;
var renderingService = context.renderingService,
renderingContext = context.renderingContext;
this.context = context;
this.runtime = runtime;
var document = (_renderingContext$roo = renderingContext.root) === null || _renderingContext$roo === void 0 ? void 0 : _renderingContext$roo.ownerDocument;
renderingService.hooks.pick.tapPromise(CanvasPickerPlugin.tag, /*#__PURE__*/function () {
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(result) {
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
return _context.abrupt("return", _this2.pick(document, result));
case 1:
case "end":
return _context.stop();
}
}, _callee);
}));
return function (_x) {
return _ref.apply(this, arguments);
};
}());
renderingService.hooks.pickSync.tap(CanvasPickerPlugin.tag, function (result) {
return _this2.pick(document, result);
});
}
}, {
key: "pick",
value: function pick(document, result) {
var topmost = result.topmost,
_result$position = result.position,
x = _result$position.x,
y = _result$position.y;
// position in world space
var position = glMatrix.vec3.set(tmpVec3a, x, y, 0);
// position in world space
var position = glMatrix.vec3.set(tmpVec3a, x, y, 0);
// query by AABB first with spatial index(r-tree)
var hitTestList = document.elementsFromBBox(position[0], position[1], position[0], position[1]);
// query by AABB first with spatial index(r-tree)
var hitTestList = document.elementsFromBBox(position[0], position[1], position[0], position[1]);
// test with clip path & origin shape
// @see https://github.com/antvis/g/issues/1064
var pickedDisplayObjects = [];
var _iterator = _createForOfIteratorHelper(hitTestList),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _displayObject = _step.value;
var worldTransform = _displayObject.getWorldTransform();
var isHitOriginShape = this.isHit(_displayObject, position, worldTransform, false);
if (isHitOriginShape) {
// should look up in the ancestor node
var clipped = gLite.findClosestClipPathTarget(_displayObject);
if (clipped) {
var _ref2 = clipped.parsedStyle,
clipPath = _ref2.clipPath;
var isHitClipPath = this.isHit(clipPath, position, clipPath.getWorldTransform(), true);
if (isHitClipPath) {
// test with clip path & origin shape
// @see https://github.com/antvis/g/issues/1064
var pickedDisplayObjects = [];
var _iterator = _createForOfIteratorHelper(hitTestList),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _displayObject = _step.value;
var worldTransform = _displayObject.getWorldTransform();
var isHitOriginShape = this.isHit(_displayObject, position, worldTransform, false);
if (isHitOriginShape) {
// should look up in the ancestor node
var clipped = gLite.findClosestClipPathTarget(_displayObject);
if (clipped) {
var _ref2 = clipped.parsedStyle,
clipPath = _ref2.clipPath;
var isHitClipPath = this.isHit(clipPath, position, clipPath.getWorldTransform(), true);
if (isHitClipPath) {
if (topmost) {
result.picked = [_displayObject];
return result;
}
pickedDisplayObjects.push(_displayObject);
}
} else {
if (topmost) {

@@ -132,20 +150,14 @@ result.picked = [_displayObject];

}
} else {
if (topmost) {
result.picked = [_displayObject];
return result;
}
pickedDisplayObjects.push(_displayObject);
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
result.picked = pickedDisplayObjects;
return result;
}
result.picked = pickedDisplayObjects;
return result;
}
}
}]);
}();
CanvasPickerPlugin.tag = 'CanvasPicker';

@@ -538,3 +550,5 @@

hasStroke = _isFillOrStrokeAffect2[1];
var hasRadius = radius && radius.some(r => r !== 0);
var hasRadius = radius && radius.some(function (r) {
return r !== 0;
});
var lineWidthForHitTesting = lineWidth + increasedLineWidthForHitTesting;

@@ -559,3 +573,5 @@

if (hasStroke || isClipPath) {
isHit = inRectWithRadius(x, y, width, height, radius.map(r => util.clamp(r, 0, Math.min(Math.abs(width) / 2, Math.abs(height) / 2))), lineWidthForHitTesting, position.x, position.y);
isHit = inRectWithRadius(x, y, width, height, radius.map(function (r) {
return util.clamp(r, 0, Math.min(Math.abs(width) / 2, Math.abs(height) / 2));
}), lineWidthForHitTesting, position.x, position.y);
}

@@ -603,3 +619,5 @@ // 仅填充时带有圆角的矩形直接通过图形拾取

var imagedata = context.getImageData(position.x - x, position.y - y, 1, 1).data;
return imagedata.every(component => component !== 0);
return imagedata.every(function (component) {
return component !== 0;
});
}

@@ -616,35 +634,35 @@ return true;

class Plugin extends gLite.AbstractRendererPlugin {
constructor() {
super(...arguments);
this.name = 'canvas-picker';
var Plugin = /*#__PURE__*/function (_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 = _callSuper(this, Plugin, [].concat(args));
_this.name = 'canvas-picker';
return _this;
}
init() {
var pointInPathPickerFactory = {
[gLite.Shape.CIRCLE]: isPointInPath$8,
[gLite.Shape.ELLIPSE]: isPointInPath$7,
[gLite.Shape.RECT]: isPointInPath$2,
[gLite.Shape.LINE]: isPointInPath$6,
[gLite.Shape.POLYLINE]: isPointInPath$3,
[gLite.Shape.POLYGON]: isPointInPath$4,
[gLite.Shape.PATH]: isPointInPath$5,
[gLite.Shape.TEXT]: isPointInPath,
[gLite.Shape.GROUP]: null,
[gLite.Shape.IMAGE]: isPointInPath$1,
[gLite.Shape.HTML]: null,
[gLite.Shape.MESH]: null
};
_inherits(Plugin, _AbstractRendererPlug);
return _createClass(Plugin, [{
key: "init",
value: function init() {
var _pointInPathPickerFac;
var pointInPathPickerFactory = (_pointInPathPickerFac = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_pointInPathPickerFac, gLite.Shape.CIRCLE, isPointInPath$8), gLite.Shape.ELLIPSE, isPointInPath$7), gLite.Shape.RECT, isPointInPath$2), gLite.Shape.LINE, isPointInPath$6), gLite.Shape.POLYLINE, isPointInPath$3), gLite.Shape.POLYGON, isPointInPath$4), gLite.Shape.PATH, isPointInPath$5), gLite.Shape.TEXT, isPointInPath), gLite.Shape.GROUP, null), gLite.Shape.IMAGE, isPointInPath$1), _defineProperty(_defineProperty(_pointInPathPickerFac, gLite.Shape.HTML, null), gLite.Shape.MESH, null));
// @ts-ignore
this.context.pointInPathPickerFactory = pointInPathPickerFactory;
this.addRenderingPlugin(new CanvasPickerPlugin());
}
destroy() {
// @ts-ignore
delete this.context.pointInPathPickerFactory;
this.removeAllRenderingPlugins();
}
}
// @ts-ignore
this.context.pointInPathPickerFactory = pointInPathPickerFactory;
this.addRenderingPlugin(new CanvasPickerPlugin());
}
}, {
key: "destroy",
value: function destroy() {
// @ts-ignore
delete this.context.pointInPathPickerFactory;
this.removeAllRenderingPlugins();
}
}]);
}(gLite.AbstractRendererPlugin);
exports.Plugin = Plugin;
//# sourceMappingURL=index.js.map
/*!
* @antv/g-plugin-canvas-picker
* @description A G plugin for picking in canvas
* @version 2.0.14
* @date 10/23/2024, 7:15:38 AM
* @version 2.0.15
* @date 10/23/2024, 11:16:32 AM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],r):r(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.CanvasPicker={}),t.window.G)}(this,(function(t,r){"use strict";function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);r>e;e++)n[e]=t[e];return n}function n(t,r){if(t){if("string"==typeof t)return e(t,r);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(){i=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",f=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=Object.create((r&&r.prototype instanceof b?r:b).prototype),i=new A(n||[]);return a(o,"_invoke",{value:k(t,e,i)}),o}function v(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var y="suspendedStart",p="suspendedYield",d="executing",g="completed",m={};function b(){}function x(){}function w(){}var P={};l(P,u,(function(){return this}));var S=Object.getPrototypeOf,M=S&&S(S(T([])));M&&M!==e&&n.call(M,u)&&(P=M);var O=w.prototype=b.prototype=Object.create(P);function E(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function L(t,r){function e(i,a,c,u){var f=v(t[i],t,a);if("throw"!==f.type){var s=f.arg,l=s.value;return l&&"object"==o(l)&&n.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,c,u)}),(function(t){e("throw",t,c,u)})):r.resolve(l).then((function(t){s.value=t,c(s)}),(function(t){return e("throw",t,c,u)}))}u(f.arg)}var i;a(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function k(r,e,n){var o=y;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var f=v(r,e,n);if("normal"===f.type){if(o=n.done?g:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=g,n.method="throw",n.arg=f.arg)}}}function j(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,j(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=v(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function F(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function I(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(F,this),this.reset(!0)}function T(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function e(){for(;++i<r.length;)if(n.call(r,i))return e.value=r[i],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(o(r)+" is not iterable")}return x.prototype=w,a(O,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:x,configurable:!0}),x.displayName=l(w,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===x||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},r.awrap=function(t){return{__await:t}},E(L.prototype),l(L.prototype,f,(function(){return this})),r.AsyncIterator=L,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new L(h(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(O),l(O,s,"Generator"),l(O,u,(function(){return this})),l(O,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,A.prototype={constructor:A,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(this.prev>=a.tryLoc){var u=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(u&&f){if(a.catchLoc>this.prev)return o(a.catchLoc,!0);if(a.finallyLoc>this.prev)return o(a.finallyLoc)}else if(u){if(a.catchLoc>this.prev)return o(a.catchLoc,!0)}else{if(!f)throw Error("try statement without catch or finally");if(a.finallyLoc>this.prev)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(this.prev>=o.tryLoc&&n.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&r>=i.tryLoc&&i.finallyLoc>=r&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),I(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;I(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:T(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function a(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}var c="undefined"!=typeof Float32Array?Float32Array:Array;function u(){var t=new c(3);return c!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function f(t,r,e,n){return t[0]=r,t[1]=e,t[2]=n,t}Math.hypot||(Math.hypot=function(){for(var t=0,r=arguments.length;r--;)t+=arguments[r]*arguments[r];return Math.sqrt(t)}),u(),function(){var t,r=(t=new c(2),c!=Float32Array&&(t[0]=0,t[1]=0),t)}();var s,l=u(),h=u(),v=u(),y=(s=new c(16),c!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s);class p{constructor(){this.isHit=(t,e,n,o)=>{var i=this.context.pointInPathPickerFactory[t.nodeName];if(i){var a=function(t,r){var e=r[0],n=r[1],o=r[2],i=r[3],a=r[4],c=r[5],u=r[6],f=r[7],s=r[8],l=r[9],h=r[10],v=r[11],y=r[12],p=r[13],d=r[14],g=r[15],m=e*c-n*a,b=e*u-o*a,x=e*f-i*a,w=n*u-o*c,P=n*f-i*c,S=o*f-i*u,M=s*p-l*y,O=s*d-h*y,E=s*g-v*y,L=l*d-h*p,k=l*g-v*p,j=h*g-v*d,F=m*j-b*k+x*L+w*E-P*O+S*M;return F?(t[0]=(c*j-u*k+f*L)*(F=1/F),t[1]=(o*k-n*j-i*L)*F,t[2]=(p*S-d*P+g*w)*F,t[3]=(h*P-l*S-v*w)*F,t[4]=(u*E-a*j-f*O)*F,t[5]=(e*j-o*E+i*O)*F,t[6]=(d*x-y*S-g*b)*F,t[7]=(s*S-h*x+v*b)*F,t[8]=(a*k-c*E+f*M)*F,t[9]=(n*E-e*k-i*M)*F,t[10]=(y*P-p*x+g*m)*F,t[11]=(l*x-s*P-v*m)*F,t[12]=(c*O-a*L-u*M)*F,t[13]=(e*L-n*O+o*M)*F,t[14]=(p*b-y*w-d*m)*F,t[15]=(s*w-l*b+h*m)*F,t):null}(y,n),c=function(t,r,e){var n=r[0],o=r[1],i=r[2],a=e[3]*n+e[7]*o+e[11]*i+e[15];return t[0]=(e[0]*n+e[4]*o+e[8]*i+e[12])/(a=a||1),t[1]=(e[1]*n+e[5]*o+e[9]*i+e[13])/a,t[2]=(e[2]*n+e[6]*o+e[10]*i+e[14])/a,t}(h,f(v,e[0],e[1],0),a);if(i(t,new r.Point(c[0],c[1]),o,this.isPointInPath,this.context,this.runtime))return!0}return!1},this.isPointInPath=(t,r)=>{var e=this.runtime.offscreenCanvasCreator.getOrCreateContext(this.context.config.offscreenCanvas),n=this.context.pathGeneratorFactory[t.nodeName];return n&&(e.beginPath(),n(e,t.parsedStyle),e.closePath()),e.isPointInPath(r.x,r.y)}}apply(t,r){var e,n=this,o=t.renderingService,c=t.renderingContext;this.context=t,this.runtime=r;var u=null===(e=c.root)||void 0===e?void 0:e.ownerDocument;o.hooks.pick.tapPromise(p.tag,function(){var t,r=(t=i().mark((function t(r){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",n.pick(u,r));case 1:case"end":return t.stop()}}),t)})),function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function c(t){a(i,n,o,c,u,"next",t)}function u(t){a(i,n,o,c,u,"throw",t)}c(void 0)}))});return function(t){return r.apply(this,arguments)}}()),o.hooks.pickSync.tap(p.tag,(t=>this.pick(u,t)))}pick(t,e){var o,i=e.topmost,a=e.position,c=f(l,a.x,a.y,0),u=[],s=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=n(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var o=0,i=function(){};return{s:i,n:function(){return t.length>o?{done:!1,value:t[o++]}:{done:!0}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return c=t.done,t},e:function(t){u=!0,a=t},f:function(){try{c||null==e.return||e.return()}finally{if(u)throw a}}}}(t.elementsFromBBox(c[0],c[1],c[0],c[1]));try{for(s.s();!(o=s.n()).done;){var h=o.value,v=h.getWorldTransform();if(this.isHit(h,c,v,!1)){var y=r.findClosestClipPathTarget(h);if(y){var p=y.parsedStyle.clipPath;if(this.isHit(p,c,p.getWorldTransform(),!0)){if(i)return e.picked=[h],e;u.push(h)}}else{if(i)return e.picked=[h],e;u.push(h)}}}}catch(t){s.e(t)}finally{s.f()}return e.picked=u,e}}function d(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,c=[],u=!0,f=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;u=!1}else for(;!(u=(n=i.call(e)).done)&&(c.push(n.value),c.length!==r);u=!0);}catch(t){f=!0,o=t}finally{try{if(!u&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(f)throw o}}return c}}(t,r)||n(t,r)||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.")}()}p.tag="CanvasPicker";var g=function(t,r,e){return r>t?r:t>e?e:t};function m(t,r,e){return{x:t*Math.cos(e)-r*Math.sin(e),y:t*Math.sin(e)+r*Math.cos(e)}}function b(t,r,e,n,o,i,a,c,u,f){var s,l,h,v,y,p=t,d=r,g=e,x=n,w=c,P=u,S=120*Math.PI/180,M=Math.PI/180*(+o||0),O=[];if(f)l=f[0],h=f[1],v=f[2],y=f[3];else{d=(s=m(p,d,-M)).y;var E=((p=s.x)-(w=(s=m(w,P,-M)).x))/2,L=(d-(P=s.y))/2,k=E*E/(g*g)+L*L/(x*x);k>1&&(g*=k=Math.sqrt(k),x*=k);var j=g*g,F=x*x,I=(i===a?-1:1)*Math.sqrt(Math.abs((j*F-j*L*L-F*E*E)/(j*L*L+F*E*E)));v=I*g*L/x+(p+w)/2,l=Math.asin(((d-(y=I*-x*E/g+(d+P)/2))/x*1e9>>0)/1e9),h=Math.asin(((P-y)/x*1e9>>0)/1e9),0>(l=v>p?Math.PI-l:l)&&(l=2*Math.PI+l),0>(h=v>w?Math.PI-h:h)&&(h=2*Math.PI+h),a&&l>h&&(l-=2*Math.PI),!a&&h>l&&(h-=2*Math.PI)}var A=h-l;if(Math.abs(A)>S){var T=h,C=w,G=P;O=b(w=v+g*Math.cos(h=l+S*(a&&h>l?1:-1)),P=y+x*Math.sin(h),g,x,o,0,a,C,G,[h,T,v,y])}A=h-l;var W=Math.cos(l),_=Math.sin(l),N=Math.cos(h),H=Math.sin(h),q=Math.tan(A/4),R=4/3*g*q,D=4/3*x*q,Y=[p,d],B=[p+R*_,d-D*W],U=[w+R*H,P-D*N],Q=[w,P];if(B[0]=2*Y[0]-B[0],B[1]=2*Y[1]-B[1],f)return B.concat(U,Q,O);for(var X=[],Z=0,$=(O=B.concat(U,Q,O)).length;$>Z;Z+=1)X[Z]=Z%2?m(O[Z-1],O[Z],M).y:m(O[Z],O[Z+1],M).x;return X}
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],r):r(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.CanvasPicker={}),t.window.G)}(this,(function(t,r){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}function o(t,r,e){return(r=n(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function i(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function a(t,r){for(var e=0;r.length>e;e++){var o=r[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function u(t,r,e){return r&&a(t.prototype,r),e&&a(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(f=function(){return!!t})()}function l(t,r){if(r&&("object"==e(r)||"function"==typeof r))return r;if(void 0!==r)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 s(t,r){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},s(t,r)}function h(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);r>e;e++)n[e]=t[e];return n}function v(t,r){if(t){if("string"==typeof t)return h(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?h(t,r):void 0}}function y(){y=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function s(t,r,e,n){var o=Object.create((r&&r.prototype instanceof b?r:b).prototype),a=new F(n||[]);return i(o,"_invoke",{value:j(t,e,a)}),o}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=s;var v="suspendedStart",p="suspendedYield",d="executing",g="completed",m={};function b(){}function w(){}function x(){}var P={};l(P,u,(function(){return this}));var O=Object.getPrototypeOf,S=O&&O(O(T([])));S&&S!==n&&o.call(S,u)&&(P=S);var M=x.prototype=b.prototype=Object.create(P);function E(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function k(t,r){function n(i,a,u,c){var f=h(t[i],t,a);if("throw"!==f.type){var l=f.arg,s=l.value;return s&&"object"==e(s)&&o.call(s,"__await")?r.resolve(s.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):r.resolve(s).then((function(t){l.value=t,u(l)}),(function(t){return n("throw",t,u,c)}))}c(f.arg)}var a;i(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,o){n(t,e,r,o)}))}return a=a?a.then(o,o):o()}})}function j(r,e,n){var o=v;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=L(u,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var f=h(r,e,n);if("normal"===f.type){if(o=n.done?g:p,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(o=g,n.method="throw",n.arg=f.arg)}}}function L(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,L(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=h(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,m;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,m):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function A(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function I(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function T(r){if(r||""===r){var n=r[u];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var i=-1,a=function e(){for(;++i<r.length;)if(o.call(r,i))return e.value=r[i],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(e(r)+" is not iterable")}return w.prototype=x,i(M,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=l(x,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===w||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,l(t,f,"GeneratorFunction")),t.prototype=Object.create(M),t},r.awrap=function(t){return{__await:t}},E(k.prototype),l(k.prototype,c,(function(){return this})),r.AsyncIterator=k,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new k(s(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(M),l(M,f,"Generator"),l(M,u,(function(){return this})),l(M,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,F.prototype={constructor:F,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return u.type="throw",u.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(this.prev>=a.tryLoc){var c=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(c&&f){if(a.catchLoc>this.prev)return n(a.catchLoc,!0);if(a.finallyLoc>this.prev)return n(a.finallyLoc)}else if(c){if(a.catchLoc>this.prev)return n(a.catchLoc,!0)}else{if(!f)throw Error("try statement without catch or finally");if(a.finallyLoc>this.prev)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(this.prev>=n.tryLoc&&o.call(n,"finallyLoc")&&n.finallyLoc>this.prev){var i=n;break}}i&&("break"===t||"continue"===t)&&r>=i.tryLoc&&i.finallyLoc>=r&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),m},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),I(e),m}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;I(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:T(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function p(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}var d="undefined"!=typeof Float32Array?Float32Array:Array;function g(){var t=new d(3);return d!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function m(t,r,e,n){return t[0]=r,t[1]=e,t[2]=n,t}Math.hypot||(Math.hypot=function(){for(var t=0,r=arguments.length;r--;)t+=arguments[r]*arguments[r];return Math.sqrt(t)}),g(),function(){var t,r=(t=new d(2),d!=Float32Array&&(t[0]=0,t[1]=0),t)}();var b,w=g(),x=g(),P=g(),O=(b=new d(16),d!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[4]=0,b[6]=0,b[7]=0,b[8]=0,b[9]=0,b[11]=0,b[12]=0,b[13]=0,b[14]=0),b[0]=1,b[5]=1,b[10]=1,b[15]=1,b),S=function(){function t(){var e=this;i(this,t),this.isHit=function(t,n,o,i){var a=e.context.pointInPathPickerFactory[t.nodeName];if(a){var u=function(t,r){var e=r[0],n=r[1],o=r[2],i=r[3],a=r[4],u=r[5],c=r[6],f=r[7],l=r[8],s=r[9],h=r[10],v=r[11],y=r[12],p=r[13],d=r[14],g=r[15],m=e*u-n*a,b=e*c-o*a,w=e*f-i*a,x=n*c-o*u,P=n*f-i*u,O=o*f-i*c,S=l*p-s*y,M=l*d-h*y,E=l*g-v*y,k=s*d-h*p,j=s*g-v*p,L=h*g-v*d,A=m*L-b*j+w*k+x*E-P*M+O*S;return A?(t[0]=(u*L-c*j+f*k)*(A=1/A),t[1]=(o*j-n*L-i*k)*A,t[2]=(p*O-d*P+g*x)*A,t[3]=(h*P-s*O-v*x)*A,t[4]=(c*E-a*L-f*M)*A,t[5]=(e*L-o*E+i*M)*A,t[6]=(d*w-y*O-g*b)*A,t[7]=(l*O-h*w+v*b)*A,t[8]=(a*j-u*E+f*S)*A,t[9]=(n*E-e*j-i*S)*A,t[10]=(y*P-p*w+g*m)*A,t[11]=(s*w-l*P-v*m)*A,t[12]=(u*M-a*k-c*S)*A,t[13]=(e*k-n*M+o*S)*A,t[14]=(p*b-y*x-d*m)*A,t[15]=(l*x-s*b+h*m)*A,t):null}(O,o),c=function(t,r,e){var n=r[0],o=r[1],i=r[2],a=e[3]*n+e[7]*o+e[11]*i+e[15];return t[0]=(e[0]*n+e[4]*o+e[8]*i+e[12])/(a=a||1),t[1]=(e[1]*n+e[5]*o+e[9]*i+e[13])/a,t[2]=(e[2]*n+e[6]*o+e[10]*i+e[14])/a,t}(x,m(P,n[0],n[1],0),u);if(a(t,new r.Point(c[0],c[1]),i,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(t,r){var n=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),o=e.context.pathGeneratorFactory[t.nodeName];return o&&(n.beginPath(),o(n,t.parsedStyle),n.closePath()),n.isPointInPath(r.x,r.y)}}return u(t,[{key:"apply",value:function(r,e){var n,o=this,i=r.renderingService,a=r.renderingContext;this.context=r,this.runtime=e;var u=null===(n=a.root)||void 0===n?void 0:n.ownerDocument;i.hooks.pick.tapPromise(t.tag,function(){var t,r=(t=y().mark((function t(r){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",o.pick(u,r));case 1:case"end":return t.stop()}}),t)})),function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function a(t){p(i,n,o,a,u,"next",t)}function u(t){p(i,n,o,a,u,"throw",t)}a(void 0)}))});return function(t){return r.apply(this,arguments)}}()),i.hooks.pickSync.tap(t.tag,(function(t){return o.pick(u,t)}))}},{key:"pick",value:function(t,e){var n,o=e.topmost,i=e.position,a=m(w,i.x,i.y,0),u=[],c=function(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=v(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return t.length>n?{done:!1,value:t[n++]}:{done:!0}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(u)throw i}}}}(t.elementsFromBBox(a[0],a[1],a[0],a[1]));try{for(c.s();!(n=c.n()).done;){var f=n.value,l=f.getWorldTransform();if(this.isHit(f,a,l,!1)){var s=r.findClosestClipPathTarget(f);if(s){var h=s.parsedStyle.clipPath;if(this.isHit(h,a,h.getWorldTransform(),!0)){if(o)return e.picked=[f],e;u.push(f)}}else{if(o)return e.picked=[f],e;u.push(f)}}}}catch(t){c.e(t)}finally{c.f()}return e.picked=u,e}}])}();function M(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],c=!0,f=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(t,r)||v(t,r)||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 E(t){return function(t){if(Array.isArray(t))return h(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||v(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}S.tag="CanvasPicker";var k=function(t,r,e){return r>t?r:t>e?e:t};function j(t,r,e){return{x:t*Math.cos(e)-r*Math.sin(e),y:t*Math.sin(e)+r*Math.cos(e)}}function L(t,r,e,n,o,i,a,u,c,f){var l,s,h,v,y,p=t,d=r,g=e,m=n,b=u,w=c,x=120*Math.PI/180,P=Math.PI/180*(+o||0),O=[];if(f)s=f[0],h=f[1],v=f[2],y=f[3];else{d=(l=j(p,d,-P)).y;var S=((p=l.x)-(b=(l=j(b,w,-P)).x))/2,M=(d-(w=l.y))/2,E=S*S/(g*g)+M*M/(m*m);E>1&&(g*=E=Math.sqrt(E),m*=E);var k=g*g,A=m*m,I=(i===a?-1:1)*Math.sqrt(Math.abs((k*A-k*M*M-A*S*S)/(k*M*M+A*S*S)));v=I*g*M/m+(p+b)/2,s=Math.asin(((d-(y=I*-m*S/g+(d+w)/2))/m*1e9>>0)/1e9),h=Math.asin(((w-y)/m*1e9>>0)/1e9),0>(s=v>p?Math.PI-s:s)&&(s=2*Math.PI+s),0>(h=v>b?Math.PI-h:h)&&(h=2*Math.PI+h),a&&s>h&&(s-=2*Math.PI),!a&&h>s&&(h-=2*Math.PI)}var F=h-s;if(Math.abs(F)>x){var T=h,C=b,_=w;O=L(b=v+g*Math.cos(h=s+x*(a&&h>s?1:-1)),w=y+m*Math.sin(h),g,m,o,0,a,C,_,[h,T,v,y])}F=h-s;var G=Math.cos(s),W=Math.sin(s),N=Math.cos(h),H=Math.sin(h),R=Math.tan(F/4),q=4/3*g*R,D=4/3*m*R,B=[p,d],Y=[p+q*W,d-D*G],U=[b+q*H,w-D*N],Q=[b,w];if(Y[0]=2*B[0]-Y[0],Y[1]=2*B[1]-Y[1],f)return Y.concat(U,Q,O);for(var X=[],Z=0,$=(O=Y.concat(U,Q,O)).length;$>Z;Z+=1)X[Z]=Z%2?j(O[Z-1],O[Z],P).y:j(O[Z],O[Z+1],P).x;return X}
/*!

@@ -14,6 +14,6 @@ * @antv/g-math

* @version 3.0.0
* @date 10/23/2024, 7:12:37 AM
* @date 10/23/2024, 11:13:25 AM
* @author AntVis
* @docs https://g.antv.antgroup.com/
*/function x(t,r,e,n){var o=t-e,i=r-n;return Math.sqrt(o*o+i*i)}var w=1e-4;function P(t,r,e,n,o,i){var a=-1,c=1/0,u=[e,n],f=20;i&&i>200&&(f=i/10);for(var s=1/f,l=s/10,h=0;f>=h;h++){var v=h*s,y=[o(...t.concat([v])),o(...r.concat([v]))],p=x(u[0],u[1],y[0],y[1]);c>p&&(a=v,c=p)}if(0===a)return{x:t[0],y:r[0]};if(1===a){var d=t.length;return{x:t[d-1],y:r[d-1]}}c=1/0;for(var g=0;32>g&&w<=l;g++){var m=a-l,b=a+l,P=[o(...t.concat([m])),o(...r.concat([m]))],S=x(u[0],u[1],P[0],P[1]);if(m>=0&&c>S)a=m,c=S;else{var M=[o(...t.concat([b])),o(...r.concat([b]))],O=x(u[0],u[1],M[0],M[1]);1>=b&&c>O?(a=b,c=O):l*=.5}}return{x:o(...t.concat([a])),y:o(...r.concat([a]))}}function S(t,r,e,n,o,i){var a=[e-t,n-r];if(function(t,r){return t[0]===r[0]&&t[1]===r[1]}(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-r)*(i-r));var c=[-a[1],a[0]];return function(t,r){var e=r[0],n=r[1],o=e*e+n*n;o>0&&(o=1/Math.sqrt(o)),t[0]=r[0]*o,t[1]=r[1]*o}(c,c),Math.abs(function(t,r){return t[0]*r[0]+t[1]*r[1]}([o-t,i-r],c))}function M(t,r,e,n,o){var i=1-o;return i*i*i*t+3*r*o*i*i+3*e*o*o*i+n*o*o*o}function O(t,r,e,n,o,i,a,c,u,f,s){var l=function(t,r,e,n,o,i,a,c,u,f,s){return P([t,e,o,a],[r,n,i,c],u,f,M,s)}(t,r,e,n,o,i,a,c,u,f,s);return x(l.x,l.y,u,f)}function E(t,r,e,n){var o=1-n;return o*o*t+2*n*o*r+n*n*e}function L(t,r,e,n,o,i,a,c){var u=function(t,r,e,n,o,i,a,c){return P([t,e,o],[r,n,i],a,c,E)}(t,r,e,n,o,i,a,c);return x(u.x,u.y,a,c)}function k(t,e,n){var o=t.parsedStyle,i=o.cx,a=o.cy,c=o.r,u=o.fill,f=o.stroke,s=o.lineWidth,l=o.increasedLineWidthForHitTesting,h=o.pointerEvents,v=void 0===h?"auto":h,y=((void 0===s?1:s)+(void 0===l?0:l))/2,p=x(void 0===i?0:i,void 0===a?0:a,e.x,e.y),g=d(r.isFillOrStrokeAffected(v,u,f),2),m=g[0],b=g[1];return m&&b||n?c+y>=p:m?c>=p:!!b&&(p>=c-y&&c+y>=p)}function j(t,r,e,n){return t/(e*e)+r/(n*n)}function F(t,e,n){var o=t.parsedStyle,i=o.cx,a=void 0===i?0:i,c=o.cy,u=void 0===c?0:c,f=o.rx,s=o.ry,l=o.lineWidth,h=void 0===l?1:l,v=o.increasedLineWidthForHitTesting,y=void 0===v?0:v,p=o.pointerEvents,g=e.x,m=e.y,b=d(r.isFillOrStrokeAffected(void 0===p?"auto":p,o.fill,o.stroke),2),x=b[0],w=b[1],P=(h+y)/2,S=(g-a)*(g-a),M=(m-u)*(m-u);return x&&w||n?1>=j(S,M,f+P,s+P):x?1>=j(S,M,f,s):!!w&&(j(S,M,f-P,s-P)>=1&&1>=j(S,M,f+P,s+P))}function I(t,r,e,n,o,i){return!(t>o||o>t+e||r>i||i>r+n)}function A(t,r,e,n,o,i,a,c){var u=(Math.atan2(c-r,a-t)+2*Math.PI)%(2*Math.PI),f={x:t+e*Math.cos(u),y:r+e*Math.sin(u)};return x(f.x,f.y,a,c)<=i/2}function T(t,r,e,n,o,i,a){var c=o/2;return!(Math.min(t,e)-c>i||i>Math.max(t,e)+c||Math.min(r,n)-c>a||a>Math.max(r,n)+c)&&S(t,r,e,n,i,a)<=o/2}function C(t,r,e,n,o){var i=t.length;if(2>i)return!1;for(var a=0;i-1>a;a++){if(T(t[a][0],t[a][1],t[a+1][0],t[a+1][1],r,e,n))return!0}if(o){var c=t[0],u=t[i-1];if(T(c[0],c[1],u[0],u[1],r,e,n))return!0}return!1}var G=1e-6;function W(t){return G>Math.abs(t)?0:0>t?-1:1}function _(t,r,e){return!((e[0]-t[0])*(r[1]-t[1])!=(r[0]-t[0])*(e[1]-t[1])||Math.min(t[0],r[0])>e[0]||e[0]>Math.max(t[0],r[0])||Math.min(t[1],r[1])>e[1]||e[1]>Math.max(t[1],r[1]))}function N(t,r,e){var n=!1,o=t.length;if(2>=o)return!1;for(var i=0;o>i;i++){var a=t[i],c=t[(i+1)%o];if(_(a,c,[r,e]))return!0;W(a[1]-e)>0!=W(c[1]-e)>0&&0>W(r-(e-a[1])*(a[0]-c[0])/(a[1]-c[1])-a[0])&&(n=!n)}return n}function H(t,r,e){for(var n=!1,o=0;t.length>o;o++){if(n=N(t[o],r,e))break}return n}function q(t,e,n){var o=t.parsedStyle,i=o.x1,a=o.y1,c=o.x2,u=o.y2,f=o.lineWidth,s=void 0===f?1:f,l=o.increasedLineWidthForHitTesting,h=void 0===l?0:l,v=o.pointerEvents;return!(!d(r.isFillOrStrokeAffected(void 0===v?"auto":v,o.fill,o.stroke),2)[1]&&!n||!s)&&T(i,a,c,u,s+h,e.x,e.y)}function R(t,e,n,o,i,a){var c=t.parsedStyle,u=c.lineWidth,f=void 0===u?1:u,s=c.increasedLineWidthForHitTesting,l=void 0===s?0:s,h=c.d,v=c.pointerEvents,y=h.segments,p=h.hasArc,g=h.polylines,m=h.polygons,x=d(r.isFillOrStrokeAffected(void 0===v?"auto":v,(null==m?void 0:m.length)&&c.fill,c.stroke),2),w=x[0],P=x[1],S=r.getOrCalculatePathTotalLength(t),M=!1;return w||n?M=p?o(t,e):H(m,e.x,e.y)||H(g,e.x,e.y):((P||n)&&(M=function(t,r,e,n,o){for(var i=!1,a=r/2,c=0;t.length>c;c++){var u=t[c],f=u.currentPoint,s=u.params,l=u.prePoint,h=u.box;if(!h||I(h.x-a,h.y-a,h.width+r,h.height+r,e,n))switch(u.command){case"L":case"Z":if(i=T(l[0],l[1],f[0],f[1],r,e,n))return!0;break;case"Q":if(i=r/2>=L(l[0],l[1],s[1],s[2],s[3],s[4],e,n))return!0;break;case"C":if(i=r/2>=O(l[0],l[1],s[1],s[2],s[3],s[4],s[5],s[6],e,n,o))return!0;break;case"A":u.cubicParams||(u.cubicParams=b(l[0],l[1],s[1],s[2],s[3],s[4],s[5],s[6],s[7],void 0));for(var v=u.cubicParams,y=l,p=0;v.length>p;p+=6){var d=O(y[0],y[1],v[p],v[p+1],v[p+2],v[p+3],v[p+4],v[p+5],e,n,o);if(y=[v[p+4],v[p+5]],i=r/2>=d)return!0}}}return i}(y,f+l,e.x,e.y,S)),M)}function D(t,e,n){var o=t.parsedStyle,i=o.lineWidth,a=void 0===i?1:i,c=o.increasedLineWidthForHitTesting,u=void 0===c?0:c,f=o.points,s=o.pointerEvents,l=d(r.isFillOrStrokeAffected(void 0===s?"auto":s,o.fill,o.stroke),2),h=l[0],v=!1;return(l[1]||n)&&(v=C(f.points,a+u,e.x,e.y,!0)),v||!h&&!n||(v=N(f.points,e.x,e.y)),v}function Y(t,e,n){var o=t.parsedStyle,i=o.lineWidth,a=void 0===i?1:i,c=o.increasedLineWidthForHitTesting,u=void 0===c?0:c,f=o.points,s=o.pointerEvents;return!(!d(r.isFillOrStrokeAffected(void 0===s?"auto":s,o.fill,o.stroke),2)[1]&&!n||!a)&&C(f.points,a+u,e.x,e.y,!1)}function B(t,e,n,o,i){var a=t.parsedStyle,c=a.radius,u=a.lineWidth,f=void 0===u?1:u,s=a.increasedLineWidthForHitTesting,l=void 0===s?0:s,h=a.x,v=void 0===h?0:h,y=a.y,p=void 0===y?0:y,m=a.width,b=a.height,x=a.pointerEvents,w=d(r.isFillOrStrokeAffected(void 0===x?"auto":x,a.fill,a.stroke),2),P=w[0],S=w[1],M=f+l;if(c&&c.some((t=>0!==t))){var O=!1;return(S||n)&&(O=function(t,r,e,n,o,i,a,c){var u=d(o,4),f=u[0],s=u[1],l=u[2],h=u[3];return T(t+f,r,t+e-s,r,i,a,c)||T(t+e,r+s,t+e,r+n-l,i,a,c)||T(t+e-l,r+n,t+h,r+n,i,a,c)||T(t,r+n-h,t,r+f,i,a,c)||A(t+e-s,r+s,s,0,0,i,a,c)||A(t+e-l,r+n-l,l,0,0,i,a,c)||A(t+h,r+n-h,h,0,0,i,a,c)||A(t+f,r+f,f,0,0,i,a,c)}(v,p,m,b,c.map((t=>g(t,0,Math.min(Math.abs(m)/2,Math.abs(b)/2)))),M,e.x,e.y)),O||!P&&!n||(O=o(t,e)),O}var E=M/2;return P&&S||n?I(v-E,p-E,m+E,b+E,e.x,e.y):P?I(v,p,m,b,e.x,e.y):!!S&&function(t,r,e,n,o,i,a){var c=o/2;return I(t-c,r-c,e,o,i,a)||I(t+e-c,r-c,o,n,i,a)||I(t+c,r+n-c,e,o,i,a)||I(t-c,r+c,o,n,i,a)}(v,p,m,b,M,e.x,e.y)}function U(t){var r=function(t,r){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==o(r)?r:r+""}function Q(t,r,e){return(r=U(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function X(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function Z(t){for(var r=1;arguments.length>r;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?X(Object(e),!0).forEach((function(r){Q(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):X(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function $(t,e,n,o,i,a){var c=t.parsedStyle,u=c.pointerEvents,f=c.x,s=void 0===f?0:f,l=c.y,h=void 0===l?0:l,v=c.width,y=c.height;if("non-transparent-pixel"===(void 0===u?"auto":u)){var p=i.config.offscreenCanvas,d=a.offscreenCanvasCreator.getOrCreateCanvas(p),g=a.offscreenCanvasCreator.getOrCreateContext(p,{willReadFrequently:!0});return d.width=v,d.height=y,i.defaultStyleRendererFactory[r.Shape.IMAGE].render(g,Z(Z({},t.parsedStyle),{},{x:0,y:0}),t,void 0,void 0,void 0),g.getImageData(e.x-s,e.y-h,1,1).data.every((t=>0!==t))}return!0}function z(t,r,e,n){var o=t.getGeometryBounds();return!(o.min[0]>r.x||o.min[1]>r.y||r.x>o.max[0]||r.y>o.max[1])}t.Plugin=class extends r.AbstractRendererPlugin{constructor(){super(...arguments),this.name="canvas-picker"}init(){this.context.pointInPathPickerFactory={[r.Shape.CIRCLE]:k,[r.Shape.ELLIPSE]:F,[r.Shape.RECT]:B,[r.Shape.LINE]:q,[r.Shape.POLYLINE]:Y,[r.Shape.POLYGON]:D,[r.Shape.PATH]:R,[r.Shape.TEXT]:z,[r.Shape.GROUP]:null,[r.Shape.IMAGE]:$,[r.Shape.HTML]:null,[r.Shape.MESH]:null},this.addRenderingPlugin(new p)}destroy(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}}));
*/function A(t,r,e,n){var o=t-e,i=r-n;return Math.sqrt(o*o+i*i)}var I=1e-4;function F(t,r,e,n,o,i){var a=-1,u=1/0,c=[e,n],f=20;i&&i>200&&(f=i/10);for(var l=1/f,s=l/10,h=0;f>=h;h++){var v=h*l,y=[o.apply(void 0,E(t.concat([v]))),o.apply(void 0,E(r.concat([v])))],p=A(c[0],c[1],y[0],y[1]);u>p&&(a=v,u=p)}if(0===a)return{x:t[0],y:r[0]};if(1===a){var d=t.length;return{x:t[d-1],y:r[d-1]}}u=1/0;for(var g=0;32>g&&I<=s;g++){var m=a-s,b=a+s,w=[o.apply(void 0,E(t.concat([m]))),o.apply(void 0,E(r.concat([m])))],x=A(c[0],c[1],w[0],w[1]);if(m>=0&&u>x)a=m,u=x;else{var P=[o.apply(void 0,E(t.concat([b]))),o.apply(void 0,E(r.concat([b])))],O=A(c[0],c[1],P[0],P[1]);1>=b&&u>O?(a=b,u=O):s*=.5}}return{x:o.apply(void 0,E(t.concat([a]))),y:o.apply(void 0,E(r.concat([a])))}}function T(t,r,e,n,o,i){var a=[e-t,n-r];if(function(t,r){return t[0]===r[0]&&t[1]===r[1]}(a,[0,0]))return Math.sqrt((o-t)*(o-t)+(i-r)*(i-r));var u=[-a[1],a[0]];return function(t,r){var e=r[0],n=r[1],o=e*e+n*n;o>0&&(o=1/Math.sqrt(o)),t[0]=r[0]*o,t[1]=r[1]*o}(u,u),Math.abs(function(t,r){return t[0]*r[0]+t[1]*r[1]}([o-t,i-r],u))}function C(t,r,e,n,o){var i=1-o;return i*i*i*t+3*r*o*i*i+3*e*o*o*i+n*o*o*o}function _(t,r,e,n,o,i,a,u,c,f,l){var s=function(t,r,e,n,o,i,a,u,c,f,l){return F([t,e,o,a],[r,n,i,u],c,f,C,l)}(t,r,e,n,o,i,a,u,c,f,l);return A(s.x,s.y,c,f)}function G(t,r,e,n){var o=1-n;return o*o*t+2*n*o*r+n*n*e}function W(t,r,e,n,o,i,a,u){var c=function(t,r,e,n,o,i,a,u){return F([t,e,o],[r,n,i],a,u,G)}(t,r,e,n,o,i,a,u);return A(c.x,c.y,a,u)}function N(t,e,n){var o=t.parsedStyle,i=o.cx,a=o.cy,u=o.r,c=o.fill,f=o.stroke,l=o.lineWidth,s=o.increasedLineWidthForHitTesting,h=o.pointerEvents,v=void 0===h?"auto":h,y=((void 0===l?1:l)+(void 0===s?0:s))/2,p=A(void 0===i?0:i,void 0===a?0:a,e.x,e.y),d=M(r.isFillOrStrokeAffected(v,c,f),2),g=d[0],m=d[1];return g&&m||n?u+y>=p:g?u>=p:!!m&&(p>=u-y&&u+y>=p)}function H(t,r,e,n){return t/(e*e)+r/(n*n)}function R(t,e,n){var o=t.parsedStyle,i=o.cx,a=void 0===i?0:i,u=o.cy,c=void 0===u?0:u,f=o.rx,l=o.ry,s=o.lineWidth,h=void 0===s?1:s,v=o.increasedLineWidthForHitTesting,y=void 0===v?0:v,p=o.pointerEvents,d=e.x,g=e.y,m=M(r.isFillOrStrokeAffected(void 0===p?"auto":p,o.fill,o.stroke),2),b=m[0],w=m[1],x=(h+y)/2,P=(d-a)*(d-a),O=(g-c)*(g-c);return b&&w||n?1>=H(P,O,f+x,l+x):b?1>=H(P,O,f,l):!!w&&(H(P,O,f-x,l-x)>=1&&1>=H(P,O,f+x,l+x))}function q(t,r,e,n,o,i){return!(t>o||o>t+e||r>i||i>r+n)}function D(t,r,e,n,o,i,a,u){var c=(Math.atan2(u-r,a-t)+2*Math.PI)%(2*Math.PI),f={x:t+e*Math.cos(c),y:r+e*Math.sin(c)};return A(f.x,f.y,a,u)<=i/2}function B(t,r,e,n,o,i,a){var u=o/2;return!(Math.min(t,e)-u>i||i>Math.max(t,e)+u||Math.min(r,n)-u>a||a>Math.max(r,n)+u)&&T(t,r,e,n,i,a)<=o/2}function Y(t,r,e,n,o){var i=t.length;if(2>i)return!1;for(var a=0;i-1>a;a++){if(B(t[a][0],t[a][1],t[a+1][0],t[a+1][1],r,e,n))return!0}if(o){var u=t[0],c=t[i-1];if(B(u[0],u[1],c[0],c[1],r,e,n))return!0}return!1}var U=1e-6;function Q(t){return U>Math.abs(t)?0:0>t?-1:1}function X(t,r,e){return!((e[0]-t[0])*(r[1]-t[1])!=(r[0]-t[0])*(e[1]-t[1])||Math.min(t[0],r[0])>e[0]||e[0]>Math.max(t[0],r[0])||Math.min(t[1],r[1])>e[1]||e[1]>Math.max(t[1],r[1]))}function Z(t,r,e){var n=!1,o=t.length;if(2>=o)return!1;for(var i=0;o>i;i++){var a=t[i],u=t[(i+1)%o];if(X(a,u,[r,e]))return!0;Q(a[1]-e)>0!=Q(u[1]-e)>0&&0>Q(r-(e-a[1])*(a[0]-u[0])/(a[1]-u[1])-a[0])&&(n=!n)}return n}function $(t,r,e){for(var n=!1,o=0;t.length>o;o++){if(n=Z(t[o],r,e))break}return n}function z(t,e,n){var o=t.parsedStyle,i=o.x1,a=o.y1,u=o.x2,c=o.y2,f=o.lineWidth,l=void 0===f?1:f,s=o.increasedLineWidthForHitTesting,h=void 0===s?0:s,v=o.pointerEvents;return!(!M(r.isFillOrStrokeAffected(void 0===v?"auto":v,o.fill,o.stroke),2)[1]&&!n||!l)&&B(i,a,u,c,l+h,e.x,e.y)}function J(t,e,n,o,i,a){var u=t.parsedStyle,c=u.lineWidth,f=void 0===c?1:c,l=u.increasedLineWidthForHitTesting,s=void 0===l?0:l,h=u.d,v=u.pointerEvents,y=h.segments,p=h.hasArc,d=h.polylines,g=h.polygons,m=M(r.isFillOrStrokeAffected(void 0===v?"auto":v,(null==g?void 0:g.length)&&u.fill,u.stroke),2),b=m[0],w=m[1],x=r.getOrCalculatePathTotalLength(t),P=!1;return b||n?P=p?o(t,e):$(g,e.x,e.y)||$(d,e.x,e.y):((w||n)&&(P=function(t,r,e,n,o){for(var i=!1,a=r/2,u=0;t.length>u;u++){var c=t[u],f=c.currentPoint,l=c.params,s=c.prePoint,h=c.box;if(!h||q(h.x-a,h.y-a,h.width+r,h.height+r,e,n))switch(c.command){case"L":case"Z":if(i=B(s[0],s[1],f[0],f[1],r,e,n))return!0;break;case"Q":if(i=r/2>=W(s[0],s[1],l[1],l[2],l[3],l[4],e,n))return!0;break;case"C":if(i=r/2>=_(s[0],s[1],l[1],l[2],l[3],l[4],l[5],l[6],e,n,o))return!0;break;case"A":c.cubicParams||(c.cubicParams=L(s[0],s[1],l[1],l[2],l[3],l[4],l[5],l[6],l[7],void 0));for(var v=c.cubicParams,y=s,p=0;v.length>p;p+=6){var d=_(y[0],y[1],v[p],v[p+1],v[p+2],v[p+3],v[p+4],v[p+5],e,n,o);if(y=[v[p+4],v[p+5]],i=r/2>=d)return!0}}}return i}(y,f+s,e.x,e.y,x)),P)}function K(t,e,n){var o=t.parsedStyle,i=o.lineWidth,a=void 0===i?1:i,u=o.increasedLineWidthForHitTesting,c=void 0===u?0:u,f=o.points,l=o.pointerEvents,s=M(r.isFillOrStrokeAffected(void 0===l?"auto":l,o.fill,o.stroke),2),h=s[0],v=!1;return(s[1]||n)&&(v=Y(f.points,a+c,e.x,e.y,!0)),v||!h&&!n||(v=Z(f.points,e.x,e.y)),v}function V(t,e,n){var o=t.parsedStyle,i=o.lineWidth,a=void 0===i?1:i,u=o.increasedLineWidthForHitTesting,c=void 0===u?0:u,f=o.points,l=o.pointerEvents;return!(!M(r.isFillOrStrokeAffected(void 0===l?"auto":l,o.fill,o.stroke),2)[1]&&!n||!a)&&Y(f.points,a+c,e.x,e.y,!1)}function tt(t,e,n,o,i){var a=t.parsedStyle,u=a.radius,c=a.lineWidth,f=void 0===c?1:c,l=a.increasedLineWidthForHitTesting,s=void 0===l?0:l,h=a.x,v=void 0===h?0:h,y=a.y,p=void 0===y?0:y,d=a.width,g=a.height,m=a.pointerEvents,b=M(r.isFillOrStrokeAffected(void 0===m?"auto":m,a.fill,a.stroke),2),w=b[0],x=b[1],P=f+s;if(u&&u.some((function(t){return 0!==t}))){var O=!1;return(x||n)&&(O=function(t,r,e,n,o,i,a,u){var c=M(o,4),f=c[0],l=c[1],s=c[2],h=c[3];return B(t+f,r,t+e-l,r,i,a,u)||B(t+e,r+l,t+e,r+n-s,i,a,u)||B(t+e-s,r+n,t+h,r+n,i,a,u)||B(t,r+n-h,t,r+f,i,a,u)||D(t+e-l,r+l,l,0,0,i,a,u)||D(t+e-s,r+n-s,s,0,0,i,a,u)||D(t+h,r+n-h,h,0,0,i,a,u)||D(t+f,r+f,f,0,0,i,a,u)}(v,p,d,g,u.map((function(t){return k(t,0,Math.min(Math.abs(d)/2,Math.abs(g)/2))})),P,e.x,e.y)),O||!w&&!n||(O=o(t,e)),O}var S=P/2;return w&&x||n?q(v-S,p-S,d+S,g+S,e.x,e.y):w?q(v,p,d,g,e.x,e.y):!!x&&function(t,r,e,n,o,i,a){var u=o/2;return q(t-u,r-u,e,o,i,a)||q(t+e-u,r-u,o,n,i,a)||q(t+u,r+n-u,e,o,i,a)||q(t-u,r+u,o,n,i,a)}(v,p,d,g,P,e.x,e.y)}function rt(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function et(t){for(var r=1;arguments.length>r;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?rt(Object(e),!0).forEach((function(r){o(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):rt(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function nt(t,e,n,o,i,a){var u=t.parsedStyle,c=u.pointerEvents,f=u.x,l=void 0===f?0:f,s=u.y,h=void 0===s?0:s,v=u.width,y=u.height;if("non-transparent-pixel"===(void 0===c?"auto":c)){var p=i.config.offscreenCanvas,d=a.offscreenCanvasCreator.getOrCreateCanvas(p),g=a.offscreenCanvasCreator.getOrCreateContext(p,{willReadFrequently:!0});return d.width=v,d.height=y,i.defaultStyleRendererFactory[r.Shape.IMAGE].render(g,et(et({},t.parsedStyle),{},{x:0,y:0}),t,void 0,void 0,void 0),g.getImageData(e.x-l,e.y-h,1,1).data.every((function(t){return 0!==t}))}return!0}function ot(t,r,e,n){var o=t.getGeometryBounds();return!(o.min[0]>r.x||o.min[1]>r.y||r.x>o.max[0]||r.y>o.max[1])}var it=function(t){function e(){var t,r,n,o;i(this,e);for(var a=arguments.length,u=Array(a),s=0;a>s;s++)u[s]=arguments[s];return r=this,n=e,o=[].concat(u),n=c(n),(t=l(r,f()?Reflect.construct(n,o||[],c(r).constructor):n.apply(r,o))).name="canvas-picker",t}return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&s(t,r)}(e,t),u(e,[{key:"init",value:function(){var t,e=(o(o(o(o(o(o(o(o(o(o(t={},r.Shape.CIRCLE,N),r.Shape.ELLIPSE,R),r.Shape.RECT,tt),r.Shape.LINE,z),r.Shape.POLYLINE,V),r.Shape.POLYGON,K),r.Shape.PATH,J),r.Shape.TEXT,ot),r.Shape.GROUP,null),r.Shape.IMAGE,nt),o(o(t,r.Shape.HTML,null),r.Shape.MESH,null));this.context.pointInPathPickerFactory=e,this.addRenderingPlugin(new S)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(r.AbstractRendererPlugin);t.Plugin=it}));
//# sourceMappingURL=index.umd.min.js.map
{
"name": "@antv/g-plugin-canvas-picker",
"version": "2.0.14",
"version": "2.0.15",
"description": "A G plugin for picking in canvas",

@@ -40,6 +40,6 @@ "keywords": [

"tslib": "^2.5.3",
"@antv/g-lite": "2.1.1",
"@antv/g-lite": "2.1.2",
"@antv/g-math": "3.0.0",
"@antv/g-plugin-canvas-path-generator": "2.0.12",
"@antv/g-plugin-canvas-renderer": "2.1.1"
"@antv/g-plugin-canvas-path-generator": "2.0.13",
"@antv/g-plugin-canvas-renderer": "2.1.2"
},

@@ -46,0 +46,0 @@ "publishConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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