@antv/g-plugin-canvas-picker
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2
@@ -1140,3 +1140,3 @@ import { SceneGraphService, RenderingContext, DisplayObjectPool, OffscreenCanvasCreator, Camera, SHAPE, RenderingPluginContribution } from '@antv/g'; | ||
function nearestPoint(xArr, yArr, x, y, tCallback, length) { | ||
var t; | ||
var t = -1; | ||
var d = Infinity; | ||
@@ -1280,3 +1280,4 @@ var v0 = [x, y]; | ||
left.push(iterationCount - 1); | ||
right.push(iterationCount - 1); | ||
right.push(iterationCount - 1); // @ts-ignore | ||
return quadraticLength.apply(null, left) + quadraticLength.apply(null, right); | ||
@@ -1331,2 +1332,37 @@ } | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
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 _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function cubicAt(p0, p1, p2, p3, t) { | ||
@@ -1404,6 +1440,4 @@ var onet = 1 - t; // t * t * t 的性能大概是 Math.pow(t, 3) 的三倍 | ||
var cubics = divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, 0.5); | ||
var left = cubics[0]; | ||
var right = cubics[1]; | ||
left.push(iterationCount - 1); | ||
right.push(iterationCount - 1); | ||
var left = [].concat(_toConsumableArray(cubics[0]), [iterationCount - 1]); | ||
var right = [].concat(_toConsumableArray(cubics[1]), [iterationCount - 1]); | ||
return cubicLength.apply(null, left) + cubicLength.apply(null, right); | ||
@@ -1410,0 +1444,0 @@ } |
@@ -1144,3 +1144,3 @@ 'use strict'; | ||
function nearestPoint(xArr, yArr, x, y, tCallback, length) { | ||
var t; | ||
var t = -1; | ||
var d = Infinity; | ||
@@ -1284,3 +1284,4 @@ var v0 = [x, y]; | ||
left.push(iterationCount - 1); | ||
right.push(iterationCount - 1); | ||
right.push(iterationCount - 1); // @ts-ignore | ||
return quadraticLength.apply(null, left) + quadraticLength.apply(null, right); | ||
@@ -1335,2 +1336,37 @@ } | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
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 _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function cubicAt(p0, p1, p2, p3, t) { | ||
@@ -1408,6 +1444,4 @@ var onet = 1 - t; // t * t * t 的性能大概是 Math.pow(t, 3) 的三倍 | ||
var cubics = divideCubic(x1, y1, x2, y2, x3, y3, x4, y4, 0.5); | ||
var left = cubics[0]; | ||
var right = cubics[1]; | ||
left.push(iterationCount - 1); | ||
right.push(iterationCount - 1); | ||
var left = [].concat(_toConsumableArray(cubics[0]), [iterationCount - 1]); | ||
var right = [].concat(_toConsumableArray(cubics[1]), [iterationCount - 1]); | ||
return cubicLength.apply(null, left) + cubicLength.apply(null, right); | ||
@@ -1414,0 +1448,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@antv/g"),require("@antv/g-plugin-canvas-renderer")):"function"==typeof define&&define.amd?define(["exports","@antv/g","@antv/g-plugin-canvas-renderer"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).gPluginCanvasPicker={},t.g,t.gPluginCanvasRenderer)}(this,(function(t,n,r){"use strict";var e="inversify:paramtypes",a=0;var i=function(){function t(t,n){this.key=t,this.value=n}return t.prototype.toString=function(){return"named"===this.key?"named: "+this.value+" ":"tagged: { key:"+this.key+", value: "+this.value+" }"},t}();function o(t,n,r,e,a){var i={},o="number"==typeof a,u=void 0!==a&&o?""+a:r;if(o&&void 0!==r)throw Error("The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.");Reflect.hasOwnMetadata(t,n)&&(i=Reflect.getMetadata(t,n));var c=i[u];if(Array.isArray(c))for(var f=0,s=c;s.length>f;f++){var l=s[f];if(l.key===e.key)throw Error("Metadata key was used more than once in a parameter: "+l.key)}else c=[];c.push(e),i[u]=c,Reflect.defineMetadata(t,i,n)}function u(t){return function(n,r,e){if(void 0===t)throw Error("@inject called with undefined this could mean that the class "+n.name+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");var a=new i("inject",t);"number"==typeof e?function(t,n,r,e){o("inversify:tagged",t,n,e,r)}(n,r,e,a):function(t,n,r){o("inversify:tagged_props",t.constructor,n,r)}(n,r,a)}}var c=function(t){this.id=a++,this.registry=t};function f(t,n){for(var r=0;n.length>r;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}} | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@antv/g"),require("@antv/g-plugin-canvas-renderer")):"function"==typeof define&&define.amd?define(["exports","@antv/g","@antv/g-plugin-canvas-renderer"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).gPluginCanvasPicker={},t.g,t.gPluginCanvasRenderer)}(this,(function(t,n,r){"use strict";var e="inversify:paramtypes",a=0;var i=function(){function t(t,n){this.key=t,this.value=n}return t.prototype.toString=function(){return"named"===this.key?"named: "+this.value+" ":"tagged: { key:"+this.key+", value: "+this.value+" }"},t}();function o(t,n,r,e,a){var i={},o="number"==typeof a,u=void 0!==a&&o?""+a:r;if(o&&void 0!==r)throw Error("The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.");Reflect.hasOwnMetadata(t,n)&&(i=Reflect.getMetadata(t,n));var c=i[u];if(Array.isArray(c))for(var f=0,l=c;l.length>f;f++){var s=l[f];if(s.key===e.key)throw Error("Metadata key was used more than once in a parameter: "+s.key)}else c=[];c.push(e),i[u]=c,Reflect.defineMetadata(t,i,n)}function u(t){return function(n,r,e){if(void 0===t)throw Error("@inject called with undefined this could mean that the class "+n.name+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");var a=new i("inject",t);"number"==typeof e?function(t,n,r,e){o("inversify:tagged",t,n,e,r)}(n,r,e,a):function(t,n,r){o("inversify:tagged_props",t.constructor,n,r)}(n,r,a)}}var c=function(t){this.id=a++,this.registry=t};function f(t,n){for(var r=0;n.length>r;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}} | ||
/*! ***************************************************************************** | ||
@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
function s(t,n,r,e){var a,i=arguments.length,o=3>i?n:null===e?e=Object.getOwnPropertyDescriptor(n,r):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,n,r,e);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(o=(3>i?a(o):i>3?a(n,r,o):a(n,r))||o);return i>3&&o&&Object.defineProperty(n,r,o),o}function l(t,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)}var v="undefined"!=typeof Float32Array?Float32Array:Array;function h(){var t=new v(9);return v!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function y(t,n,r){var e=n[0],a=n[1],i=n[2],o=n[3],u=n[4],c=n[5],f=n[6],s=n[7],l=n[8],v=r[0],h=r[1],y=r[2],p=r[3],d=r[4],g=r[5],x=r[6],P=r[7],m=r[8];return t[0]=v*e+h*o+y*f,t[1]=v*a+h*u+y*s,t[2]=v*i+h*c+y*l,t[3]=p*e+d*o+g*f,t[4]=p*a+d*u+g*s,t[5]=p*i+d*c+g*l,t[6]=x*e+P*o+m*f,t[7]=x*a+P*u+m*s,t[8]=x*i+P*c+m*l,t}function p(t,n){var r=Math.sin(n),e=Math.cos(n);return t[0]=e,t[1]=r,t[2]=0,t[3]=-r,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function d(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=n[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function g(){var t=new v(16);return v!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function x(t,n){var r=n[0],e=n[1],a=n[2],i=n[3],o=n[4],u=n[5],c=n[6],f=n[7],s=n[8],l=n[9],v=n[10],h=n[11],y=n[12],p=n[13],d=n[14],g=n[15],x=r*u-e*o,P=r*c-a*o,m=r*f-i*o,M=e*c-a*u,b=e*f-i*u,A=a*f-i*c,k=s*p-l*y,w=s*d-v*y,C=s*g-h*y,S=l*d-v*p,I=l*g-h*p,j=v*g-h*d,F=x*j-P*I+m*S+M*C-b*w+A*k;return F?(t[0]=(u*j-c*I+f*S)*(F=1/F),t[1]=(a*I-e*j-i*S)*F,t[2]=(p*A-d*b+g*M)*F,t[3]=(v*b-l*A-h*M)*F,t[4]=(c*C-o*j-f*w)*F,t[5]=(r*j-a*C+i*w)*F,t[6]=(d*m-y*A-g*P)*F,t[7]=(s*A-v*m+h*P)*F,t[8]=(o*I-u*C+f*k)*F,t[9]=(e*C-r*I-i*k)*F,t[10]=(y*b-p*m+g*x)*F,t[11]=(l*m-s*b-h*x)*F,t[12]=(u*w-o*S-c*k)*F,t[13]=(r*S-e*w+a*k)*F,t[14]=(p*P-y*M-d*x)*F,t[15]=(s*M-l*P+v*x)*F,t):null}function P(){var t=new v(3);return v!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function m(t,n,r){var e=new v(3);return e[0]=t,e[1]=n,e[2]=r,e}function M(t,n,r){var e=n[0],a=n[1],i=n[2],o=r[3]*e+r[7]*a+r[11]*i+r[15];return t[0]=(r[0]*e+r[4]*a+r[8]*i+r[12])/(o=o||1),t[1]=(r[1]*e+r[5]*a+r[9]*i+r[13])/o,t[2]=(r[2]*e+r[6]*a+r[10]*i+r[14])/o,t}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});var b;b=P();function A(t,n){var r=new v(2);return r[0]=t,r[1]=n,r}function k(t,n,r){var e=n[0],a=n[1];return t[0]=r[0]*e+r[3]*a+r[6],t[1]=r[1]*e+r[4]*a+r[7],t}!function(){var t,n=(t=new v(2),v!=Float32Array&&(t[0]=0,t[1]=0),t)}();var w,C,S,I=Symbol("PointInPathPicker"),j=(C=w=function(){function t(){var n=this;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.camera=void 0,this.sceneGraphService=void 0,this.renderingContext=void 0,this.displayObjectPool=void 0,this.offscreenCanvas=void 0,this.pathGeneratorFactory=void 0,this.pointInPathPickerFactory=void 0,this.isPointInPath=function(t,r){var e=n.offscreenCanvas.getOrCreateContext(),a=n.pathGeneratorFactory(t.nodeType);return a&&a(e,t.attributes),e.isPointInPath(r.x,r.y)}}var n,r,e;return n=t,(r=[{key:"apply",value:function(t){var n=this;t.hooks.pick.tap(S.tag,(function(t){var r=t.position,e=m(r.x,r.y,0),a=x(g(),n.camera.getOrthoMatrix());M(e,e,a);var i=n.renderingContext.rBush.search({minX:e[0],minY:e[1],maxX:e[0],maxY:e[1]}),o=[];return i.forEach((function(t){var r=n.displayObjectPool.getByName(t.name),a=r.getConfig().capture;if(r.isVisible()&&a){var i=n.pointInPathPickerFactory(r.nodeType);if(i){var u=x(g(),r.getWorldTransform()),c=M(P(),m(e[0],e[1],0),u);i(r,{x:c[0],y:c[1]},n.isPointInPath)&&o.push(r)}else o.push(r)}})),o.sort(n.sceneGraphService.sort),{position:t.position,picked:o[o.length-1]}}))}}])&&f(n.prototype,r),e&&f(n,e),t}(),w.tag="CanvasPickerPlugin",S=C);s([u(n.Camera),l("design:type",n.Camera)],j.prototype,"camera",void 0),s([u(n.SceneGraphService),l("design:type",n.SceneGraphService)],j.prototype,"sceneGraphService",void 0),s([u(n.RenderingContext),l("design:type",Object)],j.prototype,"renderingContext",void 0),s([u(n.DisplayObjectPool),l("design:type",n.DisplayObjectPool)],j.prototype,"displayObjectPool",void 0),s([u(n.OffscreenCanvasCreator),l("design:type",n.OffscreenCanvasCreator)],j.prototype,"offscreenCanvas",void 0),s([u(r.PathGeneratorFactory),l("design:type",Function)],j.prototype,"pathGeneratorFactory",void 0),s([u(I),l("design:type",Function)],j.prototype,"pointInPathPickerFactory",void 0),j=S=s([function(t){if(Reflect.hasOwnMetadata(e,t))throw Error("Cannot apply @injectable decorator multiple times.");var n=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(e,n,t),t}],j);var F={}.toString,O=function(t){return Array.isArray?Array.isArray(t):function(t,n){return F.call(t)==="[object "+n+"]"}(t,"Array")},R=function(t){if(O(t))return t.reduce((function(t,n){return Math.max(t,n)}),t[0])},E=function(t){if(O(t))return t.reduce((function(t,n){return Math.min(t,n)}),t[0])};function q(t,n,r,e){var a=t-r,i=n-e;return Math.sqrt(a*a+i*i)}function G(t,n){return.001>Math.abs(t-n)}function W(t,n){var r=E(t),e=E(n);return{x:r,y:e,width:R(t)-r,height:R(n)-e}}function D(t){return(t+2*Math.PI)%(2*Math.PI)}var H="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});!function(){var t,n=(t=new H(2),H!=Float32Array&&(t[0]=0,t[1]=0),t)}();var T=function(t,n,r,e,a){return{x:(1-a)*t+a*r,y:(1-a)*n+a*e}},L=function(t,n,r,e,a,i){var o=[r-t,e-n];if(function(t,n){return t[0]===n[0]&&t[1]===n[1]}(o,[0,0]))return Math.sqrt((a-t)*(a-t)+(i-n)*(i-n));var u=[-o[1],o[0]];return function(t,n){var r=n[0],e=n[1],a=r*r+e*e;a>0&&(a=1/Math.sqrt(a)),t[0]=n[0]*a,t[1]=n[1]*a}(u,u),Math.abs(function(t,n){return t[0]*n[0]+t[1]*n[1]}([a-t,i-n],u))};function Y(t,n,r,e,a,i){var o,u=1/0,c=[r,e],f=20;i&&i>200&&(f=i/10);for(var s=1/f,l=s/10,v=0;f>=v;v++){var h=v*s,y=[a.apply(null,t.concat([h])),a.apply(null,n.concat([h]))],p=q(c[0],c[1],y[0],y[1]);u>p&&(o=h,u=p)}if(0===o)return{x:t[0],y:n[0]};if(1===o){var d=t.length;return{x:t[d-1],y:n[d-1]}}u=1/0;for(var g=0;32>g&&1e-4<=l;g++){var x=o-l,P=o+l,m=[a.apply(null,t.concat([x])),a.apply(null,n.concat([x]))],M=q(c[0],c[1],m[0],m[1]);if(x>=0&&u>M)o=x,u=M;else{var b=[a.apply(null,t.concat([P])),a.apply(null,n.concat([P]))],A=q(c[0],c[1],b[0],b[1]);1>=P&&u>A?(o=P,u=A):l*=.5}}return{x:a.apply(null,t.concat([o])),y:a.apply(null,n.concat([o]))}}function _(t,n,r,e){var a=1-e;return a*a*t+2*e*a*n+e*e*r}function B(t,n,r){var e=t+r-2*n;if(G(e,0))return[.5];var a=(t-n)/e;return a>1||0>a?[]:[a]}function X(t,n,r,e){return 2*(1-e)*(n-t)+2*e*(r-n)}function z(t,n,r,e,a,i,o){var u=_(t,r,a,o),c=_(n,e,i,o),f=T(t,n,r,e,o),s=T(r,e,a,i,o);return[[t,n,f.x,f.y,u,c],[u,c,s.x,s.y,a,i]]}function N(t,n,r,e,a,i,o){if(0===o)return(q(t,n,r,e)+q(r,e,a,i)+q(t,n,a,i))/2;var u=z(t,n,r,e,a,i,.5),c=u[0],f=u[1];return c.push(o-1),f.push(o-1),N.apply(null,c)+N.apply(null,f)}var Q={box:function(t,n,r,e,a,i){var o=B(t,r,a)[0],u=B(n,e,i)[0],c=[t,a],f=[n,i];return void 0!==o&&c.push(_(t,r,a,o)),void 0!==u&&f.push(_(n,e,i,u)),W(c,f)},length:function(t,n,r,e,a,i){return N(t,n,r,e,a,i,3)},nearestPoint:function(t,n,r,e,a,i,o,u){return Y([t,r,a],[n,e,i],o,u,_)},pointDistance:function(t,n,r,e,a,i,o,u){var c=this.nearestPoint(t,n,r,e,a,i,o,u);return q(c.x,c.y,o,u)},interpolationAt:_,pointAt:function(t,n,r,e,a,i,o){return{x:_(t,r,a,o),y:_(n,e,i,o)}},divide:function(t,n,r,e,a,i,o){return z(t,n,r,e,a,i,o)},tangentAngle:function(t,n,r,e,a,i,o){var u=X(t,r,a,o),c=X(n,e,i,o);return D(Math.atan2(c,u))}};function V(t,n,r,e,a){var i=1-a;return i*i*i*t+3*n*a*i*i+3*r*a*a*i+e*a*a*a}function Z(t,n,r,e,a){var i=1-a;return 3*(i*i*(n-t)+2*i*a*(r-n)+a*a*(e-r))}function J(t,n,r,e){var a,i,o,u=-3*t+9*n-9*r+3*e,c=6*t-12*n+6*r,f=3*n-3*t,s=[];if(G(u,0))G(c,0)||0>(a=-f/c)||a>1||s.push(a);else{var l=c*c-4*u*f;G(l,0)?s.push(-c/(2*u)):l>0&&(i=(-c-(o=Math.sqrt(l)))/(2*u),0>(a=(-c+o)/(2*u))||a>1||s.push(a),0>i||i>1||s.push(i))}return s}function K(t,n,r,e,a,i,o,u,c){var f=V(t,r,a,o,c),s=V(n,e,i,u,c),l=T(t,n,r,e,c),v=T(r,e,a,i,c),h=T(a,i,o,u,c),y=T(l.x,l.y,v.x,v.y,c),p=T(v.x,v.y,h.x,h.y,c);return[[t,n,l.x,l.y,y.x,y.y,f,s],[f,s,p.x,p.y,h.x,h.y,o,u]]}function U(t,n,r,e,a,i,o,u,c){if(0===c)return function(t,n){for(var r=0,e=t.length,a=0;e>a;a++)r+=q(t[a],n[a],t[(a+1)%e],n[(a+1)%e]);return r/2}([t,r,a,o],[n,e,i,u]);var f=K(t,n,r,e,a,i,o,u,.5),s=f[0],l=f[1];return s.push(c-1),l.push(c-1),U.apply(null,s)+U.apply(null,l)}var $={extrema:J,box:function(t,n,r,e,a,i,o,u){for(var c=[t,o],f=[n,u],s=J(t,r,a,o),l=J(n,e,i,u),v=0;s.length>v;v++)c.push(V(t,r,a,o,s[v]));for(var h=0;l.length>h;h++)f.push(V(n,e,i,u,l[h]));return W(c,f)},length:function(t,n,r,e,a,i,o,u){return U(t,n,r,e,a,i,o,u,3)},nearestPoint:function(t,n,r,e,a,i,o,u,c,f,s){return Y([t,r,a,o],[n,e,i,u],c,f,V,s)},pointDistance:function(t,n,r,e,a,i,o,u,c,f,s){var l=this.nearestPoint(t,n,r,e,a,i,o,u,c,f,s);return q(l.x,l.y,c,f)},interpolationAt:V,pointAt:function(t,n,r,e,a,i,o,u,c){return{x:V(t,r,a,o,c),y:V(n,e,i,u,c)}},divide:function(t,n,r,e,a,i,o,u,c){return K(t,n,r,e,a,i,o,u,c)},tangentAngle:function(t,n,r,e,a,i,o,u,c){var f=Z(t,r,a,o,c),s=Z(n,e,i,u,c);return D(Math.atan2(s,f))}};function tt(t,n,r,e){var a=t-r,i=n-e;return Math.sqrt(a*a+i*i)}function nt(t,n,r,e,a,i){return!(t>a||a>t+r||n>i||i>n+e)}function rt(t,n,r,e,a,i,o,u){var c=(Math.atan2(u-n,o-t)+2*Math.PI)%(2*Math.PI);if(e>c||c>a)return!1;var f={x:t+r*Math.cos(c),y:n+r*Math.sin(c)};return tt(f.x,f.y,o,u)<=i/2}function et(t,n,r,e,a,i,o){var u=a/2;return!(Math.min(t,r)-u>i||i>Math.max(t,r)+u||Math.min(n,e)-u>o||o>Math.max(n,e)+u)&&L(t,n,r,e,i,o)<=a/2}function at(t,n,r,e,a){var i=t.length;if(2>i)return!1;for(var o=0;i-1>o;o++){if(et(t[o][0],t[o][1],t[o+1][0],t[o+1][1],n,r,e))return!0}if(a){var u=t[0],c=t[i-1];if(et(u[0],u[1],c[0],c[1],n,r,e))return!0}return!1}function it(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function ot(t,n,r){return!((r[0]-t[0])*(n[1]-t[1])!=(n[0]-t[0])*(r[1]-t[1])||Math.min(t[0],n[0])>r[0]||r[0]>Math.max(t[0],n[0])||Math.min(t[1],n[1])>r[1]||r[1]>Math.max(t[1],n[1]))}function ut(t,n,r){var e=!1,a=t.length;if(2>=a)return!1;for(var i=0;a>i;i++){var o=t[i],u=t[(i+1)%a];if(ot(o,u,[n,r]))return!0;it(o[1]-r)>0!=it(u[1]-r)>0&&0>it(n-(r-o[1])*(o[0]-u[0])/(o[1]-u[1])-o[0])&&(e=!e)}return e}function ct(t,n,r){for(var e=!1,a=0;t.length>a;a++){if(e=ut(t[a],n,r))break}return e}function ft(t,n){var r=t.attributes,e=r.r,a=void 0===e?0:e,i=r.fill,o=r.stroke,u=r.lineWidth,c=(void 0===u?0:u)/2,f=tt(0,0,n.x,n.y);return i&&o?a+c>=f:i?a>=f:!!o&&(f>=a-c&&a+c>=f)}function st(t,n,r,e){return t/(r*r)+n/(e*e)}function lt(t,n){var r=n.x,e=n.y,a=t.attributes,i=a.rx,o=void 0===i?0:i,u=a.ry,c=void 0===u?0:u,f=a.fill,s=a.stroke,l=a.lineWidth,v=(void 0===l?0:l)/2,h=r*r,y=e*e;return f&&s?1>=st(h,y,o+v,c+v):f?1>=st(h,y,o,c):!!s&&(st(h,y,o-v,c-v)>=1&&1>=st(h,y,o+v,c+v))}function vt(t,n){var r=t.attributes,e=r.lineWidth;return et(r.x1,r.y1,r.x2,r.y2,void 0===e?0:e,n.x+r.x,n.y+r.y)}function ht(t,n){var r=t.attributes,e=r.lineWidth,a=void 0===e?0:e;return!(!r.stroke||!a)&&at(r.points,a,n.x+r.x,n.y+r.y,!1)}function yt(t,n,r){var e=t.attributes,a=e.lineWidth,i=e.fill,o=e.hasArc,u=e.polygons,c=e.polylines,f=e.x,s=e.y,l=!1;return e.stroke&&(l=function(t,n,r,e,a,i,o){for(var u,c,f=!1,s=n/2,l=0;t.length>l;l++){var v=t[l],g=v.currentPoint,x=v.params,P=v.prePoint,m=v.box;if(!m||nt(m.x-s,m.y-s,m.width+n,m.height+n,r,e)){switch(v.command){case"L":case"Z":f=et(P[0],P[1],g[0],g[1],n,r,e);break;case"Q":f=n/2>=Q.pointDistance(P[0],P[1],x[1],x[2],x[3],x[4],r,e);break;case"C":f=n/2>=$.pointDistance(P[0],P[1],x[1],x[2],x[3],x[4],x[5],x[6],r,e,a);break;case"A":var M=v.arcParams,b=M.rx,w=M.ry,C=M.startAngle,S=M.endAngle,I=M.xRotation,j=b>w?b:w,F=b>w?1:b/w,O=b>w?w/b:1,R=(c=[-M.cx,-M.cy],(u=h())[0]=1,u[1]=0,u[2]=0,u[3]=0,u[4]=1,u[5]=0,u[6]=c[0],u[7]=c[1],u[8]=1,u);y(R,p(h(),-I),R),y(R,d(h(),[1/F,1/O]),R);var E=A(r,e);f=rt(0,0,j,C,S,n,(E=k(E,E,R))[0],E[1])}if(f)break}}return f}(e.segments,void 0===a?0:a,n.x+f,n.y+s,e.totalLength)),!l&&i&&(l=o?r(t,n):ct(u,n.x+f,n.y+s)||ct(c,n.x+f,n.y+s)),l}function pt(t,n,r){var e=t.attributes,a=e.radius,i=e.fill,o=e.stroke,u=e.lineWidth,c=void 0===u?0:u,f=e.width,s=e.height;if(a){var l=!1;return o&&(l=function(t,n,r,e,a,i,o,u){return et(t+a,n,t+r-a,n,i,o,u)||et(t+r,n+a,t+r,n+e-a,i,o,u)||et(t+r-a,n+e,t+a,n+e,i,o,u)||et(t,n+e-a,t,n+a,i,o,u)||rt(t+r-a,n+a,a,1.5*Math.PI,2*Math.PI,i,o,u)||rt(t+r-a,n+e-a,a,0,.5*Math.PI,i,o,u)||rt(t+a,n+e-a,a,.5*Math.PI,Math.PI,i,o,u)||rt(t+a,n+a,a,Math.PI,1.5*Math.PI,i,o,u)}(0,0,f,s,a,c,n.x,n.y)),!l&&i&&(l=r(t,n)),l}var v=c/2;return i&&o?nt(0-v,0-v,f+v,s+v,n.x,n.y):i?nt(0,0,f,s,n.x,n.y):!!o&&function(t,n,r,e,a,i,o){var u=a/2;return nt(t-u,n-u,r,a,i,o)||nt(t+r-u,n-u,a,e,i,o)||nt(t+u,n+e-u,r,a,i,o)||nt(t-u,n+u,a,e,i,o)}(0,0,f,s,c,n.x,n.y)}function dt(t,n){var r=t.attributes,e=r.fill,a=r.lineWidth,i=r.points,o=r.x,u=r.y,c=!1;return r.stroke&&(c=at(i,void 0===a?0:a,n.x+o,n.y+u,!0)),!c&&e&&(c=ut(i,n.x+o,n.y+u)),c}var gt=new c((function(t,r,e,a){t(I).toFactory((function(t){return function(t){return t===n.SHAPE.Circle?ft:t===n.SHAPE.Ellipse?lt:t===n.SHAPE.Rect?pt:t===n.SHAPE.Line?vt:t===n.SHAPE.Polyline?ht:t===n.SHAPE.Polygon?dt:t===n.SHAPE.Path?yt:null}})),t(j).toSelf().inSingletonScope(),t(n.RenderingPluginContribution).toService(j)}));t.containerModule=gt,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
function l(t,n,r,e){var a,i=arguments.length,o=3>i?n:null===e?e=Object.getOwnPropertyDescriptor(n,r):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,n,r,e);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(o=(3>i?a(o):i>3?a(n,r,o):a(n,r))||o);return i>3&&o&&Object.defineProperty(n,r,o),o}function s(t,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,n)}var y="undefined"!=typeof Float32Array?Float32Array:Array;function v(){var t=new y(9);return y!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function h(t,n,r){var e=n[0],a=n[1],i=n[2],o=n[3],u=n[4],c=n[5],f=n[6],l=n[7],s=n[8],y=r[0],v=r[1],h=r[2],p=r[3],d=r[4],g=r[5],x=r[6],m=r[7],P=r[8];return t[0]=y*e+v*o+h*f,t[1]=y*a+v*u+h*l,t[2]=y*i+v*c+h*s,t[3]=p*e+d*o+g*f,t[4]=p*a+d*u+g*l,t[5]=p*i+d*c+g*s,t[6]=x*e+m*o+P*f,t[7]=x*a+m*u+P*l,t[8]=x*i+m*c+P*s,t}function p(t,n){var r=Math.sin(n),e=Math.cos(n);return t[0]=e,t[1]=r,t[2]=0,t[3]=-r,t[4]=e,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function d(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=n[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function g(){var t=new y(16);return y!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function x(t,n){var r=n[0],e=n[1],a=n[2],i=n[3],o=n[4],u=n[5],c=n[6],f=n[7],l=n[8],s=n[9],y=n[10],v=n[11],h=n[12],p=n[13],d=n[14],g=n[15],x=r*u-e*o,m=r*c-a*o,P=r*f-i*o,b=e*c-a*u,M=e*f-i*u,A=a*f-i*c,k=l*p-s*h,w=l*d-y*h,S=l*g-v*h,C=s*d-y*p,I=s*g-v*p,j=y*g-v*d,F=x*j-m*I+P*C+b*S-M*w+A*k;return F?(t[0]=(u*j-c*I+f*C)*(F=1/F),t[1]=(a*I-e*j-i*C)*F,t[2]=(p*A-d*M+g*b)*F,t[3]=(y*M-s*A-v*b)*F,t[4]=(c*S-o*j-f*w)*F,t[5]=(r*j-a*S+i*w)*F,t[6]=(d*P-h*A-g*m)*F,t[7]=(l*A-y*P+v*m)*F,t[8]=(o*I-u*S+f*k)*F,t[9]=(e*S-r*I-i*k)*F,t[10]=(h*M-p*P+g*x)*F,t[11]=(s*P-l*M-v*x)*F,t[12]=(u*w-o*C-c*k)*F,t[13]=(r*C-e*w+a*k)*F,t[14]=(p*m-h*b-d*x)*F,t[15]=(l*b-s*m+y*x)*F,t):null}function m(){var t=new y(3);return y!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function P(t,n,r){var e=new y(3);return e[0]=t,e[1]=n,e[2]=r,e}function b(t,n,r){var e=n[0],a=n[1],i=n[2],o=r[3]*e+r[7]*a+r[11]*i+r[15];return t[0]=(r[0]*e+r[4]*a+r[8]*i+r[12])/(o=o||1),t[1]=(r[1]*e+r[5]*a+r[9]*i+r[13])/o,t[2]=(r[2]*e+r[6]*a+r[10]*i+r[14])/o,t}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});var M;M=m();function A(t,n){var r=new y(2);return r[0]=t,r[1]=n,r}function k(t,n,r){var e=n[0],a=n[1];return t[0]=r[0]*e+r[3]*a+r[6],t[1]=r[1]*e+r[4]*a+r[7],t}!function(){var t,n=(t=new y(2),y!=Float32Array&&(t[0]=0,t[1]=0),t)}();var w,S,C,I=Symbol("PointInPathPicker"),j=(S=w=function(){function t(){var n=this;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.camera=void 0,this.sceneGraphService=void 0,this.renderingContext=void 0,this.displayObjectPool=void 0,this.offscreenCanvas=void 0,this.pathGeneratorFactory=void 0,this.pointInPathPickerFactory=void 0,this.isPointInPath=function(t,r){var e=n.offscreenCanvas.getOrCreateContext(),a=n.pathGeneratorFactory(t.nodeType);return a&&a(e,t.attributes),e.isPointInPath(r.x,r.y)}}var n,r,e;return n=t,(r=[{key:"apply",value:function(t){var n=this;t.hooks.pick.tap(C.tag,(function(t){var r=t.position,e=P(r.x,r.y,0),a=x(g(),n.camera.getOrthoMatrix());b(e,e,a);var i=n.renderingContext.rBush.search({minX:e[0],minY:e[1],maxX:e[0],maxY:e[1]}),o=[];return i.forEach((function(t){var r=n.displayObjectPool.getByName(t.name),a=r.getConfig().capture;if(r.isVisible()&&a){var i=n.pointInPathPickerFactory(r.nodeType);if(i){var u=x(g(),r.getWorldTransform()),c=b(m(),P(e[0],e[1],0),u);i(r,{x:c[0],y:c[1]},n.isPointInPath)&&o.push(r)}else o.push(r)}})),o.sort(n.sceneGraphService.sort),{position:t.position,picked:o[o.length-1]}}))}}])&&f(n.prototype,r),e&&f(n,e),t}(),w.tag="CanvasPickerPlugin",C=S);l([u(n.Camera),s("design:type",n.Camera)],j.prototype,"camera",void 0),l([u(n.SceneGraphService),s("design:type",n.SceneGraphService)],j.prototype,"sceneGraphService",void 0),l([u(n.RenderingContext),s("design:type",Object)],j.prototype,"renderingContext",void 0),l([u(n.DisplayObjectPool),s("design:type",n.DisplayObjectPool)],j.prototype,"displayObjectPool",void 0),l([u(n.OffscreenCanvasCreator),s("design:type",n.OffscreenCanvasCreator)],j.prototype,"offscreenCanvas",void 0),l([u(r.PathGeneratorFactory),s("design:type",Function)],j.prototype,"pathGeneratorFactory",void 0),l([u(I),s("design:type",Function)],j.prototype,"pointInPathPickerFactory",void 0),j=C=l([function(t){if(Reflect.hasOwnMetadata(e,t))throw Error("Cannot apply @injectable decorator multiple times.");var n=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(e,n,t),t}],j);var F={}.toString,O=function(t){return Array.isArray?Array.isArray(t):function(t,n){return F.call(t)==="[object "+n+"]"}(t,"Array")},R=function(t){if(O(t))return t.reduce((function(t,n){return Math.max(t,n)}),t[0])},E=function(t){if(O(t))return t.reduce((function(t,n){return Math.min(t,n)}),t[0])};function q(t,n,r,e){var a=t-r,i=n-e;return Math.sqrt(a*a+i*i)}function G(t,n){return.001>Math.abs(t-n)}function T(t,n){var r=E(t),e=E(n);return{x:r,y:e,width:R(t)-r,height:R(n)-e}}function W(t){return(t+2*Math.PI)%(2*Math.PI)}var D="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});!function(){var t,n=(t=new D(2),D!=Float32Array&&(t[0]=0,t[1]=0),t)}();var H=function(t,n,r,e,a){return{x:(1-a)*t+a*r,y:(1-a)*n+a*e}},L=function(t,n,r,e,a,i){var o=[r-t,e-n];if(function(t,n){return t[0]===n[0]&&t[1]===n[1]}(o,[0,0]))return Math.sqrt((a-t)*(a-t)+(i-n)*(i-n));var u=[-o[1],o[0]];return function(t,n){var r=n[0],e=n[1],a=r*r+e*e;a>0&&(a=1/Math.sqrt(a)),t[0]=n[0]*a,t[1]=n[1]*a}(u,u),Math.abs(function(t,n){return t[0]*n[0]+t[1]*n[1]}([a-t,i-n],u))};function Y(t,n,r,e,a,i){var o=-1,u=1/0,c=[r,e],f=20;i&&i>200&&(f=i/10);for(var l=1/f,s=l/10,y=0;f>=y;y++){var v=y*l,h=[a.apply(null,t.concat([v])),a.apply(null,n.concat([v]))],p=q(c[0],c[1],h[0],h[1]);u>p&&(o=v,u=p)}if(0===o)return{x:t[0],y:n[0]};if(1===o){var d=t.length;return{x:t[d-1],y:n[d-1]}}u=1/0;for(var g=0;32>g&&1e-4<=s;g++){var x=o-s,m=o+s,P=[a.apply(null,t.concat([x])),a.apply(null,n.concat([x]))],b=q(c[0],c[1],P[0],P[1]);if(x>=0&&u>b)o=x,u=b;else{var M=[a.apply(null,t.concat([m])),a.apply(null,n.concat([m]))],A=q(c[0],c[1],M[0],M[1]);1>=m&&u>A?(o=m,u=A):s*=.5}}return{x:a.apply(null,t.concat([o])),y:a.apply(null,n.concat([o]))}}function _(t,n,r,e){var a=1-e;return a*a*t+2*e*a*n+e*e*r}function B(t,n,r){var e=t+r-2*n;if(G(e,0))return[.5];var a=(t-n)/e;return a>1||0>a?[]:[a]}function X(t,n,r,e){return 2*(1-e)*(n-t)+2*e*(r-n)}function z(t,n,r,e,a,i,o){var u=_(t,r,a,o),c=_(n,e,i,o),f=H(t,n,r,e,o),l=H(r,e,a,i,o);return[[t,n,f.x,f.y,u,c],[u,c,l.x,l.y,a,i]]}function N(t,n,r,e,a,i,o){if(0===o)return(q(t,n,r,e)+q(r,e,a,i)+q(t,n,a,i))/2;var u=z(t,n,r,e,a,i,.5),c=u[0],f=u[1];return c.push(o-1),f.push(o-1),N.apply(null,c)+N.apply(null,f)}var Q={box:function(t,n,r,e,a,i){var o=B(t,r,a)[0],u=B(n,e,i)[0],c=[t,a],f=[n,i];return void 0!==o&&c.push(_(t,r,a,o)),void 0!==u&&f.push(_(n,e,i,u)),T(c,f)},length:function(t,n,r,e,a,i){return N(t,n,r,e,a,i,3)},nearestPoint:function(t,n,r,e,a,i,o,u){return Y([t,r,a],[n,e,i],o,u,_)},pointDistance:function(t,n,r,e,a,i,o,u){var c=this.nearestPoint(t,n,r,e,a,i,o,u);return q(c.x,c.y,o,u)},interpolationAt:_,pointAt:function(t,n,r,e,a,i,o){return{x:_(t,r,a,o),y:_(n,e,i,o)}},divide:function(t,n,r,e,a,i,o){return z(t,n,r,e,a,i,o)},tangentAngle:function(t,n,r,e,a,i,o){var u=X(t,r,a,o),c=X(n,e,i,o);return W(Math.atan2(c,u))}};function U(t){return function(t){if(Array.isArray(t))return V(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,n){if(!t)return;if("string"==typeof t)return V(t,n);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 V(t,n)}(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.")}()}function V(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=Array(n);n>r;r++)e[r]=t[r];return e}function Z(t,n,r,e,a){var i=1-a;return i*i*i*t+3*n*a*i*i+3*r*a*a*i+e*a*a*a}function $(t,n,r,e,a){var i=1-a;return 3*(i*i*(n-t)+2*i*a*(r-n)+a*a*(e-r))}function J(t,n,r,e){var a,i,o,u=-3*t+9*n-9*r+3*e,c=6*t-12*n+6*r,f=3*n-3*t,l=[];if(G(u,0))G(c,0)||0>(a=-f/c)||a>1||l.push(a);else{var s=c*c-4*u*f;G(s,0)?l.push(-c/(2*u)):s>0&&(i=(-c-(o=Math.sqrt(s)))/(2*u),0>(a=(-c+o)/(2*u))||a>1||l.push(a),0>i||i>1||l.push(i))}return l}function K(t,n,r,e,a,i,o,u,c){var f=Z(t,r,a,o,c),l=Z(n,e,i,u,c),s=H(t,n,r,e,c),y=H(r,e,a,i,c),v=H(a,i,o,u,c),h=H(s.x,s.y,y.x,y.y,c),p=H(y.x,y.y,v.x,v.y,c);return[[t,n,s.x,s.y,h.x,h.y,f,l],[f,l,p.x,p.y,v.x,v.y,o,u]]}function tt(t,n,r,e,a,i,o,u,c){if(0===c)return function(t,n){for(var r=0,e=t.length,a=0;e>a;a++)r+=q(t[a],n[a],t[(a+1)%e],n[(a+1)%e]);return r/2}([t,r,a,o],[n,e,i,u]);var f=K(t,n,r,e,a,i,o,u,.5),l=[].concat(U(f[0]),[c-1]),s=[].concat(U(f[1]),[c-1]);return tt.apply(null,l)+tt.apply(null,s)}var nt={extrema:J,box:function(t,n,r,e,a,i,o,u){for(var c=[t,o],f=[n,u],l=J(t,r,a,o),s=J(n,e,i,u),y=0;l.length>y;y++)c.push(Z(t,r,a,o,l[y]));for(var v=0;s.length>v;v++)f.push(Z(n,e,i,u,s[v]));return T(c,f)},length:function(t,n,r,e,a,i,o,u){return tt(t,n,r,e,a,i,o,u,3)},nearestPoint:function(t,n,r,e,a,i,o,u,c,f,l){return Y([t,r,a,o],[n,e,i,u],c,f,Z,l)},pointDistance:function(t,n,r,e,a,i,o,u,c,f,l){var s=this.nearestPoint(t,n,r,e,a,i,o,u,c,f,l);return q(s.x,s.y,c,f)},interpolationAt:Z,pointAt:function(t,n,r,e,a,i,o,u,c){return{x:Z(t,r,a,o,c),y:Z(n,e,i,u,c)}},divide:function(t,n,r,e,a,i,o,u,c){return K(t,n,r,e,a,i,o,u,c)},tangentAngle:function(t,n,r,e,a,i,o,u,c){var f=$(t,r,a,o,c),l=$(n,e,i,u,c);return W(Math.atan2(l,f))}};function rt(t,n,r,e){var a=t-r,i=n-e;return Math.sqrt(a*a+i*i)}function et(t,n,r,e,a,i){return!(t>a||a>t+r||n>i||i>n+e)}function at(t,n,r,e,a,i,o,u){var c=(Math.atan2(u-n,o-t)+2*Math.PI)%(2*Math.PI);if(e>c||c>a)return!1;var f={x:t+r*Math.cos(c),y:n+r*Math.sin(c)};return rt(f.x,f.y,o,u)<=i/2}function it(t,n,r,e,a,i,o){var u=a/2;return!(Math.min(t,r)-u>i||i>Math.max(t,r)+u||Math.min(n,e)-u>o||o>Math.max(n,e)+u)&&L(t,n,r,e,i,o)<=a/2}function ot(t,n,r,e,a){var i=t.length;if(2>i)return!1;for(var o=0;i-1>o;o++){if(it(t[o][0],t[o][1],t[o+1][0],t[o+1][1],n,r,e))return!0}if(a){var u=t[0],c=t[i-1];if(it(u[0],u[1],c[0],c[1],n,r,e))return!0}return!1}function ut(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function ct(t,n,r){return!((r[0]-t[0])*(n[1]-t[1])!=(n[0]-t[0])*(r[1]-t[1])||Math.min(t[0],n[0])>r[0]||r[0]>Math.max(t[0],n[0])||Math.min(t[1],n[1])>r[1]||r[1]>Math.max(t[1],n[1]))}function ft(t,n,r){var e=!1,a=t.length;if(2>=a)return!1;for(var i=0;a>i;i++){var o=t[i],u=t[(i+1)%a];if(ct(o,u,[n,r]))return!0;ut(o[1]-r)>0!=ut(u[1]-r)>0&&0>ut(n-(r-o[1])*(o[0]-u[0])/(o[1]-u[1])-o[0])&&(e=!e)}return e}function lt(t,n,r){for(var e=!1,a=0;t.length>a;a++){if(e=ft(t[a],n,r))break}return e}function st(t,n){var r=t.attributes,e=r.r,a=void 0===e?0:e,i=r.fill,o=r.stroke,u=r.lineWidth,c=(void 0===u?0:u)/2,f=rt(0,0,n.x,n.y);return i&&o?a+c>=f:i?a>=f:!!o&&(f>=a-c&&a+c>=f)}function yt(t,n,r,e){return t/(r*r)+n/(e*e)}function vt(t,n){var r=n.x,e=n.y,a=t.attributes,i=a.rx,o=void 0===i?0:i,u=a.ry,c=void 0===u?0:u,f=a.fill,l=a.stroke,s=a.lineWidth,y=(void 0===s?0:s)/2,v=r*r,h=e*e;return f&&l?1>=yt(v,h,o+y,c+y):f?1>=yt(v,h,o,c):!!l&&(yt(v,h,o-y,c-y)>=1&&1>=yt(v,h,o+y,c+y))}function ht(t,n){var r=t.attributes,e=r.lineWidth;return it(r.x1,r.y1,r.x2,r.y2,void 0===e?0:e,n.x+r.x,n.y+r.y)}function pt(t,n){var r=t.attributes,e=r.lineWidth,a=void 0===e?0:e;return!(!r.stroke||!a)&&ot(r.points,a,n.x+r.x,n.y+r.y,!1)}function dt(t,n,r){var e=t.attributes,a=e.lineWidth,i=e.fill,o=e.hasArc,u=e.polygons,c=e.polylines,f=e.x,l=e.y,s=!1;return e.stroke&&(s=function(t,n,r,e,a,i,o){for(var u,c,f=!1,l=n/2,s=0;t.length>s;s++){var y=t[s],g=y.currentPoint,x=y.params,m=y.prePoint,P=y.box;if(!P||et(P.x-l,P.y-l,P.width+n,P.height+n,r,e)){switch(y.command){case"L":case"Z":f=it(m[0],m[1],g[0],g[1],n,r,e);break;case"Q":f=n/2>=Q.pointDistance(m[0],m[1],x[1],x[2],x[3],x[4],r,e);break;case"C":f=n/2>=nt.pointDistance(m[0],m[1],x[1],x[2],x[3],x[4],x[5],x[6],r,e,a);break;case"A":var b=y.arcParams,M=b.rx,w=b.ry,S=b.startAngle,C=b.endAngle,I=b.xRotation,j=M>w?M:w,F=M>w?1:M/w,O=M>w?w/M:1,R=(c=[-b.cx,-b.cy],(u=v())[0]=1,u[1]=0,u[2]=0,u[3]=0,u[4]=1,u[5]=0,u[6]=c[0],u[7]=c[1],u[8]=1,u);h(R,p(v(),-I),R),h(R,d(v(),[1/F,1/O]),R);var E=A(r,e);f=at(0,0,j,S,C,n,(E=k(E,E,R))[0],E[1])}if(f)break}}return f}(e.segments,void 0===a?0:a,n.x+f,n.y+l,e.totalLength)),!s&&i&&(s=o?r(t,n):lt(u,n.x+f,n.y+l)||lt(c,n.x+f,n.y+l)),s}function gt(t,n,r){var e=t.attributes,a=e.radius,i=e.fill,o=e.stroke,u=e.lineWidth,c=void 0===u?0:u,f=e.width,l=e.height;if(a){var s=!1;return o&&(s=function(t,n,r,e,a,i,o,u){return it(t+a,n,t+r-a,n,i,o,u)||it(t+r,n+a,t+r,n+e-a,i,o,u)||it(t+r-a,n+e,t+a,n+e,i,o,u)||it(t,n+e-a,t,n+a,i,o,u)||at(t+r-a,n+a,a,1.5*Math.PI,2*Math.PI,i,o,u)||at(t+r-a,n+e-a,a,0,.5*Math.PI,i,o,u)||at(t+a,n+e-a,a,.5*Math.PI,Math.PI,i,o,u)||at(t+a,n+a,a,Math.PI,1.5*Math.PI,i,o,u)}(0,0,f,l,a,c,n.x,n.y)),!s&&i&&(s=r(t,n)),s}var y=c/2;return i&&o?et(0-y,0-y,f+y,l+y,n.x,n.y):i?et(0,0,f,l,n.x,n.y):!!o&&function(t,n,r,e,a,i,o){var u=a/2;return et(t-u,n-u,r,a,i,o)||et(t+r-u,n-u,a,e,i,o)||et(t+u,n+e-u,r,a,i,o)||et(t-u,n+u,a,e,i,o)}(0,0,f,l,c,n.x,n.y)}function xt(t,n){var r=t.attributes,e=r.fill,a=r.lineWidth,i=r.points,o=r.x,u=r.y,c=!1;return r.stroke&&(c=ot(i,void 0===a?0:a,n.x+o,n.y+u,!0)),!c&&e&&(c=ft(i,n.x+o,n.y+u)),c}var mt=new c((function(t,r,e,a){t(I).toFactory((function(t){return function(t){return t===n.SHAPE.Circle?st:t===n.SHAPE.Ellipse?vt:t===n.SHAPE.Rect?gt:t===n.SHAPE.Line?ht:t===n.SHAPE.Polyline?pt:t===n.SHAPE.Polygon?xt:t===n.SHAPE.Path?dt:null}})),t(j).toSelf().inSingletonScope(),t(n.RenderingPluginContribution).toService(j)}));t.containerModule=mt,Object.defineProperty(t,"__esModule",{value:!0})})); |
{ | ||
"name": "@antv/g-plugin-canvas-picker", | ||
"version": "1.0.0-alpha.1", | ||
"version": "1.0.0-alpha.2", | ||
"description": "A G plugin for picking in canvas", | ||
@@ -45,3 +45,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "84ec7a493b5161bf00356bb887d13a35fd2f0899" | ||
"gitHead": "2fe2253d4f856f456d8a4e4929b1dba6fd42de8a" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
201966
5020
0