@antv/g-plugin-canvas-picker
Advanced tools
Comparing version 1.0.0-alpha.0 to 1.0.0-alpha.1
@@ -13,2 +13,3 @@ import { DisplayObject, RenderingService, RenderingPlugin } from '@antv/g'; | ||
static tag: string; | ||
private camera; | ||
private sceneGraphService; | ||
@@ -15,0 +16,0 @@ private renderingContext; |
@@ -1,2 +0,2 @@ | ||
import { RenderingContext, DisplayObjectPool, OffscreenCanvasCreator, SceneGraphService, SHAPE, RenderingPluginContribution } from '@antv/g'; | ||
import { SceneGraphService, RenderingContext, DisplayObjectPool, OffscreenCanvasCreator, Camera, SHAPE, RenderingPluginContribution } from '@antv/g'; | ||
import { PathGeneratorFactory } from '@antv/g-plugin-canvas-renderer'; | ||
@@ -92,12 +92,16 @@ | ||
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArrays$1 = (undefined && undefined.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
@@ -141,7 +145,2 @@ | ||
}; | ||
var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -690,2 +689,3 @@ var ContainerModule = (function () { | ||
this.camera = void 0; | ||
this.sceneGraphService = void 0; | ||
@@ -720,9 +720,12 @@ this.renderingContext = void 0; | ||
x = _result$position.x, | ||
y = _result$position.y; // query by AABB first with spatial index(r-tree) | ||
y = _result$position.y; | ||
var position = fromValues(x, y, 0); | ||
var invertOrthoMat = invert(create$1(), _this2.camera.getOrthoMatrix()); | ||
transformMat4(position, position, invertOrthoMat); // query by AABB first with spatial index(r-tree) | ||
var rBushNodes = _this2.renderingContext.rBush.search({ | ||
minX: x, | ||
minY: y, | ||
maxX: x, | ||
maxY: y | ||
minX: position[0], | ||
minY: position[1], | ||
maxX: position[0], | ||
maxY: position[1] | ||
}); | ||
@@ -745,6 +748,5 @@ | ||
// invert with world matrix | ||
var worldTransform = displayObject.getWorldTransform(); | ||
var invertWorldMat = invert(create$1(), worldTransform); // transform client position to local space, do picking in local space | ||
var invertWorldMat = invert(create$1(), displayObject.getWorldTransform()); // transform client position to local space, do picking in local space | ||
var localPosition = transformMat4(create$2(), fromValues(x, y, 0), invertWorldMat); | ||
var localPosition = transformMat4(create$2(), fromValues(position[0], position[1], 0), invertWorldMat); | ||
@@ -782,2 +784,4 @@ if (pick(displayObject, { | ||
__decorate([inject(Camera), __metadata("design:type", Camera)], CanvasPickerPlugin.prototype, "camera", void 0); | ||
__decorate([inject(SceneGraphService), __metadata("design:type", SceneGraphService)], CanvasPickerPlugin.prototype, "sceneGraphService", void 0); | ||
@@ -784,0 +788,0 @@ |
@@ -96,12 +96,16 @@ 'use strict'; | ||
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArrays$1 = (undefined && undefined.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
@@ -145,7 +149,2 @@ | ||
}; | ||
var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -694,2 +693,3 @@ var ContainerModule = (function () { | ||
this.camera = void 0; | ||
this.sceneGraphService = void 0; | ||
@@ -724,9 +724,12 @@ this.renderingContext = void 0; | ||
x = _result$position.x, | ||
y = _result$position.y; // query by AABB first with spatial index(r-tree) | ||
y = _result$position.y; | ||
var position = fromValues(x, y, 0); | ||
var invertOrthoMat = invert(create$1(), _this2.camera.getOrthoMatrix()); | ||
transformMat4(position, position, invertOrthoMat); // query by AABB first with spatial index(r-tree) | ||
var rBushNodes = _this2.renderingContext.rBush.search({ | ||
minX: x, | ||
minY: y, | ||
maxX: x, | ||
maxY: y | ||
minX: position[0], | ||
minY: position[1], | ||
maxX: position[0], | ||
maxY: position[1] | ||
}); | ||
@@ -749,6 +752,5 @@ | ||
// invert with world matrix | ||
var worldTransform = displayObject.getWorldTransform(); | ||
var invertWorldMat = invert(create$1(), worldTransform); // transform client position to local space, do picking in local space | ||
var invertWorldMat = invert(create$1(), displayObject.getWorldTransform()); // transform client position to local space, do picking in local space | ||
var localPosition = transformMat4(create$2(), fromValues(x, y, 0), invertWorldMat); | ||
var localPosition = transformMat4(create$2(), fromValues(position[0], position[1], 0), invertWorldMat); | ||
@@ -786,2 +788,4 @@ if (pick(displayObject, { | ||
__decorate([inject(g.Camera), __metadata("design:type", g.Camera)], CanvasPickerPlugin.prototype, "camera", void 0); | ||
__decorate([inject(g.SceneGraphService), __metadata("design:type", g.SceneGraphService)], CanvasPickerPlugin.prototype, "sceneGraphService", void 0); | ||
@@ -788,0 +792,0 @@ |
@@ -95,12 +95,16 @@ (function (global, factory) { | ||
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArrays$1 = (undefined && undefined.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
@@ -144,7 +148,2 @@ | ||
}; | ||
var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
@@ -693,2 +692,3 @@ var ContainerModule = (function () { | ||
this.camera = void 0; | ||
this.sceneGraphService = void 0; | ||
@@ -723,9 +723,12 @@ this.renderingContext = void 0; | ||
x = _result$position.x, | ||
y = _result$position.y; // query by AABB first with spatial index(r-tree) | ||
y = _result$position.y; | ||
var position = fromValues(x, y, 0); | ||
var invertOrthoMat = invert(create$1(), _this2.camera.getOrthoMatrix()); | ||
transformMat4(position, position, invertOrthoMat); // query by AABB first with spatial index(r-tree) | ||
var rBushNodes = _this2.renderingContext.rBush.search({ | ||
minX: x, | ||
minY: y, | ||
maxX: x, | ||
maxY: y | ||
minX: position[0], | ||
minY: position[1], | ||
maxX: position[0], | ||
maxY: position[1] | ||
}); | ||
@@ -748,6 +751,5 @@ | ||
// invert with world matrix | ||
var worldTransform = displayObject.getWorldTransform(); | ||
var invertWorldMat = invert(create$1(), worldTransform); // transform client position to local space, do picking in local space | ||
var invertWorldMat = invert(create$1(), displayObject.getWorldTransform()); // transform client position to local space, do picking in local space | ||
var localPosition = transformMat4(create$2(), fromValues(x, y, 0), invertWorldMat); | ||
var localPosition = transformMat4(create$2(), fromValues(position[0], position[1], 0), invertWorldMat); | ||
@@ -785,2 +787,4 @@ if (pick(displayObject, { | ||
__decorate([inject(g.Camera), __metadata("design:type", g.Camera)], CanvasPickerPlugin.prototype, "camera", void 0); | ||
__decorate([inject(g.SceneGraphService), __metadata("design:type", g.SceneGraphService)], CanvasPickerPlugin.prototype, "sceneGraphService", void 0); | ||
@@ -787,0 +791,0 @@ |
@@ -16,2 +16,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 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(3);return v!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)});var x;x=g();function P(t,n){var r=new v(2);return r[0]=t,r[1]=n,r}function M(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 m,b,A,k=Symbol("PointInPathPicker"),w=(b=m=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.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(A.tag,(function(t){var r=t.position,e=r.x,a=r.y,i=n.renderingContext.rBush.search({minX:e,minY:a,maxX:e,maxY:a}),o=[];return i.forEach((function(t){var r,i=n.displayObjectPool.getByName(t.name),u=i.getConfig().capture;if(i.isVisible()&&u){var c=n.pointInPathPickerFactory(i.nodeType);if(c){var f=i.getWorldTransform(),s=function(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}((r=new v(16),v!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r),f),l=function(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}(g(),function(t,n,r){var e=new v(3);return e[0]=t,e[1]=n,e[2]=r,e}(e,a,0),s);c(i,{x:l[0],y:l[1]},n.isPointInPath)&&o.push(i)}else o.push(i)}})),o.sort(n.sceneGraphService.sort),{position:t.position,picked:o[o.length-1]}}))}}])&&f(n.prototype,r),e&&f(n,e),t}(),m.tag="CanvasPickerPlugin",A=b);s([u(n.SceneGraphService),l("design:type",n.SceneGraphService)],w.prototype,"sceneGraphService",void 0),s([u(n.RenderingContext),l("design:type",Object)],w.prototype,"renderingContext",void 0),s([u(n.DisplayObjectPool),l("design:type",n.DisplayObjectPool)],w.prototype,"displayObjectPool",void 0),s([u(n.OffscreenCanvasCreator),l("design:type",n.OffscreenCanvasCreator)],w.prototype,"offscreenCanvas",void 0),s([u(r.PathGeneratorFactory),l("design:type",Function)],w.prototype,"pathGeneratorFactory",void 0),s([u(k),l("design:type",Function)],w.prototype,"pointInPathPickerFactory",void 0),w=A=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}],w);var C={}.toString,S=function(t){return Array.isArray?Array.isArray(t):function(t,n){return C.call(t)==="[object "+n+"]"}(t,"Array")},I=function(t){if(S(t))return t.reduce((function(t,n){return Math.max(t,n)}),t[0])},j=function(t){if(S(t))return t.reduce((function(t,n){return Math.min(t,n)}),t[0])};function F(t,n,r,e){var a=t-r,i=n-e;return Math.sqrt(a*a+i*i)}function R(t,n){return.001>Math.abs(t-n)}function O(t,n){var r=j(t),e=j(n);return{x:r,y:e,width:I(t)-r,height:I(n)-e}}function E(t){return(t+2*Math.PI)%(2*Math.PI)}var q="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 q(2),q!=Float32Array&&(t[0]=0,t[1]=0),t)}();var G=function(t,n,r,e,a){return{x:(1-a)*t+a*r,y:(1-a)*n+a*e}},W=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 D(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=F(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=F(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=F(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 H(t,n,r,e){var a=1-e;return a*a*t+2*e*a*n+e*e*r}function T(t,n,r){var e=t+r-2*n;if(R(e,0))return[.5];var a=(t-n)/e;return a>1||0>a?[]:[a]}function L(t,n,r,e){return 2*(1-e)*(n-t)+2*e*(r-n)}function Y(t,n,r,e,a,i,o){var u=H(t,r,a,o),c=H(n,e,i,o),f=G(t,n,r,e,o),s=G(r,e,a,i,o);return[[t,n,f.x,f.y,u,c],[u,c,s.x,s.y,a,i]]}function _(t,n,r,e,a,i,o){if(0===o)return(F(t,n,r,e)+F(r,e,a,i)+F(t,n,a,i))/2;var u=Y(t,n,r,e,a,i,.5),c=u[0],f=u[1];return c.push(o-1),f.push(o-1),_.apply(null,c)+_.apply(null,f)}var B={box:function(t,n,r,e,a,i){var o=T(t,r,a)[0],u=T(n,e,i)[0],c=[t,a],f=[n,i];return void 0!==o&&c.push(H(t,r,a,o)),void 0!==u&&f.push(H(n,e,i,u)),O(c,f)},length:function(t,n,r,e,a,i){return _(t,n,r,e,a,i,3)},nearestPoint:function(t,n,r,e,a,i,o,u){return D([t,r,a],[n,e,i],o,u,H)},pointDistance:function(t,n,r,e,a,i,o,u){var c=this.nearestPoint(t,n,r,e,a,i,o,u);return F(c.x,c.y,o,u)},interpolationAt:H,pointAt:function(t,n,r,e,a,i,o){return{x:H(t,r,a,o),y:H(n,e,i,o)}},divide:function(t,n,r,e,a,i,o){return Y(t,n,r,e,a,i,o)},tangentAngle:function(t,n,r,e,a,i,o){var u=L(t,r,a,o),c=L(n,e,i,o);return E(Math.atan2(c,u))}};function X(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 N(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(R(u,0))R(c,0)||0>(a=-f/c)||a>1||s.push(a);else{var l=c*c-4*u*f;R(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 Q(t,n,r,e,a,i,o,u,c){var f=X(t,r,a,o,c),s=X(n,e,i,u,c),l=G(t,n,r,e,c),v=G(r,e,a,i,c),h=G(a,i,o,u,c),y=G(l.x,l.y,v.x,v.y,c),p=G(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 V(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+=F(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=Q(t,n,r,e,a,i,o,u,.5),s=f[0],l=f[1];return s.push(c-1),l.push(c-1),V.apply(null,s)+V.apply(null,l)}var Z={extrema:N,box:function(t,n,r,e,a,i,o,u){for(var c=[t,o],f=[n,u],s=N(t,r,a,o),l=N(n,e,i,u),v=0;s.length>v;v++)c.push(X(t,r,a,o,s[v]));for(var h=0;l.length>h;h++)f.push(X(n,e,i,u,l[h]));return O(c,f)},length:function(t,n,r,e,a,i,o,u){return V(t,n,r,e,a,i,o,u,3)},nearestPoint:function(t,n,r,e,a,i,o,u,c,f,s){return D([t,r,a,o],[n,e,i,u],c,f,X,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 F(l.x,l.y,c,f)},interpolationAt:X,pointAt:function(t,n,r,e,a,i,o,u,c){return{x:X(t,r,a,o,c),y:X(n,e,i,u,c)}},divide:function(t,n,r,e,a,i,o,u,c){return Q(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 E(Math.atan2(s,f))}};function J(t,n,r,e){var a=t-r,i=n-e;return Math.sqrt(a*a+i*i)}function K(t,n,r,e,a,i){return!(t>a||a>t+r||n>i||i>n+e)}function U(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 J(f.x,f.y,o,u)<=i/2}function $(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)&&W(t,n,r,e,i,o)<=a/2}function tt(t,n,r,e,a){var i=t.length;if(2>i)return!1;for(var o=0;i-1>o;o++){if($(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($(u[0],u[1],c[0],c[1],n,r,e))return!0}return!1}function nt(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function rt(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 et(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(rt(o,u,[n,r]))return!0;nt(o[1]-r)>0!=nt(u[1]-r)>0&&0>nt(n-(r-o[1])*(o[0]-u[0])/(o[1]-u[1])-o[0])&&(e=!e)}return e}function at(t,n,r){for(var e=!1,a=0;t.length>a;a++){if(e=et(t[a],n,r))break}return e}function it(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=J(0,0,n.x,n.y);return i&&o?a+c>=f:i?a>=f:!!o&&(f>=a-c&&a+c>=f)}function ot(t,n,r,e){return t/(r*r)+n/(e*e)}function ut(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>=ot(h,y,o+v,c+v):f?1>=ot(h,y,o,c):!!s&&(ot(h,y,o-v,c-v)>=1&&1>=ot(h,y,o+v,c+v))}function ct(t,n){var r=t.attributes,e=r.lineWidth;return $(r.x1,r.y1,r.x2,r.y2,void 0===e?0:e,n.x+r.x,n.y+r.y)}function ft(t,n){var r=t.attributes,e=r.lineWidth,a=void 0===e?0:e;return!(!r.stroke||!a)&&tt(r.points,a,n.x+r.x,n.y+r.y,!1)}function st(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,m=v.prePoint,b=v.box;if(!b||K(b.x-s,b.y-s,b.width+n,b.height+n,r,e)){switch(v.command){case"L":case"Z":f=$(m[0],m[1],g[0],g[1],n,r,e);break;case"Q":f=n/2>=B.pointDistance(m[0],m[1],x[1],x[2],x[3],x[4],r,e);break;case"C":f=n/2>=Z.pointDistance(m[0],m[1],x[1],x[2],x[3],x[4],x[5],x[6],r,e,a);break;case"A":var A=v.arcParams,k=A.rx,w=A.ry,C=A.startAngle,S=A.endAngle,I=A.xRotation,j=k>w?k:w,F=k>w?1:k/w,R=k>w?w/k:1,O=(c=[-A.cx,-A.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(O,p(h(),-I),O),y(O,d(h(),[1/F,1/R]),O);var E=P(r,e);f=U(0,0,j,C,S,n,(E=M(E,E,O))[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):at(u,n.x+f,n.y+s)||at(c,n.x+f,n.y+s)),l}function lt(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 $(t+a,n,t+r-a,n,i,o,u)||$(t+r,n+a,t+r,n+e-a,i,o,u)||$(t+r-a,n+e,t+a,n+e,i,o,u)||$(t,n+e-a,t,n+a,i,o,u)||U(t+r-a,n+a,a,1.5*Math.PI,2*Math.PI,i,o,u)||U(t+r-a,n+e-a,a,0,.5*Math.PI,i,o,u)||U(t+a,n+e-a,a,.5*Math.PI,Math.PI,i,o,u)||U(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?K(0-v,0-v,f+v,s+v,n.x,n.y):i?K(0,0,f,s,n.x,n.y):!!o&&function(t,n,r,e,a,i,o){var u=a/2;return K(t-u,n-u,r,a,i,o)||K(t+r-u,n-u,a,e,i,o)||K(t+u,n+e-u,r,a,i,o)||K(t-u,n+u,a,e,i,o)}(0,0,f,s,c,n.x,n.y)}function vt(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=tt(i,void 0===a?0:a,n.x+o,n.y+u,!0)),!c&&e&&(c=et(i,n.x+o,n.y+u)),c}var ht=new c((function(t,r,e,a){t(k).toFactory((function(t){return function(t){return t===n.SHAPE.Circle?it:t===n.SHAPE.Ellipse?ut:t===n.SHAPE.Rect?lt:t===n.SHAPE.Line?ct:t===n.SHAPE.Polyline?ft:t===n.SHAPE.Polygon?vt:t===n.SHAPE.Path?st:null}})),t(w).toSelf().inSingletonScope(),t(n.RenderingPluginContribution).toService(w)}));t.containerModule=ht,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
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})})); |
{ | ||
"name": "@antv/g-plugin-canvas-picker", | ||
"version": "1.0.0-alpha.0", | ||
"version": "1.0.0-alpha.1", | ||
"description": "A G plugin for picking in canvas", | ||
@@ -45,3 +45,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "1218abbd3b3d843947047e7ee8f65089aa9c44a4" | ||
"gitHead": "84ec7a493b5161bf00356bb887d13a35fd2f0899" | ||
} |
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
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
197192
16
4942
1