Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antv/g-plugin-canvas-renderer

Package Overview
Dependencies
Maintainers
64
Versions
261
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.7.50 to 1.7.51

23

dist/index.esm.js

@@ -467,3 +467,3 @@ import { ElementEvent, AABB, CustomEvent, CanvasEvent, Shape, isPattern, GradientType, runtime, AbstractRendererPlugin } from '@antv/g-lite';

if (context) {
context.resetTransform();
context.resetTransform ? context.resetTransform() : context.setTransform(1, 0, 0, 1, 0, 0);
if (_this.clearFullScreen) {

@@ -879,3 +879,3 @@ _this.clearRect(context, 0, 0, width * dpr, height * dpr, config.background);

context.fillStyle = _this.getColor(gradient, object, context);
context.fill(fillRule);
fillRule ? context.fill(fillRule) : context.fill();
});

@@ -886,3 +886,3 @@ } else {

}
context.fill(fillRule);
fillRule ? context.fill(fillRule) : context.fill();
}

@@ -1037,6 +1037,7 @@ };

var formattedTextBaseline = textBaseline;
if (formattedTextBaseline === 'bottom' || !runtime.enableCSSParsing && formattedTextBaseline === 'alphabetic') {
formattedTextBaseline = 'ideographic';
if (
// formattedTextBaseline === 'bottom' ||
!runtime.enableCSSParsing && formattedTextBaseline === 'alphabetic') {
formattedTextBaseline = 'bottom';
}
context.textBaseline = formattedTextBaseline;
context.lineJoin = lineJoin;

@@ -1058,2 +1059,12 @@ if (!isNil(miterLimit)) {

linePositionY += dy || 0;
if (lines.length === 1) {
if (formattedTextBaseline === 'bottom') {
formattedTextBaseline = 'middle';
linePositionY -= 0.5 * height;
} else if (formattedTextBaseline === 'top') {
formattedTextBaseline = 'middle';
linePositionY += 0.5 * height;
}
}
context.textBaseline = formattedTextBaseline;
var hasShadow = !isNil(shadowColor) && shadowBlur > 0;

@@ -1060,0 +1071,0 @@ setShadowAndFilter(object, context, hasShadow);

@@ -471,3 +471,3 @@ 'use strict';

if (context) {
context.resetTransform();
context.resetTransform ? context.resetTransform() : context.setTransform(1, 0, 0, 1, 0, 0);
if (_this.clearFullScreen) {

@@ -883,3 +883,3 @@ _this.clearRect(context, 0, 0, width * dpr, height * dpr, config.background);

context.fillStyle = _this.getColor(gradient, object, context);
context.fill(fillRule);
fillRule ? context.fill(fillRule) : context.fill();
});

@@ -890,3 +890,3 @@ } else {

}
context.fill(fillRule);
fillRule ? context.fill(fillRule) : context.fill();
}

@@ -1041,6 +1041,7 @@ };

var formattedTextBaseline = textBaseline;
if (formattedTextBaseline === 'bottom' || !gLite.runtime.enableCSSParsing && formattedTextBaseline === 'alphabetic') {
formattedTextBaseline = 'ideographic';
if (
// formattedTextBaseline === 'bottom' ||
!gLite.runtime.enableCSSParsing && formattedTextBaseline === 'alphabetic') {
formattedTextBaseline = 'bottom';
}
context.textBaseline = formattedTextBaseline;
context.lineJoin = lineJoin;

@@ -1062,2 +1063,12 @@ if (!util.isNil(miterLimit)) {

linePositionY += dy || 0;
if (lines.length === 1) {
if (formattedTextBaseline === 'bottom') {
formattedTextBaseline = 'middle';
linePositionY -= 0.5 * height;
} else if (formattedTextBaseline === 'top') {
formattedTextBaseline = 'middle';
linePositionY += 0.5 * height;
}
}
context.textBaseline = formattedTextBaseline;
var hasShadow = !util.isNil(shadowColor) && shadowBlur > 0;

@@ -1064,0 +1075,0 @@ setShadowAndFilter(object, context, hasShadow);

@@ -800,3 +800,3 @@ (function (global, factory) {

if (context) {
context.resetTransform();
context.resetTransform ? context.resetTransform() : context.setTransform(1, 0, 0, 1, 0, 0);
if (_this.clearFullScreen) {

@@ -1212,3 +1212,3 @@ _this.clearRect(context, 0, 0, width * dpr, height * dpr, config.background);

context.fillStyle = _this.getColor(gradient, object, context);
context.fill(fillRule);
fillRule ? context.fill(fillRule) : context.fill();
});

@@ -1219,3 +1219,3 @@ } else {

}
context.fill(fillRule);
fillRule ? context.fill(fillRule) : context.fill();
}

@@ -1370,6 +1370,7 @@ };

var formattedTextBaseline = textBaseline;
if (formattedTextBaseline === 'bottom' || !gLite.runtime.enableCSSParsing && formattedTextBaseline === 'alphabetic') {
formattedTextBaseline = 'ideographic';
if (
// formattedTextBaseline === 'bottom' ||
!gLite.runtime.enableCSSParsing && formattedTextBaseline === 'alphabetic') {
formattedTextBaseline = 'bottom';
}
context.textBaseline = formattedTextBaseline;
context.lineJoin = lineJoin;

@@ -1391,2 +1392,12 @@ if (!isNil(miterLimit)) {

linePositionY += dy || 0;
if (lines.length === 1) {
if (formattedTextBaseline === 'bottom') {
formattedTextBaseline = 'middle';
linePositionY -= 0.5 * height;
} else if (formattedTextBaseline === 'top') {
formattedTextBaseline = 'middle';
linePositionY += 0.5 * height;
}
}
context.textBaseline = formattedTextBaseline;
var hasShadow = !isNil(shadowColor) && shadowBlur > 0;

@@ -1393,0 +1404,0 @@ setShadowAndFilter(object, context, hasShadow);

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.CanvasRenderer={}),t.window.G)}(this,(function(t,e){"use strict";function r(){r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=Object.create((e&&e.prototype instanceof d?e:d).prototype),a=new M(n||[]);return i(o,"_invoke",{value:A(t,r,a)}),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var f={};function d(){}function p(){}function v(){}var y={};l(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(B([])));m&&m!==e&&n.call(m,a)&&(y=m);var x=v.prototype=d.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function r(i,o,a,s){var c=u(t[i],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function A(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return L()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=u(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function B(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=v,i(x,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:p,configurable:!0}),p.displayName=l(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,l(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},b(w.prototype),l(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new w(h(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(x),l(x,c,"Generator"),l(x,a,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=B,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var s=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(s&&c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===t||"continue"===t)&&e>=o.tryLoc&&o.finallyLoc>=e&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(t,e){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&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:B(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function n(t,e,r,n,i,o,a){try{var s=t[o](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,i)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(i,o){var a=t.apply(e,r);function s(t){n(a,i,o,s,c,"next",t)}function c(t){n(a,i,o,s,c,"throw",t)}s(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o.apply(this,arguments)}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,s(t,e)}function s(t,e){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},s(t,e)}var c="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var t=new c(16);return c!=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 h(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function u(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],f=e[9],d=e[10],p=e[11],v=e[12],y=e[13],g=e[14],m=e[15],x=r[0],b=r[1],w=r[2],A=r[3];return t[0]=x*n+b*s+w*u+A*v,t[1]=x*i+b*c+w*f+A*y,t[2]=x*o+b*l+w*d+A*g,t[3]=x*a+b*h+w*p+A*m,t[4]=(x=r[4])*n+(b=r[5])*s+(w=r[6])*u+(A=r[7])*v,t[5]=x*i+b*c+w*f+A*y,t[6]=x*o+b*l+w*d+A*g,t[7]=x*a+b*h+w*p+A*m,t[8]=(x=r[8])*n+(b=r[9])*s+(w=r[10])*u+(A=r[11])*v,t[9]=x*i+b*c+w*f+A*y,t[10]=x*o+b*l+w*d+A*g,t[11]=x*a+b*h+w*p+A*m,t[12]=(x=r[12])*n+(b=r[13])*s+(w=r[14])*u+(A=r[15])*v,t[13]=x*i+b*c+w*f+A*y,t[14]=x*o+b*l+w*d+A*g,t[15]=x*a+b*h+w*p+A*m,t}function f(t,e,r){var n,i,o,a,s,c,l,h,u,f,d,p,v=r[0],y=r[1],g=r[2];return e===t?(t[12]=e[0]*v+e[4]*y+e[8]*g+e[12],t[13]=e[1]*v+e[5]*y+e[9]*g+e[13],t[14]=e[2]*v+e[6]*y+e[10]*g+e[14],t[15]=e[3]*v+e[7]*y+e[11]*g+e[15]):(i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],f=e[9],d=e[10],p=e[11],t[0]=n=e[0],t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=h,t[8]=u,t[9]=f,t[10]=d,t[11]=p,t[12]=n*v+s*y+u*g+e[12],t[13]=i*v+c*y+f*g+e[13],t[14]=o*v+l*y+d*g+e[14],t[15]=a*v+h*y+p*g+e[15]),t}function d(){var t=new c(3);return c!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function p(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});v=d();var v,y=function(t){return null==t},g={}.toString,m=function(t){return e="String",g.call(t)==="[object "+e+"]";var e},x=function(){function t(t){this.canvasRendererPluginOptions=void 0,this.context=void 0,this.pathGeneratorFactory=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=l(),this.dprMatrix=l(),this.tmpMat4=l(),this.vec3a=d(),this.vec3b=d(),this.vec3c=d(),this.vec3d=d(),this.canvasRendererPluginOptions=t}var n=t.prototype;return n.apply=function(n,o){var a=this;this.context=n;var s=n.config,c=n.camera,l=n.renderingService,h=n.renderingContext,f=n.pathGeneratorFactory;this.rBush=n.rBushRoot,this.pathGeneratorFactory=f;var d=n.contextService,v=h.root.ownerDocument.defaultView,y=function(t){var e=t.target.rBushNode;e.aabb&&a.removedRBushNodeAABBs.push(e.aabb)},g=function(t){var e=t.target.rBushNode;e.aabb&&a.removedRBushNodeAABBs.push(e.aabb)};l.hooks.init.tapPromise(t.tag,i(r().mark((function t(){var n,i,o,c;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:v.addEventListener(e.ElementEvent.UNMOUNTED,y),v.addEventListener(e.ElementEvent.CULLED,g),n=d.getDPR(),i=s.width,o=s.height,c=d.getContext(),a.clearRect(c,0,0,i*n,o*n,s.background);case 6:case"end":return t.stop()}}),t)})))),l.hooks.destroy.tap(t.tag,(function(){v.removeEventListener(e.ElementEvent.UNMOUNTED,y),v.removeEventListener(e.ElementEvent.CULLED,g)})),l.hooks.beginFrame.tap(t.tag,(function(){var t=d.getContext(),e=d.getDPR(),r=s.width,n=s.height,i=a.canvasRendererPluginOptions,o=i.dirtyObjectNumThreshold,c=i.dirtyObjectRatioThreshold,h=l.getStats(),u=h.rendered,f=u/h.total;a.clearFullScreen=l.disableDirtyRectangleRendering()||u>o&&f>c,t&&(t.resetTransform(),a.clearFullScreen&&a.clearRect(t,0,0,r*e,n*e,s.background))}));var m=function t(e,r){e.isVisible()&&!e.isCulled()&&(a.renderDisplayObject(e,r,a.context,a.restoreStack,o),a.saveDirtyAABB(e)),(e.sortable.sorted||e.childNodes).forEach((function(e){t(e,r)}))};l.hooks.endFrame.tap(t.tag,(function(){var t,r,n=d.getContext(),i=d.getDPR();if((t=a.dprMatrix)[0]=(r=[i,i,1])[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=r[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,u(a.vpMatrix,a.dprMatrix,c.getOrthoMatrix()),a.clearFullScreen)m(h.root,n);else{var l=a.safeMergeAABB.apply(a,[a.mergeDirtyAABBs(a.renderQueue)].concat(a.removedRBushNodeAABBs.map((function(t){var r=t.minX,n=t.minY,i=t.maxX,o=t.maxY,a=new e.AABB;return a.setMinMax([r,n,0],[i,o,0]),a}))));if(a.removedRBushNodeAABBs=[],e.AABB.isEmpty(l))return void(a.renderQueue=[]);var f=a.convertAABB2Rect(l),y=f.x,g=f.y,x=f.width,b=f.height,w=p(a.vec3a,[y,g,0],a.vpMatrix),A=p(a.vec3b,[y+x,g,0],a.vpMatrix),E=p(a.vec3c,[y,g+b,0],a.vpMatrix),S=p(a.vec3d,[y+x,g+b,0],a.vpMatrix),O=Math.min(w[0],A[0],S[0],E[0]),M=Math.min(w[1],A[1],S[1],E[1]),B=Math.max(w[0],A[0],S[0],E[0]),L=Math.max(w[1],A[1],S[1],E[1]),P=Math.floor(O),R=Math.floor(M),T=Math.ceil(B-O),N=Math.ceil(L-M);n.save(),a.clearRect(n,P,R,T,N,s.background),n.beginPath(),n.rect(P,R,T,N),n.clip(),n.setTransform(a.vpMatrix[0],a.vpMatrix[1],a.vpMatrix[4],a.vpMatrix[5],a.vpMatrix[12],a.vpMatrix[13]),s.renderer.getConfig().enableDirtyRectangleRenderingDebug&&v.dispatchEvent(new e.CustomEvent(e.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:P,y:R,width:T,height:N}})),a.searchDirtyObjects(o,l).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(t){t&&t.isVisible()&&!t.isCulled()&&a.renderDisplayObject(t,n,a.context,a.restoreStack,o)})),n.restore(),a.renderQueue.forEach((function(t){a.saveDirtyAABB(t)})),a.renderQueue=[]}a.restoreStack.forEach((function(){n.restore()})),a.restoreStack=[]})),l.hooks.render.tap(t.tag,(function(t){a.clearFullScreen||a.renderQueue.push(t)}))},n.clearRect=function(t,e,r,n,i,o){t.clearRect(e,r,n,i),o&&(t.fillStyle=o,t.fillRect(e,r,n,i))},n.renderDisplayObject=function(t,r,n,i,o){var a=t.nodeName,s=i[i.length-1];!s||t.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINS||(r.restore(),i.pop());var c=this.context.styleRendererFactory[a],l=this.pathGeneratorFactory[a],h=t.parsedStyle.clipPath;if(h){this.applyWorldTransform(r,h);var u=this.pathGeneratorFactory[h.nodeName];u&&(r.save(),i.push(t),r.beginPath(),u(r,h.parsedStyle),r.closePath(),r.clip())}c&&(this.applyWorldTransform(r,t),r.save(),this.applyAttributesToContext(r,t)),l&&(r.beginPath(),l(r,t.parsedStyle),t.nodeName!==e.Shape.LINE&&t.nodeName!==e.Shape.PATH&&t.nodeName!==e.Shape.POLYLINE&&r.closePath()),c&&(c.render(r,t.parsedStyle,t,n,this,o),r.restore()),t.renderable.dirty=!1},n.convertAABB2Rect=function(t){var e=t.getMin(),r=t.getMax(),n=Math.floor(e[0]),i=Math.floor(e[1]);return{x:n,y:i,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-i}},n.mergeDirtyAABBs=function(t){var r=new e.AABB;return t.forEach((function(t){var e=t.getRenderBounds();r.add(e);var n=t.renderable.dirtyRenderBounds;n&&r.add(n)})),r},n.searchDirtyObjects=function(t,e){var r=e.getMin(),n=r[0],i=r[1],o=e.getMax();return this.rBush.search({minX:n,minY:i,maxX:o[0],maxY:o[1]}).map((function(e){return t.displayObjectPool.getByEntity(e.id)}))},n.saveDirtyAABB=function(t){var r=t.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new e.AABB);var n=t.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},n.applyAttributesToContext=function(t,e){var r=e.parsedStyle,n=r.stroke,i=r.fill,o=r.opacity,a=r.lineDash,s=r.lineDashOffset;a&&t.setLineDash(a),y(s)||(t.lineDashOffset=s),y(o)||(t.globalAlpha*=o),y(n)||Array.isArray(n)||n.isNone||(t.strokeStyle=e.attributes.stroke),y(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)},n.applyWorldTransform=function(t,e,r){var n=0,i=0,o=(e.parsedStyle||{}).anchor,a=o&&o[0]||0,s=o&&o[1]||0;if(0!==a||0!==s){var c=e.geometry.contentBounds;n=-a*(c&&2*c.halfExtents[0]||0),i=-s*(c&&2*c.halfExtents[1]||0)}r?(h(this.tmpMat4,e.getLocalTransform()),this.vec3a[0]=n,this.vec3a[1]=i,this.vec3a[2]=0,f(this.tmpMat4,this.tmpMat4,this.vec3a),u(this.tmpMat4,r,this.tmpMat4),u(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(h(this.tmpMat4,e.getWorldTransform()),this.vec3a[0]=n,this.vec3a[1]=i,this.vec3a[2]=0,f(this.tmpMat4,this.tmpMat4,this.vec3a),u(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},n.safeMergeAABB=function(){for(var t=new e.AABB,r=arguments.length,n=Array(r),i=0;r>i;i++)n[i]=arguments[i];return n.forEach((function(e){t.add(e)})),t},t}();x.tag="CanvasRenderer";var b=function(){function t(t){this.imagePool=void 0,this.imagePool=t}var r=t.prototype;return r.render=function(t,r,n,i,o,a){var s=r.fill,c=r.fillRule,l=r.opacity,h=r.fillOpacity,u=r.stroke,f=r.strokeOpacity,d=r.lineWidth,p=r.lineCap,v=r.lineJoin,g=r.shadowType,m=r.shadowColor,x=r.shadowBlur,b=r.filter,A=r.miterLimit,E=!y(s)&&!s.isNone,S=!y(u)&&!u.isNone&&d>0,O=0===s.alpha,M=!(!b||!b.length),B=!y(m)&&x>0,L=n.nodeName,P="inner"===g,R=S&&B&&(L===e.Shape.PATH||L===e.Shape.LINE||L===e.Shape.POLYLINE||O||P);E&&(t.globalAlpha=l*h,R||w(n,t,B),this.fill(t,n,s,c,i,o,a),R||this.clearShadowAndFilter(t,M,B)),S&&(t.globalAlpha=l*f,t.lineWidth=d,y(A)||(t.miterLimit=A),y(p)||(t.lineCap=p),y(v)||(t.lineJoin=v),R&&(P&&(t.globalCompositeOperation="source-atop"),w(n,t,!0),P&&(this.stroke(t,n,u,i,o,a),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,M,!0))),this.stroke(t,n,u,i,o,a))},r.clearShadowAndFilter=function(t,e,r){if(r&&(t.shadowColor="transparent",t.shadowBlur=0),e){var n=t.filter;!y(n)&&n.indexOf("drop-shadow")>-1&&(t.filter=n.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},r.fill=function(t,r,n,i,o,a,s){var c=this;Array.isArray(n)?n.forEach((function(e){t.fillStyle=c.getColor(e,r,t),t.fill(i)})):(e.isPattern(n)&&(t.fillStyle=this.getPattern(n,r,t,o,a,s)),t.fill(i))},r.stroke=function(t,r,n,i,o,a){var s=this;Array.isArray(n)?n.forEach((function(e){t.strokeStyle=s.getColor(e,r,t),t.stroke()})):(e.isPattern(n)&&(t.strokeStyle=this.getPattern(n,r,t,i,o,a)),t.stroke())},r.getPattern=function(t,e,r,n,i,o){var a,s;if("rect"===t.image.nodeName){var c=t.image.parsedStyle,l=c.width,h=c.height;s=n.contextService.getDPR();var u=n.config.offscreenCanvas;(a=o.offscreenCanvas.getOrCreateCanvas(u)).width=l*s,a.height=h*s;var f=o.offscreenCanvas.getOrCreateContext(u),d=[];t.image.forEach((function(t){i.renderDisplayObject(t,f,n,d,o)})),d.forEach((function(){f.restore()}))}return this.imagePool.getOrCreatePatternSync(t,r,a,s,(function(){e.renderable.dirty=!0,n.renderingService.dirtify()}))},r.getColor=function(t,r,n){var i;if(t.type===e.GradientType.LinearGradient||t.type===e.GradientType.RadialGradient){var a=r.getGeometryBounds();i=this.imagePool.getOrCreateGradient(o({type:t.type},t.value,{width:a&&2*a.halfExtents[0]||1,height:a&&2*a.halfExtents[1]||1}),n)}return i},t}();function w(t,e,r){var n=t.parsedStyle,i=n.filter,o=n.shadowColor,a=n.shadowBlur,s=n.shadowOffsetX,c=n.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),r&&(e.shadowColor=""+o,e.shadowBlur=a||0,e.shadowOffsetX=s||0,e.shadowOffsetY=c||0)}var A=function(){function t(t){this.imagePool=void 0,this.imagePool=t}return t.prototype.render=function(t,e,r){var n,i=e.img,o=e.shadowColor,a=e.shadowBlur,s=e.width,c=e.height;if(m(i)?n=this.imagePool.getImageSync(i):(s||(s=i.width),c||(c=i.height),n=i),n){w(r,t,!y(o)&&a>0);try{t.drawImage(n,0,0,s,c)}catch(t){}}},t}(),E=function(){function t(){}var r=t.prototype;return r.render=function(t,r,n){var i=r.lineWidth,o=r.textAlign,a=r.textBaseline,s=r.lineJoin,c=r.miterLimit,l=r.letterSpacing,h=r.stroke,u=r.fill,f=r.fillOpacity,d=r.strokeOpacity,p=r.opacity,v=r.metrics,g=r.dx,m=r.dy,x=r.shadowColor,b=r.shadowBlur,A=v.lines,E=v.height,S=v.lineHeight,O=v.lineMetrics;t.font=v.font,t.lineWidth=i,t.textAlign="middle"===o?"center":o;var M=a;("bottom"===M||!e.runtime.enableCSSParsing&&"alphabetic"===M)&&(M="ideographic"),t.textBaseline=M,t.lineJoin=s,y(c)||(t.miterLimit=c);var B=0;"middle"===a?B=-E/2-S/2:"bottom"===a||"alphabetic"===a||"ideographic"===a?B=-E:"top"!==a&&"hanging"!==a||(B=-S);var L=g||0;B+=m||0,w(n,t,!y(x)&&b>0);for(var P=0;A.length>P;P++){var R=i/2+L;B+=S,y(h)||h.isNone||!i||this.drawLetterSpacing(t,A[P],O[P],o,R,B,l,f,d,p,!0),y(u)||this.drawLetterSpacing(t,A[P],O[P],o,R,B,l,f,d,p)}},r.drawLetterSpacing=function(t,e,r,n,i,o,a,s,c,l,h){if(void 0===h&&(h=!1),0!==a){var u=t.textAlign;t.textAlign="left";var f=i;"center"===n||"middle"===n?f=i-r.width/2:"right"!==n&&"end"!==n||(f=i-r.width);for(var d=Array.from(e),p=t.measureText(e).width,v=0,y=0;d.length>y;++y){var g=d[y];h?this.strokeText(t,g,f,o,c):this.fillText(t,g,f,o,s,l),f+=p-(v=t.measureText(e.substring(y+1)).width)+a,p=v}t.textAlign=u}else h?this.strokeText(t,e,i,o,c):this.fillText(t,e,i,o,s,l)},r.fillText=function(t,e,r,n,i,o){var a,s=!y(i)&&1!==i;s&&(a=t.globalAlpha,t.globalAlpha=i*o),t.fillText(e,r,n),s&&(t.globalAlpha=a)},r.strokeText=function(t,e,r,n,i){var o,a=!y(i)&&1!==i;a&&(o=t.globalAlpha,t.globalAlpha=i),t.strokeText(e,r,n),a&&(t.globalAlpha=o)},t}(),S=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),O=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),M=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),B=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),L=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),P=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),R=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),T=function(t){function r(e){var r;return void 0===e&&(e={}),(r=t.call(this)||this).options=void 0,r.name="canvas-renderer",r.options=e,r}a(r,t);var n=r.prototype;return n.init=function(){var t,r=o({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,i=new b(n),a=((t={})[e.Shape.CIRCLE]=i,t[e.Shape.ELLIPSE]=i,t[e.Shape.RECT]=i,t[e.Shape.IMAGE]=new A(n),t[e.Shape.TEXT]=new E,t[e.Shape.LINE]=i,t[e.Shape.POLYLINE]=i,t[e.Shape.POLYGON]=i,t[e.Shape.PATH]=i,t[e.Shape.GROUP]=void 0,t[e.Shape.HTML]=void 0,t[e.Shape.MESH]=void 0,t);this.context.defaultStyleRendererFactory=a,this.context.styleRendererFactory=a,this.addRenderingPlugin(new x(r))},n.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},r}(e.AbstractRendererPlugin);t.CircleRenderer=O,t.EllipseRenderer=M,t.ImageRenderer=A,t.LineRenderer=B,t.PathRenderer=R,t.Plugin=T,t.PolygonRenderer=P,t.PolylineRenderer=L,t.RectRenderer=S,t.TextRenderer=E,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@antv/g-lite")):"function"==typeof define&&define.amd?define(["exports","@antv/g-lite"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.CanvasRenderer={}),t.window.G)}(this,(function(t,e){"use strict";function r(){r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=Object.create((e&&e.prototype instanceof d?e:d).prototype),a=new M(n||[]);return i(o,"_invoke",{value:A(t,r,a)}),o}function u(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var f={};function d(){}function p(){}function v(){}var y={};l(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(B([])));m&&m!==e&&n.call(m,a)&&(y=m);var x=v.prototype=d.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function r(i,o,a,s){var c=u(t[i],t,o);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,s)}))}s(c.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function A(t,e,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return L()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=u(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function B(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=v,i(x,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:p,configurable:!0}),p.displayName=l(v,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,l(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},b(w.prototype),l(w.prototype,s,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new w(h(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(x),l(x,c,"Generator"),l(x,a,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=B,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(this.prev>=o.tryLoc){var s=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(s&&c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(this.prev>=i.tryLoc&&n.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===t||"continue"===t)&&e>=o.tryLoc&&o.finallyLoc>=e&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(t,e){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&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;O(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:B(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function n(t,e,r,n,i,o,a){try{var s=t[o](a),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,i)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(i,o){var a=t.apply(e,r);function s(t){n(a,i,o,s,c,"next",t)}function c(t){n(a,i,o,s,c,"throw",t)}s(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o.apply(this,arguments)}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,s(t,e)}function s(t,e){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},s(t,e)}var c="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var t=new c(16);return c!=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 h(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function u(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],f=e[9],d=e[10],p=e[11],v=e[12],y=e[13],g=e[14],m=e[15],x=r[0],b=r[1],w=r[2],A=r[3];return t[0]=x*n+b*s+w*u+A*v,t[1]=x*i+b*c+w*f+A*y,t[2]=x*o+b*l+w*d+A*g,t[3]=x*a+b*h+w*p+A*m,t[4]=(x=r[4])*n+(b=r[5])*s+(w=r[6])*u+(A=r[7])*v,t[5]=x*i+b*c+w*f+A*y,t[6]=x*o+b*l+w*d+A*g,t[7]=x*a+b*h+w*p+A*m,t[8]=(x=r[8])*n+(b=r[9])*s+(w=r[10])*u+(A=r[11])*v,t[9]=x*i+b*c+w*f+A*y,t[10]=x*o+b*l+w*d+A*g,t[11]=x*a+b*h+w*p+A*m,t[12]=(x=r[12])*n+(b=r[13])*s+(w=r[14])*u+(A=r[15])*v,t[13]=x*i+b*c+w*f+A*y,t[14]=x*o+b*l+w*d+A*g,t[15]=x*a+b*h+w*p+A*m,t}function f(t,e,r){var n,i,o,a,s,c,l,h,u,f,d,p,v=r[0],y=r[1],g=r[2];return e===t?(t[12]=e[0]*v+e[4]*y+e[8]*g+e[12],t[13]=e[1]*v+e[5]*y+e[9]*g+e[13],t[14]=e[2]*v+e[6]*y+e[10]*g+e[14],t[15]=e[3]*v+e[7]*y+e[11]*g+e[15]):(i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],l=e[6],h=e[7],u=e[8],f=e[9],d=e[10],p=e[11],t[0]=n=e[0],t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=h,t[8]=u,t[9]=f,t[10]=d,t[11]=p,t[12]=n*v+s*y+u*g+e[12],t[13]=i*v+c*y+f*g+e[13],t[14]=o*v+l*y+d*g+e[14],t[15]=a*v+h*y+p*g+e[15]),t}function d(){var t=new c(3);return c!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function p(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});v=d();var v,y=function(t){return null==t},g={}.toString,m=function(t){return e="String",g.call(t)==="[object "+e+"]";var e},x=function(){function t(t){this.canvasRendererPluginOptions=void 0,this.context=void 0,this.pathGeneratorFactory=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=l(),this.dprMatrix=l(),this.tmpMat4=l(),this.vec3a=d(),this.vec3b=d(),this.vec3c=d(),this.vec3d=d(),this.canvasRendererPluginOptions=t}var n=t.prototype;return n.apply=function(n,o){var a=this;this.context=n;var s=n.config,c=n.camera,l=n.renderingService,h=n.renderingContext,f=n.pathGeneratorFactory;this.rBush=n.rBushRoot,this.pathGeneratorFactory=f;var d=n.contextService,v=h.root.ownerDocument.defaultView,y=function(t){var e=t.target.rBushNode;e.aabb&&a.removedRBushNodeAABBs.push(e.aabb)},g=function(t){var e=t.target.rBushNode;e.aabb&&a.removedRBushNodeAABBs.push(e.aabb)};l.hooks.init.tapPromise(t.tag,i(r().mark((function t(){var n,i,o,c;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:v.addEventListener(e.ElementEvent.UNMOUNTED,y),v.addEventListener(e.ElementEvent.CULLED,g),n=d.getDPR(),i=s.width,o=s.height,c=d.getContext(),a.clearRect(c,0,0,i*n,o*n,s.background);case 6:case"end":return t.stop()}}),t)})))),l.hooks.destroy.tap(t.tag,(function(){v.removeEventListener(e.ElementEvent.UNMOUNTED,y),v.removeEventListener(e.ElementEvent.CULLED,g)})),l.hooks.beginFrame.tap(t.tag,(function(){var t=d.getContext(),e=d.getDPR(),r=s.width,n=s.height,i=a.canvasRendererPluginOptions,o=i.dirtyObjectNumThreshold,c=i.dirtyObjectRatioThreshold,h=l.getStats(),u=h.rendered,f=u/h.total;a.clearFullScreen=l.disableDirtyRectangleRendering()||u>o&&f>c,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),a.clearFullScreen&&a.clearRect(t,0,0,r*e,n*e,s.background))}));var m=function t(e,r){e.isVisible()&&!e.isCulled()&&(a.renderDisplayObject(e,r,a.context,a.restoreStack,o),a.saveDirtyAABB(e)),(e.sortable.sorted||e.childNodes).forEach((function(e){t(e,r)}))};l.hooks.endFrame.tap(t.tag,(function(){var t,r,n=d.getContext(),i=d.getDPR();if((t=a.dprMatrix)[0]=(r=[i,i,1])[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=r[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,u(a.vpMatrix,a.dprMatrix,c.getOrthoMatrix()),a.clearFullScreen)m(h.root,n);else{var l=a.safeMergeAABB.apply(a,[a.mergeDirtyAABBs(a.renderQueue)].concat(a.removedRBushNodeAABBs.map((function(t){var r=t.minX,n=t.minY,i=t.maxX,o=t.maxY,a=new e.AABB;return a.setMinMax([r,n,0],[i,o,0]),a}))));if(a.removedRBushNodeAABBs=[],e.AABB.isEmpty(l))return void(a.renderQueue=[]);var f=a.convertAABB2Rect(l),y=f.x,g=f.y,x=f.width,b=f.height,w=p(a.vec3a,[y,g,0],a.vpMatrix),A=p(a.vec3b,[y+x,g,0],a.vpMatrix),E=p(a.vec3c,[y,g+b,0],a.vpMatrix),S=p(a.vec3d,[y+x,g+b,0],a.vpMatrix),O=Math.min(w[0],A[0],S[0],E[0]),M=Math.min(w[1],A[1],S[1],E[1]),B=Math.max(w[0],A[0],S[0],E[0]),L=Math.max(w[1],A[1],S[1],E[1]),P=Math.floor(O),R=Math.floor(M),T=Math.ceil(B-O),N=Math.ceil(L-M);n.save(),a.clearRect(n,P,R,T,N,s.background),n.beginPath(),n.rect(P,R,T,N),n.clip(),n.setTransform(a.vpMatrix[0],a.vpMatrix[1],a.vpMatrix[4],a.vpMatrix[5],a.vpMatrix[12],a.vpMatrix[13]),s.renderer.getConfig().enableDirtyRectangleRenderingDebug&&v.dispatchEvent(new e.CustomEvent(e.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:{x:P,y:R,width:T,height:N}})),a.searchDirtyObjects(o,l).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(t){t&&t.isVisible()&&!t.isCulled()&&a.renderDisplayObject(t,n,a.context,a.restoreStack,o)})),n.restore(),a.renderQueue.forEach((function(t){a.saveDirtyAABB(t)})),a.renderQueue=[]}a.restoreStack.forEach((function(){n.restore()})),a.restoreStack=[]})),l.hooks.render.tap(t.tag,(function(t){a.clearFullScreen||a.renderQueue.push(t)}))},n.clearRect=function(t,e,r,n,i,o){t.clearRect(e,r,n,i),o&&(t.fillStyle=o,t.fillRect(e,r,n,i))},n.renderDisplayObject=function(t,r,n,i,o){var a=t.nodeName,s=i[i.length-1];!s||t.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINS||(r.restore(),i.pop());var c=this.context.styleRendererFactory[a],l=this.pathGeneratorFactory[a],h=t.parsedStyle.clipPath;if(h){this.applyWorldTransform(r,h);var u=this.pathGeneratorFactory[h.nodeName];u&&(r.save(),i.push(t),r.beginPath(),u(r,h.parsedStyle),r.closePath(),r.clip())}c&&(this.applyWorldTransform(r,t),r.save(),this.applyAttributesToContext(r,t)),l&&(r.beginPath(),l(r,t.parsedStyle),t.nodeName!==e.Shape.LINE&&t.nodeName!==e.Shape.PATH&&t.nodeName!==e.Shape.POLYLINE&&r.closePath()),c&&(c.render(r,t.parsedStyle,t,n,this,o),r.restore()),t.renderable.dirty=!1},n.convertAABB2Rect=function(t){var e=t.getMin(),r=t.getMax(),n=Math.floor(e[0]),i=Math.floor(e[1]);return{x:n,y:i,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-i}},n.mergeDirtyAABBs=function(t){var r=new e.AABB;return t.forEach((function(t){var e=t.getRenderBounds();r.add(e);var n=t.renderable.dirtyRenderBounds;n&&r.add(n)})),r},n.searchDirtyObjects=function(t,e){var r=e.getMin(),n=r[0],i=r[1],o=e.getMax();return this.rBush.search({minX:n,minY:i,maxX:o[0],maxY:o[1]}).map((function(e){return t.displayObjectPool.getByEntity(e.id)}))},n.saveDirtyAABB=function(t){var r=t.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new e.AABB);var n=t.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},n.applyAttributesToContext=function(t,e){var r=e.parsedStyle,n=r.stroke,i=r.fill,o=r.opacity,a=r.lineDash,s=r.lineDashOffset;a&&t.setLineDash(a),y(s)||(t.lineDashOffset=s),y(o)||(t.globalAlpha*=o),y(n)||Array.isArray(n)||n.isNone||(t.strokeStyle=e.attributes.stroke),y(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)},n.applyWorldTransform=function(t,e,r){var n=0,i=0,o=(e.parsedStyle||{}).anchor,a=o&&o[0]||0,s=o&&o[1]||0;if(0!==a||0!==s){var c=e.geometry.contentBounds;n=-a*(c&&2*c.halfExtents[0]||0),i=-s*(c&&2*c.halfExtents[1]||0)}r?(h(this.tmpMat4,e.getLocalTransform()),this.vec3a[0]=n,this.vec3a[1]=i,this.vec3a[2]=0,f(this.tmpMat4,this.tmpMat4,this.vec3a),u(this.tmpMat4,r,this.tmpMat4),u(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(h(this.tmpMat4,e.getWorldTransform()),this.vec3a[0]=n,this.vec3a[1]=i,this.vec3a[2]=0,f(this.tmpMat4,this.tmpMat4,this.vec3a),u(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},n.safeMergeAABB=function(){for(var t=new e.AABB,r=arguments.length,n=Array(r),i=0;r>i;i++)n[i]=arguments[i];return n.forEach((function(e){t.add(e)})),t},t}();x.tag="CanvasRenderer";var b=function(){function t(t){this.imagePool=void 0,this.imagePool=t}var r=t.prototype;return r.render=function(t,r,n,i,o,a){var s=r.fill,c=r.fillRule,l=r.opacity,h=r.fillOpacity,u=r.stroke,f=r.strokeOpacity,d=r.lineWidth,p=r.lineCap,v=r.lineJoin,g=r.shadowType,m=r.shadowColor,x=r.shadowBlur,b=r.filter,A=r.miterLimit,E=!y(s)&&!s.isNone,S=!y(u)&&!u.isNone&&d>0,O=0===s.alpha,M=!(!b||!b.length),B=!y(m)&&x>0,L=n.nodeName,P="inner"===g,R=S&&B&&(L===e.Shape.PATH||L===e.Shape.LINE||L===e.Shape.POLYLINE||O||P);E&&(t.globalAlpha=l*h,R||w(n,t,B),this.fill(t,n,s,c,i,o,a),R||this.clearShadowAndFilter(t,M,B)),S&&(t.globalAlpha=l*f,t.lineWidth=d,y(A)||(t.miterLimit=A),y(p)||(t.lineCap=p),y(v)||(t.lineJoin=v),R&&(P&&(t.globalCompositeOperation="source-atop"),w(n,t,!0),P&&(this.stroke(t,n,u,i,o,a),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,M,!0))),this.stroke(t,n,u,i,o,a))},r.clearShadowAndFilter=function(t,e,r){if(r&&(t.shadowColor="transparent",t.shadowBlur=0),e){var n=t.filter;!y(n)&&n.indexOf("drop-shadow")>-1&&(t.filter=n.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},r.fill=function(t,r,n,i,o,a,s){var c=this;Array.isArray(n)?n.forEach((function(e){t.fillStyle=c.getColor(e,r,t),i?t.fill(i):t.fill()})):(e.isPattern(n)&&(t.fillStyle=this.getPattern(n,r,t,o,a,s)),i?t.fill(i):t.fill())},r.stroke=function(t,r,n,i,o,a){var s=this;Array.isArray(n)?n.forEach((function(e){t.strokeStyle=s.getColor(e,r,t),t.stroke()})):(e.isPattern(n)&&(t.strokeStyle=this.getPattern(n,r,t,i,o,a)),t.stroke())},r.getPattern=function(t,e,r,n,i,o){var a,s;if("rect"===t.image.nodeName){var c=t.image.parsedStyle,l=c.width,h=c.height;s=n.contextService.getDPR();var u=n.config.offscreenCanvas;(a=o.offscreenCanvas.getOrCreateCanvas(u)).width=l*s,a.height=h*s;var f=o.offscreenCanvas.getOrCreateContext(u),d=[];t.image.forEach((function(t){i.renderDisplayObject(t,f,n,d,o)})),d.forEach((function(){f.restore()}))}return this.imagePool.getOrCreatePatternSync(t,r,a,s,(function(){e.renderable.dirty=!0,n.renderingService.dirtify()}))},r.getColor=function(t,r,n){var i;if(t.type===e.GradientType.LinearGradient||t.type===e.GradientType.RadialGradient){var a=r.getGeometryBounds();i=this.imagePool.getOrCreateGradient(o({type:t.type},t.value,{width:a&&2*a.halfExtents[0]||1,height:a&&2*a.halfExtents[1]||1}),n)}return i},t}();function w(t,e,r){var n=t.parsedStyle,i=n.filter,o=n.shadowColor,a=n.shadowBlur,s=n.shadowOffsetX,c=n.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),r&&(e.shadowColor=""+o,e.shadowBlur=a||0,e.shadowOffsetX=s||0,e.shadowOffsetY=c||0)}var A=function(){function t(t){this.imagePool=void 0,this.imagePool=t}return t.prototype.render=function(t,e,r){var n,i=e.img,o=e.shadowColor,a=e.shadowBlur,s=e.width,c=e.height;if(m(i)?n=this.imagePool.getImageSync(i):(s||(s=i.width),c||(c=i.height),n=i),n){w(r,t,!y(o)&&a>0);try{t.drawImage(n,0,0,s,c)}catch(t){}}},t}(),E=function(){function t(){}var r=t.prototype;return r.render=function(t,r,n){var i=r.lineWidth,o=r.textAlign,a=r.textBaseline,s=r.lineJoin,c=r.miterLimit,l=r.letterSpacing,h=r.stroke,u=r.fill,f=r.fillOpacity,d=r.strokeOpacity,p=r.opacity,v=r.metrics,g=r.dx,m=r.dy,x=r.shadowColor,b=r.shadowBlur,A=v.lines,E=v.height,S=v.lineHeight,O=v.lineMetrics;t.font=v.font,t.lineWidth=i,t.textAlign="middle"===o?"center":o;var M=a;e.runtime.enableCSSParsing||"alphabetic"!==M||(M="bottom"),t.lineJoin=s,y(c)||(t.miterLimit=c);var B=0;"middle"===a?B=-E/2-S/2:"bottom"===a||"alphabetic"===a||"ideographic"===a?B=-E:"top"!==a&&"hanging"!==a||(B=-S);var L=g||0;B+=m||0,1===A.length&&("bottom"===M?(M="middle",B-=.5*E):"top"===M&&(M="middle",B+=.5*E)),t.textBaseline=M,w(n,t,!y(x)&&b>0);for(var P=0;A.length>P;P++){var R=i/2+L;B+=S,y(h)||h.isNone||!i||this.drawLetterSpacing(t,A[P],O[P],o,R,B,l,f,d,p,!0),y(u)||this.drawLetterSpacing(t,A[P],O[P],o,R,B,l,f,d,p)}},r.drawLetterSpacing=function(t,e,r,n,i,o,a,s,c,l,h){if(void 0===h&&(h=!1),0!==a){var u=t.textAlign;t.textAlign="left";var f=i;"center"===n||"middle"===n?f=i-r.width/2:"right"!==n&&"end"!==n||(f=i-r.width);for(var d=Array.from(e),p=t.measureText(e).width,v=0,y=0;d.length>y;++y){var g=d[y];h?this.strokeText(t,g,f,o,c):this.fillText(t,g,f,o,s,l),f+=p-(v=t.measureText(e.substring(y+1)).width)+a,p=v}t.textAlign=u}else h?this.strokeText(t,e,i,o,c):this.fillText(t,e,i,o,s,l)},r.fillText=function(t,e,r,n,i,o){var a,s=!y(i)&&1!==i;s&&(a=t.globalAlpha,t.globalAlpha=i*o),t.fillText(e,r,n),s&&(t.globalAlpha=a)},r.strokeText=function(t,e,r,n,i){var o,a=!y(i)&&1!==i;a&&(o=t.globalAlpha,t.globalAlpha=i),t.strokeText(e,r,n),a&&(t.globalAlpha=o)},t}(),S=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),O=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),M=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),B=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),L=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),P=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),R=function(t){function e(){return t.apply(this,arguments)||this}return a(e,t),e}(b),T=function(t){function r(e){var r;return void 0===e&&(e={}),(r=t.call(this)||this).options=void 0,r.name="canvas-renderer",r.options=e,r}a(r,t);var n=r.prototype;return n.init=function(){var t,r=o({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,i=new b(n),a=((t={})[e.Shape.CIRCLE]=i,t[e.Shape.ELLIPSE]=i,t[e.Shape.RECT]=i,t[e.Shape.IMAGE]=new A(n),t[e.Shape.TEXT]=new E,t[e.Shape.LINE]=i,t[e.Shape.POLYLINE]=i,t[e.Shape.POLYGON]=i,t[e.Shape.PATH]=i,t[e.Shape.GROUP]=void 0,t[e.Shape.HTML]=void 0,t[e.Shape.MESH]=void 0,t);this.context.defaultStyleRendererFactory=a,this.context.styleRendererFactory=a,this.addRenderingPlugin(new x(r))},n.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},r}(e.AbstractRendererPlugin);t.CircleRenderer=O,t.EllipseRenderer=M,t.ImageRenderer=A,t.LineRenderer=B,t.PathRenderer=R,t.Plugin=T,t.PolygonRenderer=P,t.PolylineRenderer=L,t.RectRenderer=S,t.TextRenderer=E,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "@antv/g-plugin-canvas-renderer",
"version": "1.7.50",
"version": "1.7.51",
"description": "A G plugin of renderer implementation with Canvas2D API",

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

},
"gitHead": "cf6cddcd0097fae6df3ae3de1f2c2c53a20e84b0"
"gitHead": "b2e4714cc7ef7b72b6de2fe6965e0b913b05acf0"
}

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