@antv/g-plugin-canvas-renderer
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -1,2 +0,2 @@ | ||
import { RenderingPlugin, RenderingService } from '@antv/g'; | ||
import type { RenderingPlugin, RenderingService } from '@antv/g'; | ||
/** | ||
@@ -3,0 +3,0 @@ * support 2 modes in rendering: |
@@ -1,2 +0,2 @@ | ||
import { Syringe, isString, inject, singleton, UnitType, isNil, isPattern, GradientType, CanvasConfig, DefaultCamera, Camera, ContextService, RenderingContext, DisplayObjectPool, RBushRoot, RBush, RenderingPluginContribution, ElementEvent, AABB, CustomEvent, CanvasEvent, Shape, Module, AbstractRendererPlugin } from '@antv/g'; | ||
import { Syringe, isString, inject, singleton, isNil, UnitType, Shape, isPattern, GradientType, CanvasConfig, DefaultCamera, Camera, ContextService, RenderingContext, DisplayObjectPool, RBushRoot, RBush, RenderingPluginContribution, ElementEvent, AABB, CustomEvent, CanvasEvent, Module, AbstractRendererPlugin } from '@antv/g'; | ||
import { __decorate, __metadata } from 'tslib'; | ||
@@ -831,6 +831,4 @@ import { PathGeneratorFactory } from '@antv/g-plugin-canvas-path-generator'; | ||
lineJoin = parsedStyle.lineJoin, | ||
_parsedStyle$miterLim = parsedStyle.miterLimit, | ||
miterLimit = _parsedStyle$miterLim === void 0 ? 0 : _parsedStyle$miterLim, | ||
_parsedStyle$letterSp = parsedStyle.letterSpacing, | ||
letterSpacing = _parsedStyle$letterSp === void 0 ? 0 : _parsedStyle$letterSp, | ||
miterLimit = parsedStyle.miterLimit, | ||
letterSpacing = parsedStyle.letterSpacing, | ||
stroke = parsedStyle.stroke, | ||
@@ -854,3 +852,7 @@ fill = parsedStyle.fill, | ||
context.lineJoin = lineJoin.value; | ||
context.miterLimit = miterLimit; | ||
if (!isNil(miterLimit)) { | ||
context.miterLimit = miterLimit.value; | ||
} | ||
var linePositionY = 0; // handle vertical text baseline | ||
@@ -884,7 +886,7 @@ | ||
if (!isNil(stroke) && !stroke.isNone && lineWidth && lineWidth.value) { | ||
this.drawLetterSpacing(context, lines[i], lineMetrics[i], textAlign.value, linePositionX, linePositionY, letterSpacing, fillOpacity.value, strokeOpacity.value, opacity.value, true); | ||
this.drawLetterSpacing(context, lines[i], lineMetrics[i], textAlign.value, linePositionX, linePositionY, letterSpacing.value, fillOpacity.value, strokeOpacity.value, opacity.value, true); | ||
} | ||
if (!isNil(fill)) { | ||
this.drawLetterSpacing(context, lines[i], lineMetrics[i], textAlign.value, linePositionX, linePositionY, letterSpacing, fillOpacity.value, strokeOpacity.value, opacity.value); | ||
this.drawLetterSpacing(context, lines[i], lineMetrics[i], textAlign.value, linePositionX, linePositionY, letterSpacing.value, fillOpacity.value, strokeOpacity.value, opacity.value); | ||
} | ||
@@ -997,89 +999,102 @@ } | ||
lineJoin = parsedStyle.lineJoin, | ||
shadowType = parsedStyle.shadowType, | ||
shadowColor = parsedStyle.shadowColor, | ||
shadowBlur = parsedStyle.shadowBlur, | ||
filter = parsedStyle.filter, | ||
miterLimit = parsedStyle.miterLimit; | ||
var hasFill = !isNil(fill) && !fill.isNone; | ||
var hasStroke = !isNil(stroke) && !stroke.isNone; | ||
var hasStroke = !isNil(stroke) && !stroke.isNone && lineWidth && lineWidth.value > 0; | ||
var isFillTransparent = fill.alpha === 0; | ||
var hasFilter = !isNil(filter); | ||
var hasShadow = !isNil(shadowColor) && (shadowBlur === null || shadowBlur === void 0 ? void 0 : shadowBlur.value) > 0; | ||
var nodeName = object.nodeName; | ||
var isInnerShadow = (shadowType === null || shadowType === void 0 ? void 0 : shadowType.value) === 'inner'; | ||
var shouldDrawShadowWithStroke = hasStroke && hasShadow && (nodeName === Shape.PATH || nodeName === Shape.LINE || nodeName === Shape.POLYLINE || isFillTransparent || isInnerShadow); | ||
if (hasFill) { | ||
if (!isNil(fillOpacity) && fillOpacity.value !== 1) { | ||
context.globalAlpha = fillOpacity.value; | ||
this.fill(context, object, fill, renderingService); | ||
context.globalAlpha = opacity.value; | ||
} else { | ||
this.fill(context, object, fill, renderingService); | ||
context.globalAlpha = opacity.value * fillOpacity.value; | ||
if (!shouldDrawShadowWithStroke) { | ||
this.setShadowAndFilter(object, context, hasShadow); | ||
} | ||
this.fill(context, object, fill, renderingService); | ||
if (!shouldDrawShadowWithStroke) { | ||
this.clearShadowAndFilter(context, hasFilter, hasShadow); | ||
} | ||
} | ||
if (hasStroke) { | ||
if (lineWidth && lineWidth.value > 0) { | ||
var applyOpacity = !isNil(strokeOpacity) && strokeOpacity.value !== 1; | ||
context.globalAlpha = opacity.value * strokeOpacity.value; | ||
context.lineWidth = lineWidth.value; | ||
if (applyOpacity) { | ||
context.globalAlpha = strokeOpacity.value; | ||
} | ||
if (!isNil(miterLimit)) { | ||
context.miterLimit = miterLimit.value; | ||
} | ||
context.lineWidth = lineWidth.value; | ||
if (!isNil(lineCap)) { | ||
context.lineCap = lineCap.value; | ||
} | ||
if (!isNil(miterLimit)) { | ||
context.miterLimit = miterLimit; | ||
} | ||
if (!isNil(lineJoin)) { | ||
context.lineJoin = lineJoin.value; | ||
} | ||
if (!isNil(lineCap)) { | ||
context.lineCap = lineCap.value; | ||
if (shouldDrawShadowWithStroke) { | ||
if (isInnerShadow) { | ||
context.globalCompositeOperation = 'source-atop'; | ||
} | ||
if (!isNil(lineJoin)) { | ||
context.lineJoin = lineJoin.value; | ||
} | ||
this.setShadowAndFilter(object, context, true); | ||
var oldShadowBlur; | ||
var oldShadowColor; | ||
var oldFilter; | ||
var hasShadowColor = !isNil(shadowColor); | ||
var hasFilter = !isNil(filter); | ||
if (hasShadowColor) { | ||
// prevent inner shadow when drawing stroke, toggle shadowBlur & filter(drop-shadow) | ||
// save shadow blur | ||
oldShadowBlur = context.shadowBlur; | ||
oldShadowColor = context.shadowColor; | ||
if (!isNil(oldShadowBlur)) { | ||
context.shadowColor = 'transparent'; | ||
context.shadowBlur = 0; | ||
} | ||
if (isInnerShadow) { | ||
this.stroke(context, object, stroke, renderingService); | ||
context.globalCompositeOperation = 'source-over'; | ||
this.clearShadowAndFilter(context, hasFilter, true); | ||
} | ||
} | ||
if (hasFilter) { | ||
// save drop-shadow filter | ||
oldFilter = context.filter; | ||
this.stroke(context, object, stroke, renderingService); | ||
} | ||
}; | ||
if (!isNil(oldFilter) && oldFilter.indexOf('drop-shadow') > -1) { | ||
context.filter = oldFilter.replace(/drop-shadow\([^)]*\)/, '').trim() || 'none'; | ||
} | ||
} | ||
_proto.clearShadowAndFilter = function clearShadowAndFilter(context, hasFilter, hasShadow) { | ||
if (hasShadow) { | ||
context.shadowColor = 'transparent'; | ||
context.shadowBlur = 0; | ||
} | ||
var drawStroke = hasFill && !isFillTransparent; | ||
if (hasFilter) { | ||
// save drop-shadow filter | ||
var oldFilter = context.filter; | ||
if (drawStroke) { | ||
this.stroke(context, object, stroke, renderingService); | ||
} // restore shadow blur | ||
if (!isNil(oldFilter) && oldFilter.indexOf('drop-shadow') > -1) { | ||
context.filter = oldFilter.replace(/drop-shadow\([^)]*\)/, '').trim() || 'none'; | ||
} | ||
} | ||
} | ||
/** | ||
* apply before fill and stroke but only once | ||
*/ | ||
; | ||
_proto.setShadowAndFilter = function setShadowAndFilter(object, context, hasShadow) { | ||
var _object$parsedStyle = object.parsedStyle, | ||
filter = _object$parsedStyle.filter, | ||
shadowColor = _object$parsedStyle.shadowColor, | ||
shadowBlur = _object$parsedStyle.shadowBlur, | ||
shadowOffsetX = _object$parsedStyle.shadowOffsetX, | ||
shadowOffsetY = _object$parsedStyle.shadowOffsetY; | ||
if (hasShadowColor) { | ||
context.shadowColor = oldShadowColor; | ||
context.shadowBlur = oldShadowBlur; | ||
} // restore filters | ||
if (!isNil(filter)) { | ||
// use raw filter string | ||
context.filter = object.style.filter; | ||
} | ||
if (hasFilter) { | ||
context.filter = oldFilter; | ||
} | ||
if (!drawStroke) { | ||
this.stroke(context, object, stroke, renderingService); | ||
} | ||
} | ||
if (hasShadow) { | ||
context.shadowColor = shadowColor.toString(); | ||
context.shadowBlur = shadowBlur && shadowBlur.value || 0; | ||
context.shadowOffsetX = shadowOffsetX && shadowOffsetX.value || 0; | ||
context.shadowOffsetY = shadowOffsetY && shadowOffsetY.value || 0; | ||
} | ||
@@ -1660,8 +1675,3 @@ }; | ||
lineDash = _object$parsedStyle.lineDash, | ||
lineDashOffset = _object$parsedStyle.lineDashOffset, | ||
filter = _object$parsedStyle.filter, | ||
shadowColor = _object$parsedStyle.shadowColor, | ||
shadowBlur = _object$parsedStyle.shadowBlur, | ||
shadowOffsetX = _object$parsedStyle.shadowOffsetX, | ||
shadowOffsetY = _object$parsedStyle.shadowOffsetY; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/setLineDash | ||
lineDashOffset = _object$parsedStyle.lineDashOffset; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/setLineDash | ||
@@ -1690,16 +1700,2 @@ if (lineDash && Array.isArray(lineDash)) { | ||
} | ||
if (!isNil(filter)) { | ||
// use raw filter string | ||
context.filter = object.style.filter; | ||
} | ||
var hasShadow = !isNil(shadowColor) && (shadowBlur === null || shadowBlur === void 0 ? void 0 : shadowBlur.value) > 0; | ||
if (hasShadow) { | ||
context.shadowColor = shadowColor.toString(); | ||
context.shadowBlur = shadowBlur && shadowBlur.value || 0; | ||
context.shadowOffsetX = shadowOffsetX && shadowOffsetX.value || 0; | ||
context.shadowOffsetY = shadowOffsetY && shadowOffsetY.value || 0; | ||
} | ||
}; | ||
@@ -1706,0 +1702,0 @@ |
@@ -835,6 +835,4 @@ 'use strict'; | ||
lineJoin = parsedStyle.lineJoin, | ||
_parsedStyle$miterLim = parsedStyle.miterLimit, | ||
miterLimit = _parsedStyle$miterLim === void 0 ? 0 : _parsedStyle$miterLim, | ||
_parsedStyle$letterSp = parsedStyle.letterSpacing, | ||
letterSpacing = _parsedStyle$letterSp === void 0 ? 0 : _parsedStyle$letterSp, | ||
miterLimit = parsedStyle.miterLimit, | ||
letterSpacing = parsedStyle.letterSpacing, | ||
stroke = parsedStyle.stroke, | ||
@@ -858,3 +856,7 @@ fill = parsedStyle.fill, | ||
context.lineJoin = lineJoin.value; | ||
context.miterLimit = miterLimit; | ||
if (!g.isNil(miterLimit)) { | ||
context.miterLimit = miterLimit.value; | ||
} | ||
var linePositionY = 0; // handle vertical text baseline | ||
@@ -888,7 +890,7 @@ | ||
if (!g.isNil(stroke) && !stroke.isNone && lineWidth && lineWidth.value) { | ||
this.drawLetterSpacing(context, lines[i], lineMetrics[i], textAlign.value, linePositionX, linePositionY, letterSpacing, fillOpacity.value, strokeOpacity.value, opacity.value, true); | ||
this.drawLetterSpacing(context, lines[i], lineMetrics[i], textAlign.value, linePositionX, linePositionY, letterSpacing.value, fillOpacity.value, strokeOpacity.value, opacity.value, true); | ||
} | ||
if (!g.isNil(fill)) { | ||
this.drawLetterSpacing(context, lines[i], lineMetrics[i], textAlign.value, linePositionX, linePositionY, letterSpacing, fillOpacity.value, strokeOpacity.value, opacity.value); | ||
this.drawLetterSpacing(context, lines[i], lineMetrics[i], textAlign.value, linePositionX, linePositionY, letterSpacing.value, fillOpacity.value, strokeOpacity.value, opacity.value); | ||
} | ||
@@ -1001,89 +1003,102 @@ } | ||
lineJoin = parsedStyle.lineJoin, | ||
shadowType = parsedStyle.shadowType, | ||
shadowColor = parsedStyle.shadowColor, | ||
shadowBlur = parsedStyle.shadowBlur, | ||
filter = parsedStyle.filter, | ||
miterLimit = parsedStyle.miterLimit; | ||
var hasFill = !g.isNil(fill) && !fill.isNone; | ||
var hasStroke = !g.isNil(stroke) && !stroke.isNone; | ||
var hasStroke = !g.isNil(stroke) && !stroke.isNone && lineWidth && lineWidth.value > 0; | ||
var isFillTransparent = fill.alpha === 0; | ||
var hasFilter = !g.isNil(filter); | ||
var hasShadow = !g.isNil(shadowColor) && (shadowBlur === null || shadowBlur === void 0 ? void 0 : shadowBlur.value) > 0; | ||
var nodeName = object.nodeName; | ||
var isInnerShadow = (shadowType === null || shadowType === void 0 ? void 0 : shadowType.value) === 'inner'; | ||
var shouldDrawShadowWithStroke = hasStroke && hasShadow && (nodeName === g.Shape.PATH || nodeName === g.Shape.LINE || nodeName === g.Shape.POLYLINE || isFillTransparent || isInnerShadow); | ||
if (hasFill) { | ||
if (!g.isNil(fillOpacity) && fillOpacity.value !== 1) { | ||
context.globalAlpha = fillOpacity.value; | ||
this.fill(context, object, fill, renderingService); | ||
context.globalAlpha = opacity.value; | ||
} else { | ||
this.fill(context, object, fill, renderingService); | ||
context.globalAlpha = opacity.value * fillOpacity.value; | ||
if (!shouldDrawShadowWithStroke) { | ||
this.setShadowAndFilter(object, context, hasShadow); | ||
} | ||
this.fill(context, object, fill, renderingService); | ||
if (!shouldDrawShadowWithStroke) { | ||
this.clearShadowAndFilter(context, hasFilter, hasShadow); | ||
} | ||
} | ||
if (hasStroke) { | ||
if (lineWidth && lineWidth.value > 0) { | ||
var applyOpacity = !g.isNil(strokeOpacity) && strokeOpacity.value !== 1; | ||
context.globalAlpha = opacity.value * strokeOpacity.value; | ||
context.lineWidth = lineWidth.value; | ||
if (applyOpacity) { | ||
context.globalAlpha = strokeOpacity.value; | ||
} | ||
if (!g.isNil(miterLimit)) { | ||
context.miterLimit = miterLimit.value; | ||
} | ||
context.lineWidth = lineWidth.value; | ||
if (!g.isNil(lineCap)) { | ||
context.lineCap = lineCap.value; | ||
} | ||
if (!g.isNil(miterLimit)) { | ||
context.miterLimit = miterLimit; | ||
} | ||
if (!g.isNil(lineJoin)) { | ||
context.lineJoin = lineJoin.value; | ||
} | ||
if (!g.isNil(lineCap)) { | ||
context.lineCap = lineCap.value; | ||
if (shouldDrawShadowWithStroke) { | ||
if (isInnerShadow) { | ||
context.globalCompositeOperation = 'source-atop'; | ||
} | ||
if (!g.isNil(lineJoin)) { | ||
context.lineJoin = lineJoin.value; | ||
} | ||
this.setShadowAndFilter(object, context, true); | ||
var oldShadowBlur; | ||
var oldShadowColor; | ||
var oldFilter; | ||
var hasShadowColor = !g.isNil(shadowColor); | ||
var hasFilter = !g.isNil(filter); | ||
if (hasShadowColor) { | ||
// prevent inner shadow when drawing stroke, toggle shadowBlur & filter(drop-shadow) | ||
// save shadow blur | ||
oldShadowBlur = context.shadowBlur; | ||
oldShadowColor = context.shadowColor; | ||
if (!g.isNil(oldShadowBlur)) { | ||
context.shadowColor = 'transparent'; | ||
context.shadowBlur = 0; | ||
} | ||
if (isInnerShadow) { | ||
this.stroke(context, object, stroke, renderingService); | ||
context.globalCompositeOperation = 'source-over'; | ||
this.clearShadowAndFilter(context, hasFilter, true); | ||
} | ||
} | ||
if (hasFilter) { | ||
// save drop-shadow filter | ||
oldFilter = context.filter; | ||
this.stroke(context, object, stroke, renderingService); | ||
} | ||
}; | ||
if (!g.isNil(oldFilter) && oldFilter.indexOf('drop-shadow') > -1) { | ||
context.filter = oldFilter.replace(/drop-shadow\([^)]*\)/, '').trim() || 'none'; | ||
} | ||
} | ||
_proto.clearShadowAndFilter = function clearShadowAndFilter(context, hasFilter, hasShadow) { | ||
if (hasShadow) { | ||
context.shadowColor = 'transparent'; | ||
context.shadowBlur = 0; | ||
} | ||
var drawStroke = hasFill && !isFillTransparent; | ||
if (hasFilter) { | ||
// save drop-shadow filter | ||
var oldFilter = context.filter; | ||
if (drawStroke) { | ||
this.stroke(context, object, stroke, renderingService); | ||
} // restore shadow blur | ||
if (!g.isNil(oldFilter) && oldFilter.indexOf('drop-shadow') > -1) { | ||
context.filter = oldFilter.replace(/drop-shadow\([^)]*\)/, '').trim() || 'none'; | ||
} | ||
} | ||
} | ||
/** | ||
* apply before fill and stroke but only once | ||
*/ | ||
; | ||
_proto.setShadowAndFilter = function setShadowAndFilter(object, context, hasShadow) { | ||
var _object$parsedStyle = object.parsedStyle, | ||
filter = _object$parsedStyle.filter, | ||
shadowColor = _object$parsedStyle.shadowColor, | ||
shadowBlur = _object$parsedStyle.shadowBlur, | ||
shadowOffsetX = _object$parsedStyle.shadowOffsetX, | ||
shadowOffsetY = _object$parsedStyle.shadowOffsetY; | ||
if (hasShadowColor) { | ||
context.shadowColor = oldShadowColor; | ||
context.shadowBlur = oldShadowBlur; | ||
} // restore filters | ||
if (!g.isNil(filter)) { | ||
// use raw filter string | ||
context.filter = object.style.filter; | ||
} | ||
if (hasFilter) { | ||
context.filter = oldFilter; | ||
} | ||
if (!drawStroke) { | ||
this.stroke(context, object, stroke, renderingService); | ||
} | ||
} | ||
if (hasShadow) { | ||
context.shadowColor = shadowColor.toString(); | ||
context.shadowBlur = shadowBlur && shadowBlur.value || 0; | ||
context.shadowOffsetX = shadowOffsetX && shadowOffsetX.value || 0; | ||
context.shadowOffsetY = shadowOffsetY && shadowOffsetY.value || 0; | ||
} | ||
@@ -1664,8 +1679,3 @@ }; | ||
lineDash = _object$parsedStyle.lineDash, | ||
lineDashOffset = _object$parsedStyle.lineDashOffset, | ||
filter = _object$parsedStyle.filter, | ||
shadowColor = _object$parsedStyle.shadowColor, | ||
shadowBlur = _object$parsedStyle.shadowBlur, | ||
shadowOffsetX = _object$parsedStyle.shadowOffsetX, | ||
shadowOffsetY = _object$parsedStyle.shadowOffsetY; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/setLineDash | ||
lineDashOffset = _object$parsedStyle.lineDashOffset; // @see https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/setLineDash | ||
@@ -1694,16 +1704,2 @@ if (lineDash && Array.isArray(lineDash)) { | ||
} | ||
if (!g.isNil(filter)) { | ||
// use raw filter string | ||
context.filter = object.style.filter; | ||
} | ||
var hasShadow = !g.isNil(shadowColor) && (shadowBlur === null || shadowBlur === void 0 ? void 0 : shadowBlur.value) > 0; | ||
if (hasShadow) { | ||
context.shadowColor = shadowColor.toString(); | ||
context.shadowBlur = shadowBlur && shadowBlur.value || 0; | ||
context.shadowOffsetX = shadowOffsetX && shadowOffsetX.value || 0; | ||
context.shadowOffsetY = shadowOffsetY && shadowOffsetY.value || 0; | ||
} | ||
}; | ||
@@ -1710,0 +1706,0 @@ |
@@ -1,3 +0,5 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g"),require("@antv/g-plugin-canvas-path-generator"),require("@antv/g-plugin-image-loader")):"function"==typeof define&&define.amd?define(["exports","@antv/g","@antv/g-plugin-canvas-path-generator","@antv/g-plugin-image-loader"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.CanvasRenderer={}),e.window.G,e.window.G.CanvasPathGenerator,e.window.G.ImageLoader)}(this,(function(e,t,r,n){"use strict";function i(){ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@antv/g")):"function"==typeof define&&define.amd?define(["exports","@antv/g"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).G=e.G||{},e.G.CanvasRenderer={}),e.window.G)}(this,(function(e,t){"use strict";function r(){ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
i=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",l=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var i=Object.create((t&&t.prototype instanceof d?t:d).prototype),o=new P(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return S()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var l=b(a,r);if(l){if(l===h)continue;return l}}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 s=u(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),i}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var h={};function d(){}function p(){}function f(){}var v={};s(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(A([])));g&&g!==t&&r.call(g,o)&&(v=g);var m=f.prototype=d.prototype=Object.create(v);function R(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function n(i,o,a,l){var s=u(e[i],e,o);if("throw"!==s.type){var c=s.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,l)}),(function(e){n("throw",e,a,l)})):t.resolve(h).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,l)}))}l(s.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function A(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return p.prototype=f,s(m,"constructor",f),s(f,"constructor",p),p.displayName=s(f,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,s(e,l,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},R(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new x(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},R(m),s(m,l,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=A,P.prototype={constructor:P,reset:function(e){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(C),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.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 n("end");if(this.prev>=o.tryLoc){var l=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(l&&s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(l){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;C(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function o(e,t,r,n,i,o,a){try{var l=e[o](a),s=l.value}catch(e){return void r(e)}l.done?t(s):Promise.resolve(s).then(n,i)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function l(e){o(a,n,i,l,s,"next",e)}function s(e){o(a,n,i,l,s,"throw",e)}l(void 0)}))}}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}function s(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,c(e,t)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function u(e,t,r,n){var i,o=arguments.length,a=3>o?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(a=(3>o?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var d="undefined"!=typeof Float32Array?Float32Array:Array;function p(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function f(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function v(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],l=t[4],s=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],v=t[12],y=t[13],g=t[14],m=t[15],R=r[0],x=r[1],b=r[2],w=r[3];return e[0]=R*n+x*l+b*h+w*v,e[1]=R*i+x*s+b*d+w*y,e[2]=R*o+x*c+b*p+w*g,e[3]=R*a+x*u+b*f+w*m,e[4]=(R=r[4])*n+(x=r[5])*l+(b=r[6])*h+(w=r[7])*v,e[5]=R*i+x*s+b*d+w*y,e[6]=R*o+x*c+b*p+w*g,e[7]=R*a+x*u+b*f+w*m,e[8]=(R=r[8])*n+(x=r[9])*l+(b=r[10])*h+(w=r[11])*v,e[9]=R*i+x*s+b*d+w*y,e[10]=R*o+x*c+b*p+w*g,e[11]=R*a+x*u+b*f+w*m,e[12]=(R=r[12])*n+(x=r[13])*l+(b=r[14])*h+(w=r[15])*v,e[13]=R*i+x*s+b*d+w*y,e[14]=R*o+x*c+b*p+w*g,e[15]=R*a+x*u+b*f+w*m,e}function y(e,t,r){var n,i,o,a,l,s,c,u,h,d,p,f,v=r[0],y=r[1],g=r[2];return t===e?(e[12]=t[0]*v+t[4]*y+t[8]*g+t[12],e[13]=t[1]*v+t[5]*y+t[9]*g+t[13],e[14]=t[2]*v+t[6]*y+t[10]*g+t[14],e[15]=t[3]*v+t[7]*y+t[11]*g+t[15]):(i=t[1],o=t[2],a=t[3],l=t[4],s=t[5],c=t[6],u=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=n=t[0],e[1]=i,e[2]=o,e[3]=a,e[4]=l,e[5]=s,e[6]=c,e[7]=u,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=n*v+l*y+h*g+t[12],e[13]=i*v+s*y+d*g+t[13],e[14]=o*v+c*y+p*g+t[14],e[15]=a*v+u*y+f*g+t[15]),e}function g(){var e=new d(3);return d!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function m(e,t,r){var n=new d(3);return n[0]=e,n[1]=t,n[2]=r,n}function R(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/(a=a||1),e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});x=g();var x,b=t.Syringe.defineToken("StyleRendererFactory"),w=t.Syringe.defineToken("CircleRenderer",{multiple:!1}),C=t.Syringe.defineToken("EllipseRenderer",{multiple:!1}),P=t.Syringe.defineToken("RectRenderer",{multiple:!1}),A=t.Syringe.defineToken("LineRenderer",{multiple:!1}),S=t.Syringe.defineToken("PolylineRenderer",{multiple:!1}),E=t.Syringe.defineToken("PolygonRenderer",{multiple:!1}),O=t.Syringe.defineToken("PathRenderer",{multiple:!1}),B=t.Syringe.defineToken("TextRenderer",{multiple:!1}),k=t.Syringe.defineToken("ImageRenderer",{multiple:!1});e.ImageRenderer=function(){function e(){this.imagePool=void 0}return e.prototype.render=function(e,r){var n,i=r.img,o=r.width.value,a=r.height.value;if(t.isString(i)?n=this.imagePool.getImageSync(i):(o||(o=i.width),a||(a=i.height),n=i),n)try{e.drawImage(n,0,0,o,a)}catch(e){}},e}(),u([t.inject(n.ImagePool),h("design:type",n.ImagePool)],e.ImageRenderer.prototype,"imagePool",void 0),e.ImageRenderer=u([t.singleton({token:k})],e.ImageRenderer),e.TextRenderer=function(){function e(){}var r=e.prototype;return r.render=function(e,r,n){var i=r.lineWidth,o=r.textAlign,a=r.textBaseline,l=r.lineJoin,s=r.miterLimit,c=void 0===s?0:s,u=r.letterSpacing,h=void 0===u?0:u,d=r.stroke,p=r.fill,f=r.fillOpacity,v=r.strokeOpacity,y=r.opacity,g=r.metrics,m=r.dx,R=r.dy,x=g.lines,b=g.height,w=g.lineHeight,C=g.lineMetrics;e.font=g.font,e.lineWidth=i.value,e.textAlign=o.value,e.textBaseline=a.value,e.lineJoin=l.value,e.miterLimit=c;var P=0;"middle"===a.value?P=-b/2-w/2:"bottom"===a.value||"alphabetic"===a.value||"ideographic"===a.value?P=-b:"top"!==a.value&&"hanging"!==a.value||(P=-w);var A=0;m&&m.unit===t.UnitType.kPixels&&(A+=m.value),R&&R.unit===t.UnitType.kPixels&&(P+=R.value);for(var S=0;x.length>S;S++){var E=i.value/2+A;P+=w,!t.isNil(d)&&!d.isNone&&i&&i.value&&this.drawLetterSpacing(e,x[S],C[S],o.value,E,P,h,f.value,v.value,y.value,!0),t.isNil(p)||this.drawLetterSpacing(e,x[S],C[S],o.value,E,P,h,f.value,v.value,y.value)}},r.drawLetterSpacing=function(e,t,r,n,i,o,a,l,s,c,u){if(void 0===u&&(u=!1),0!==a){var h=e.textAlign;e.textAlign="left";var d=i;"center"===n?d=i-r.width/2:"right"!==n&&"end"!==n||(d=i-r.width);for(var p=Array.from(t),f=e.measureText(t).width,v=0,y=0;p.length>y;++y){var g=p[y];u?this.strokeText(e,g,d,o,s):this.fillText(e,g,d,o,l,c),d+=f-(v=e.measureText(t.substring(y+1)).width)+a,f=v}e.textAlign=h}else u?this.strokeText(e,t,i,o,s):this.fillText(e,t,i,o,l,c)},r.fillText=function(e,r,n,i,o,a){var l,s=!t.isNil(o)&&1!==o;s&&(l=e.globalAlpha,e.globalAlpha=o*a),e.fillText(r,n,i),s&&(e.globalAlpha=l)},r.strokeText=function(e,r,n,i,o){var a,l=!t.isNil(o)&&1!==o;l&&(a=e.globalAlpha,e.globalAlpha=o),e.strokeText(r,n,i),l&&(e.globalAlpha=a)},e}(),e.TextRenderer=u([t.singleton({token:B})],e.TextRenderer);var L=function(){function e(){this.imagePool=void 0}var r=e.prototype;return r.render=function(e,r,n,i){var o=r.fill,a=r.opacity,l=r.fillOpacity,s=r.stroke,c=r.strokeOpacity,u=r.lineWidth,h=r.lineCap,d=r.lineJoin,p=r.shadowColor,f=r.filter,v=r.miterLimit,y=!t.isNil(o)&&!o.isNone,g=!t.isNil(s)&&!s.isNone,m=0===o.alpha;if(y&&(t.isNil(l)||1===l.value?this.fill(e,n,o,i):(e.globalAlpha=l.value,this.fill(e,n,o,i),e.globalAlpha=a.value)),g&&u&&u.value>0){var R,x,b;!t.isNil(c)&&1!==c.value&&(e.globalAlpha=c.value),e.lineWidth=u.value,t.isNil(v)||(e.miterLimit=v),t.isNil(h)||(e.lineCap=h.value),t.isNil(d)||(e.lineJoin=d.value);var w=!t.isNil(p),C=!t.isNil(f);w&&(x=e.shadowColor,t.isNil(R=e.shadowBlur)||(e.shadowColor="transparent",e.shadowBlur=0)),C&&!t.isNil(b=e.filter)&&b.indexOf("drop-shadow")>-1&&(e.filter=b.replace(/drop-shadow\([^)]*\)/,"").trim()||"none");var P=y&&!m;P&&this.stroke(e,n,s,i),w&&(e.shadowColor=x,e.shadowBlur=R),C&&(e.filter=b),P||this.stroke(e,n,s,i)}},r.fill=function(e,r,n,i){var o=this;Array.isArray(n)?n.forEach((function(t){e.fillStyle=o.getColor(t,r,e),e.fill()})):(t.isPattern(n)&&(e.fillStyle=this.getPattern(n,r,e,i)),e.fill())},r.stroke=function(e,r,n,i){var o=this;Array.isArray(n)?n.forEach((function(t){e.strokeStyle=o.getColor(t,r,e),e.stroke()})):(t.isPattern(n)&&(e.strokeStyle=this.getPattern(n,r,e,i)),e.stroke())},r.getPattern=function(e,t,r,n){return this.imagePool.getOrCreatePatternSync(e,r,(function(){t.renderable.dirty=!0,n.dirtify()}))},r.getColor=function(e,r,n){var i;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var o=r.getGeometryBounds();i=this.imagePool.getOrCreateGradient(l({type:e.type},e.value,{width:o&&2*o.halfExtents[0]||1,height:o&&2*o.halfExtents[1]||1}),n)}return i},e}();u([t.inject(n.ImagePool),h("design:type",n.ImagePool)],L.prototype,"imagePool",void 0),L=u([t.singleton()],L),e.RectRenderer=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(L),e.RectRenderer=u([t.singleton({token:P})],e.RectRenderer),e.CircleRenderer=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(L),e.CircleRenderer=u([t.singleton({token:w})],e.CircleRenderer),e.EllipseRenderer=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(L),e.EllipseRenderer=u([t.singleton({token:C})],e.EllipseRenderer),e.LineRenderer=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(L),e.LineRenderer=u([t.singleton({token:A})],e.LineRenderer),e.PolylineRenderer=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(L),e.PolylineRenderer=u([t.singleton({token:S})],e.PolylineRenderer),e.PolygonRenderer=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(L),e.PolygonRenderer=u([t.singleton({token:E})],e.PolygonRenderer),e.PathRenderer=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(L),e.PathRenderer=u([t.singleton({token:O})],e.PathRenderer);var N,T,M=t.Syringe.defineToken("CanvasRendererPluginOptions"),j=(N=function(){function e(){this.canvasConfig=void 0,this.camera=void 0,this.contextService=void 0,this.renderingContext=void 0,this.pathGeneratorFactory=void 0,this.pathGeneratorFactoryCache={},this.styleRendererFactory=void 0,this.styleRendererFactoryCache={},this.displayObjectPool=void 0,this.canvasRendererPluginOptions=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=p(),this.dprMatrix=p(),this.tmpMat4=p(),this.tmpVec3=g()}var r=e.prototype;return r.apply=function(e){var r=this,n=this.renderingContext.root.ownerDocument.defaultView,o=function(e){var t=e.target.rBushNode;t.aabb&&r.removedRBushNodeAABBs.push(t.aabb)},l=function(e){var t=e.target.rBushNode;t.aabb&&r.removedRBushNodeAABBs.push(t.aabb)};e.hooks.init.tapPromise(T.tag,a(i().mark((function e(){var n,a,s,c,u;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.UNMOUNTED,o),r.renderingContext.root.addEventListener(t.ElementEvent.CULLED,l),n=r.contextService.getDPR(),s=(a=r.canvasConfig).width,c=a.height,u=r.contextService.getContext(),r.clearRect(u,0,0,s*n,c*n),i=r.dprMatrix,h=m(n,n,1),i[0]=h[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=h[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=h[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1;case 7:case"end":return e.stop()}var i,h}),e)})))),e.hooks.destroy.tap(T.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.UNMOUNTED,o),r.renderingContext.root.removeEventListener(t.ElementEvent.CULLED,l)})),e.hooks.beginFrame.tap(T.tag,(function(){var t=r.contextService.getContext(),n=r.contextService.getDPR(),i=r.canvasConfig,o=i.width,a=i.height,l=r.canvasRendererPluginOptions,s=l.dirtyObjectNumThreshold,c=l.dirtyObjectRatioThreshold,u=e.getStats(),h=u.rendered,d=h/u.total;r.clearFullScreen=e.disableDirtyRectangleRendering()||h>s&&d>c,t&&(t.resetTransform(),r.clearFullScreen&&r.clearRect(t,0,0,o*n,a*n))})),e.hooks.endFrame.tap(T.tag,(function(){var i=r.contextService.getContext();if(v(r.vpMatrix,r.dprMatrix,r.camera.getOrthoMatrix()),r.clearFullScreen)r.renderingContext.root.forEach((function(t){t.isVisible()&&!t.isCulled()&&(r.renderDisplayObject(t,e),r.saveDirtyAABB(t))}));else{var o=r.safeMergeAABB.apply(r,[r.mergeDirtyAABBs(r.renderQueue)].concat(r.removedRBushNodeAABBs.map((function(e){var r=e.minX,n=e.minY,i=e.maxX,o=e.maxY,a=new t.AABB;return a.setMinMax(m(r,n,0),m(i,o,0)),a}))));if(r.removedRBushNodeAABBs=[],t.AABB.isEmpty(o))return void(r.renderQueue=[]);var a=r.convertAABB2Rect(o),l=a.x,s=a.y,c=a.width,u=a.height,h=R(r.tmpVec3,m(l,s,0),r.vpMatrix),d=R(g(),m(l+c,s+u,0),r.vpMatrix),p=Math.floor(h[0]),f=Math.floor(h[1]),y=Math.ceil(d[0]-h[0]),x=Math.ceil(d[1]-h[1]);i.save(),r.clearRect(i,p,f,y,x),i.beginPath(),i.rect(p,f,y,x),i.clip(),i.setTransform(r.vpMatrix[0],r.vpMatrix[1],r.vpMatrix[4],r.vpMatrix[5],r.vpMatrix[12],r.vpMatrix[13]),r.canvasConfig.renderer.getConfig().enableDirtyRectangleRenderingDebug&&n.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:a})),r.searchDirtyObjects(o).sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(t){t&&t.isVisible()&&!t.isCulled()&&r.renderDisplayObject(t,e)})),i.restore(),r.renderQueue.forEach((function(e){r.saveDirtyAABB(e)})),r.renderQueue=[]}r.restoreStack.forEach((function(){i.restore()})),r.restoreStack=[]})),e.hooks.render.tap(T.tag,(function(e){r.clearFullScreen||r.renderQueue.push(e)}))},r.clearRect=function(e,t,r,n,i){e.clearRect(t,r,n,i);var o=this.canvasConfig.background;o&&(e.fillStyle=o,e.fillRect(t,r,n,i))},r.renderDisplayObject=function(e,r){for(var n=this.contextService.getContext(),i=this.restoreStack[this.restoreStack.length-1];i&&e.parentNode!==i;)n.restore(),this.restoreStack.pop(),i=this.restoreStack[this.restoreStack.length-1];var o=e.nodeName;void 0===this.styleRendererFactoryCache[o]&&(this.styleRendererFactoryCache[o]=this.styleRendererFactory(o));var a=this.styleRendererFactoryCache[o];void 0===this.pathGeneratorFactoryCache[o]&&(this.pathGeneratorFactoryCache[o]=this.pathGeneratorFactory(o));var l=this.pathGeneratorFactoryCache[o],s=e.parsedStyle.clipPath;if(s){this.applyWorldTransform(n,s,e.getWorldTransform()),void 0===this.pathGeneratorFactoryCache[s.nodeName]&&(this.pathGeneratorFactoryCache[s.nodeName]=this.pathGeneratorFactory(s.nodeName));var c=this.pathGeneratorFactoryCache[s.nodeName];c&&(n.save(),this.restoreStack.push(e),n.beginPath(),c(n,s.parsedStyle),n.closePath(),n.clip())}a&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),l&&(n.beginPath(),l(n,e.parsedStyle),e.nodeName!==t.Shape.LINE&&e.nodeName!==t.Shape.PATH&&e.nodeName!==t.Shape.POLYLINE&&n.closePath()),a&&(a.render(n,e.parsedStyle,e,r),n.restore()),e.renderable.dirty=!1},r.convertAABB2Rect=function(e){var t=e.getMin(),r=e.getMax(),n=Math.floor(t[0]),i=Math.floor(t[1]);return{x:n,y:i,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-i}},r.mergeDirtyAABBs=function(e){var r=new t.AABB;return e.forEach((function(e){var t=e.getRenderBounds();r.add(t);var n=e.renderable.dirtyRenderBounds;n&&r.add(n)})),r},r.searchDirtyObjects=function(e){var t=this,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)}))},r.saveDirtyAABB=function(e){var r=e.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new t.AABB);var n=e.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},r.applyAttributesToContext=function(e,r){var n=r.parsedStyle,i=n.stroke,o=n.fill,a=n.opacity,l=n.lineDash,s=n.lineDashOffset,c=n.filter,u=n.shadowColor,h=n.shadowBlur,d=n.shadowOffsetX,p=n.shadowOffsetY;l&&Array.isArray(l)&&e.setLineDash(l.map((function(e){return e.value}))),t.isNil(s)||(e.lineDashOffset=s.value),t.isNil(a)||(e.globalAlpha*=a.value),t.isNil(i)||Array.isArray(i)||i.isNone||(e.strokeStyle=r.attributes.stroke),t.isNil(o)||Array.isArray(o)||o.isNone||(e.fillStyle=r.attributes.fill),t.isNil(c)||(e.filter=r.style.filter),!t.isNil(u)&&(null==h?void 0:h.value)>0&&(e.shadowColor=u.toString(),e.shadowBlur=h&&h.value||0,e.shadowOffsetX=d&&d.value||0,e.shadowOffsetY=p&&p.value||0)},r.applyWorldTransform=function(e,t,r){var n=0,i=0,o=(t.parsedStyle||{}).anchor,a=o&&o[0].value||0,l=o&&o[1].value||0;if(0!==a||0!==l){var s=t.getGeometryBounds();n=-a*(s&&2*s.halfExtents[0]||0),i=-l*(s&&2*s.halfExtents[1]||0)}r?(f(this.tmpMat4,t.getLocalTransform()),this.tmpVec3[0]=n,this.tmpVec3[1]=i,this.tmpVec3[2]=0,y(this.tmpMat4,this.tmpMat4,this.tmpVec3),v(this.tmpMat4,r,this.tmpMat4),v(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(f(this.tmpMat4,t.getWorldTransform()),this.tmpVec3[0]=n,this.tmpVec3[1]=i,this.tmpVec3[2]=0,y(this.tmpMat4,this.tmpMat4,this.tmpVec3),v(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},r.safeMergeAABB=function(){for(var e=new t.AABB,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return n.forEach((function(t){e.add(t)})),e},e}(),N.tag="CanvasRenderer",T=N);u([t.inject(t.CanvasConfig),h("design:type",Object)],j.prototype,"canvasConfig",void 0),u([t.inject(t.DefaultCamera),h("design:type",t.Camera)],j.prototype,"camera",void 0),u([t.inject(t.ContextService),h("design:type",Object)],j.prototype,"contextService",void 0),u([t.inject(t.RenderingContext),h("design:type",Object)],j.prototype,"renderingContext",void 0),u([t.inject(r.PathGeneratorFactory),h("design:type",Function)],j.prototype,"pathGeneratorFactory",void 0),u([t.inject(b),h("design:type",Function)],j.prototype,"styleRendererFactory",void 0),u([t.inject(t.DisplayObjectPool),h("design:type",t.DisplayObjectPool)],j.prototype,"displayObjectPool",void 0),u([t.inject(M),h("design:type",Object)],j.prototype,"canvasRendererPluginOptions",void 0),u([t.inject(t.RBushRoot),h("design:type",t.RBush)],j.prototype,"rBush",void 0),j=T=u([t.singleton({contrib:t.RenderingPluginContribution})],j);var F=t.Module((function(r){var n;r(e.CircleRenderer),r(e.EllipseRenderer),r(e.RectRenderer),r(e.ImageRenderer),r(e.TextRenderer),r(e.LineRenderer),r(e.PolylineRenderer),r(e.PolygonRenderer),r(e.PathRenderer);var i=((n={})[t.Shape.CIRCLE]=w,n[t.Shape.ELLIPSE]=C,n[t.Shape.RECT]=P,n[t.Shape.IMAGE]=k,n[t.Shape.TEXT]=B,n[t.Shape.LINE]=A,n[t.Shape.POLYLINE]=S,n[t.Shape.POLYGON]=E,n[t.Shape.PATH]=O,n);r({token:b,useFactory:function(e){return function(t){var r=i[t];return r&&e.container.isBound(r)?e.container.get(r):null}}}),r(j)})),G=function(e){function t(t){var r;return void 0===t&&(t={}),(r=e.call(this)||this).options=void 0,r.name="canvas-renderer",r.options=t,r}s(t,e);var r=t.prototype;return r.init=function(){this.container.register(M,{useValue:l({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options)}),this.container.load(F,!0)},r.destroy=function(){this.container.unload(F),this.container.remove(M)},t}(t.AbstractRendererPlugin);e.CircleRendererContribution=w,e.EllipseRendererContribution=C,e.ImageRendererContribution=k,e.LineRendererContribution=A,e.PathRendererContribution=O,e.Plugin=G,e.PolygonRendererContribution=E,e.PolylineRendererContribution=S,e.RectRendererContribution=P,e.StyleRendererFactory=b,e.TextRendererContribution=B,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
r=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var i=Object.create((t&&t.prototype instanceof d?t:d).prototype),o=new C(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return S()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===h)continue;return c}}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 s=u(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),i}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var h={};function d(){}function f(){}function p(){}var v={};s(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(P([])));g&&g!==t&&n.call(g,o)&&(v=g);var m=p.prototype=d.prototype=Object.create(v);function w(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function r(i,o,a,c){var s=u(e[i],e,o);if("throw"!==s.type){var l=s.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(h).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,c)}))}c(s.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function R(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(R,this),this.reset(!0)}function P(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=p,s(m,"constructor",p),s(p,"constructor",f),f.displayName=s(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,c,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},w(x.prototype),s(x.prototype,a,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new x(l(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},w(m),s(m,c,"Generator"),s(m,o,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=P,C.prototype={constructor:C,reset:function(e){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(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.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 c=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(c&&s){if(o.catchLoc>this.prev)return r(o.catchLoc,!0);if(o.finallyLoc>this.prev)return r(o.finallyLoc)}else if(c){if(o.catchLoc>this.prev)return r(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return r(o.finallyLoc)}}}},abrupt:function(e,t){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"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:P(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function n(e,t,r,n,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function c(e){n(a,i,o,c,s,"next",e)}function s(e){n(a,i,o,c,s,"throw",e)}c(void 0)}))}}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o.apply(this,arguments)}function a(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,c(e,t)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function s(e,t,r,n){var i,o=arguments.length,a=3>o?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(a=(3>o?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var u=t.Syringe.defineToken("PathGeneratorFactory"),h=t.Syringe.defineToken("PathGenerator");function d(e,t){var r=t.r;e.arc(r.value,r.value,r.value,0,2*Math.PI,!1)}function f(e,t){var r=t.rx.value,n=t.ry.value;if(e.ellipse)e.ellipse(r,n,r,n,0,0,2*Math.PI,!1);else{var i=r>n?r:n,o=r>n?1:r/n,a=r>n?n/r:1;e.save(),e.scale(o,a),e.arc(0,0,i,0,2*Math.PI)}}function p(e,t){var r=t.x2,n=t.y2,i=t.defX,o=void 0===i?0:i,a=t.defY,c=void 0===a?0:a;e.moveTo(t.x1.value-o,t.y1.value-c),e.lineTo(r.value-o,n.value-c)}function v(e,t){var r=t.defX,n=void 0===r?0:r,i=t.defY,o=void 0===i?0:i,a=t.path,c=a.zCommandIndexes,s=[].concat(a.curve);c.forEach((function(e,t){s.splice(e+t,1,["Z"])}));for(var l=0;s.length>l;l++){var u=s[l];switch(u[0]){case"M":e.moveTo(u[1]-n,u[2]-o);break;case"C":e.bezierCurveTo(u[1]-n,u[2]-o,u[3]-n,u[4]-o,u[5]-n,u[6]-o);break;case"Z":e.closePath()}}}function y(e,t){var r=t.defX,n=void 0===r?0:r,i=t.defY,o=void 0===i?0:i,a=t.points.points,c=a.length,s=a[c-1][0]-n,l=a[c-1][1]-o;e.moveTo(a[0][0]-n,a[0][1]-o);for(var u=0;c-1>u;u++){var h=a[u];e.lineTo(h[0]-n,h[1]-o)}e.lineTo(s,l)}function g(e,t){var r=t.defX,n=void 0===r?0:r,i=t.defY,o=void 0===i?0:i,a=t.points.points,c=a.length,s=a[c-1][0]-n,l=a[c-1][1]-o;e.moveTo(a[0][0]-n,a[0][1]-o);for(var u=0;c-1>u;u++){var h=a[u];e.lineTo(h[0]-n,h[1]-o)}e.lineTo(s,l)}function m(e,r){var n=r.radius,i=r.width,o=r.height,a=i.value,c=o.value;if(n&&n.some((function(e){return 0!==e.value}))){var s=i.value>0?1:-1,l=o.value>0?1:-1,u=s+l===0,h=n.map((function(e){return t.clamp(e.value,0,Math.min(Math.abs(a)/2,Math.abs(c)/2))})),d=h[0],f=h[1],p=h[2],v=h[3];e.moveTo(s*d,0),e.lineTo(a-s*f,0),0!==f&&e.arc(a-s*f,l*f,f,-l*Math.PI/2,s>0?0:Math.PI,u),e.lineTo(a,c-l*p),0!==p&&e.arc(a-s*p,c-l*p,p,s>0?0:Math.PI,l>0?Math.PI/2:1.5*Math.PI,u),e.lineTo(s*v,c),0!==v&&e.arc(s*v,c-l*v,v,l>0?Math.PI/2:-Math.PI/2,s>0?Math.PI:0,u),e.lineTo(0,l*d),0!==d&&e.arc(s*d,l*d,d,s>0?Math.PI:0,l>0?1.5*Math.PI:Math.PI/2,u)}else e.rect(0,0,a,c)}t.Module((function(e){e({token:{token:h,named:t.Shape.CIRCLE},useValue:d}),e({token:{token:h,named:t.Shape.ELLIPSE},useValue:f}),e({token:{token:h,named:t.Shape.RECT},useValue:m}),e({token:{token:h,named:t.Shape.LINE},useValue:p}),e({token:{token:h,named:t.Shape.POLYLINE},useValue:g}),e({token:{token:h,named:t.Shape.POLYGON},useValue:y}),e({token:{token:h,named:t.Shape.PATH},useValue:v}),e({token:u,useFactory:function(e){return function(t){return e.container.isBoundNamed(h,t)?e.container.getNamed(h,t):null}}})}));var w="undefined"!=typeof Float32Array?Float32Array:Array;function x(){var e=new w(16);return w!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function b(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function R(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],c=t[4],s=t[5],l=t[6],u=t[7],h=t[8],d=t[9],f=t[10],p=t[11],v=t[12],y=t[13],g=t[14],m=t[15],w=r[0],x=r[1],b=r[2],R=r[3];return e[0]=w*n+x*c+b*h+R*v,e[1]=w*i+x*s+b*d+R*y,e[2]=w*o+x*l+b*f+R*g,e[3]=w*a+x*u+b*p+R*m,e[4]=(w=r[4])*n+(x=r[5])*c+(b=r[6])*h+(R=r[7])*v,e[5]=w*i+x*s+b*d+R*y,e[6]=w*o+x*l+b*f+R*g,e[7]=w*a+x*u+b*p+R*m,e[8]=(w=r[8])*n+(x=r[9])*c+(b=r[10])*h+(R=r[11])*v,e[9]=w*i+x*s+b*d+R*y,e[10]=w*o+x*l+b*f+R*g,e[11]=w*a+x*u+b*p+R*m,e[12]=(w=r[12])*n+(x=r[13])*c+(b=r[14])*h+(R=r[15])*v,e[13]=w*i+x*s+b*d+R*y,e[14]=w*o+x*l+b*f+R*g,e[15]=w*a+x*u+b*p+R*m,e}function E(e,t,r){var n,i,o,a,c,s,l,u,h,d,f,p,v=r[0],y=r[1],g=r[2];return t===e?(e[12]=t[0]*v+t[4]*y+t[8]*g+t[12],e[13]=t[1]*v+t[5]*y+t[9]*g+t[13],e[14]=t[2]*v+t[6]*y+t[10]*g+t[14],e[15]=t[3]*v+t[7]*y+t[11]*g+t[15]):(i=t[1],o=t[2],a=t[3],c=t[4],s=t[5],l=t[6],u=t[7],h=t[8],d=t[9],f=t[10],p=t[11],e[0]=n=t[0],e[1]=i,e[2]=o,e[3]=a,e[4]=c,e[5]=s,e[6]=l,e[7]=u,e[8]=h,e[9]=d,e[10]=f,e[11]=p,e[12]=n*v+c*y+h*g+t[12],e[13]=i*v+s*y+d*g+t[13],e[14]=o*v+l*y+f*g+t[14],e[15]=a*v+u*y+p*g+t[15]),e}function C(){var e=new w(3);return w!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function P(e,t,r){var n=new w(3);return n[0]=e,n[1]=t,n[2]=r,n}function S(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/(a=a||1),e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/a,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/a,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});L=C();var L,O=t.Syringe.defineToken("StyleRendererFactory"),T=t.Syringe.defineToken("CircleRenderer",{multiple:!1}),k=t.Syringe.defineToken("EllipseRenderer",{multiple:!1}),A=t.Syringe.defineToken("RectRenderer",{multiple:!1}),M=t.Syringe.defineToken("LineRenderer",{multiple:!1}),N=t.Syringe.defineToken("PolylineRenderer",{multiple:!1}),j=t.Syringe.defineToken("PolygonRenderer",{multiple:!1}),B=t.Syringe.defineToken("PathRenderer",{multiple:!1}),I=t.Syringe.defineToken("TextRenderer",{multiple:!1}),G=t.Syringe.defineToken("ImageRenderer",{multiple:!1});function F(){ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
F=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i=Object.create((t&&t.prototype instanceof h?t:h).prototype),o=new E(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return P()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===u)continue;return c}}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 s=l(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===u)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,o),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function h(){}function d(){}function f(){}var p={};c(p,i,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(C([])));y&&y!==t&&r.call(y,i)&&(p=y);var g=f.prototype=h.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function n(i,o,a,c){var s=l(e[i],e,o);if("throw"!==s.type){var u=s.arg,h=u.value;return h&&"object"==typeof h&&r.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,a,c)}),(function(e){n("throw",e,a,c)})):t.resolve(h).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,c)}))}c(s.arg)}var i;this._invoke=function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}}function x(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,u;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function C(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return d.prototype=f,c(g,"constructor",f),c(f,"constructor",d),d.displayName=c(f,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,c(e,a,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(w.prototype),c(w.prototype,o,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new w(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(g),c(g,a,"Generator"),c(g,i,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=C,E.prototype={constructor:E,reset:function(e){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(R),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.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 n("end");if(this.prev>=o.tryLoc){var c=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(c&&s){if(o.catchLoc>this.prev)return n(o.catchLoc,!0);if(o.finallyLoc>this.prev)return n(o.finallyLoc)}else if(c){if(o.catchLoc>this.prev)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(o.finallyLoc>this.prev)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(this.prev>=i.tryLoc&&r.call(i,"finallyLoc")&&i.finallyLoc>this.prev){var o=i;break}}o&&("break"===e||"continue"===e)&&t>=o.tryLoc&&o.finallyLoc>=t&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function _(e,t,r,n,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,i)}function D(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){_(o,n,i,a,c,"next",e)}function c(e){_(o,n,i,a,c,"throw",e)}a(void 0)}))}}var V,Y,X=function(){function e(){this.imageCache={},this.gradientCache={},this.patternCache={},this.canvasConfig=void 0}var r=e.prototype;return r.getImageSync=function(e,t){return this.imageCache[e]||this.getOrCreateImage(e).then((function(){t&&t()})),this.imageCache[e]},r.getOrCreateImage=function(e){var r=this;if(this.imageCache[e])return Promise.resolve(this.imageCache[e]);var n=this.canvasConfig.createImage;return new Promise((function(i,o){var a;n?a=n(e):t.isBrowser&&(a=new window.Image),a&&(a.onload=function(){i(a)},a.onerror=function(e){o(e)},a.crossOrigin="Anonymous",a.src=e,r.imageCache[e]=a)}))},r.getOrCreatePatternSync=function(e,r,n){var i=this.generatePatternKey(e);if(i&&this.patternCache[i])return this.patternCache[i];var o,a=e.image,c=e.repetition,s=(o=t.isString(a)?this.getImageSync(a,n):a)&&r.createPattern(o,c);return i&&s&&(this.patternCache[i]=s),s},r.getOrCreateGradient=function(e,r){var n=this.generateGradientKey(e),i=e.type,o=e.steps,a=e.width,c=e.height,s=e.cx,l=e.cy;if(this.gradientCache[n])return this.gradientCache[n];var u=null;if(i===t.GradientType.LinearGradient){var h=t.computeLinearGradient(a,c,e.angle);u=r.createLinearGradient(h.x1,h.y1,h.x2,h.y2)}else if(i===t.GradientType.RadialGradient){var d=t.computeRadialGradient(a,c,s,l),f=d.x,p=d.y;u=r.createRadialGradient(f,p,0,f,p,d.r)}return u&&(o.forEach((function(e){var t;null===(t=u)||void 0===t||t.addColorStop(e[0],e[1])})),this.gradientCache[n]=u),this.gradientCache[n]},r.generateGradientKey=function(e){return"gradient-"+e.type+"-"+(e.angle||0)+"-"+(e.cx||0)+"-"+(e.cy||0)+"-"+e.width+"-"+e.height+"-"+e.steps.map((function(e){return e.join("")})).join("-")},r.generatePatternKey=function(e){var r=e.image,n=e.repetition;if(t.isString(r))return"pattern-"+r+"-"+n},e}();s([t.inject(t.CanvasConfig),l("design:type",Object)],X.prototype,"canvasConfig",void 0),X=s([t.singleton()],X);var U=(V=function(){function e(){this.imagePool=void 0,this.renderingContext=void 0}return e.prototype.apply=function(e){var r=this,n=function(n){var i=n.target;if(i.nodeName===t.Shape.IMAGE){var o=i.attributes.img;t.isString(o)&&r.imagePool.getImageSync(o,(function(){i.renderable.dirty=!0,e.dirtify()}))}},i=function(n){var i=n.target,o=n.newValue;i.nodeName===t.Shape.IMAGE&&"img"===n.attrName&&t.isString(o)&&r.imagePool.getOrCreateImage(o).then((function(){i.renderable.dirty=!0,e.dirtify()}))};e.hooks.init.tapPromise(Y.tag,D(F().mark((function e(){return F().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.renderingContext.root.addEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.addEventListener(t.ElementEvent.ATTR_MODIFIED,i);case 2:case"end":return e.stop()}}),e)})))),e.hooks.destroy.tap(Y.tag,(function(){r.renderingContext.root.removeEventListener(t.ElementEvent.MOUNTED,n),r.renderingContext.root.removeEventListener(t.ElementEvent.ATTR_MODIFIED,i)}))},e}(),V.tag="LoadImage",Y=V);s([t.inject(X),l("design:type",X)],U.prototype,"imagePool",void 0),s([t.inject(t.RenderingContext),l("design:type",Object)],U.prototype,"renderingContext",void 0),U=Y=s([t.singleton({contrib:t.RenderingPluginContribution})],U);t.Module((function(e){e(X),e(U)}));e.ImageRenderer=function(){function e(){this.imagePool=void 0}return e.prototype.render=function(e,r){var n,i=r.img,o=r.width.value,a=r.height.value;if(t.isString(i)?n=this.imagePool.getImageSync(i):(o||(o=i.width),a||(a=i.height),n=i),n)try{e.drawImage(n,0,0,o,a)}catch(e){}},e}(),s([t.inject(X),l("design:type",X)],e.ImageRenderer.prototype,"imagePool",void 0),e.ImageRenderer=s([t.singleton({token:G})],e.ImageRenderer),e.TextRenderer=function(){function e(){}var r=e.prototype;return r.render=function(e,r,n){var i=r.lineWidth,o=r.textAlign,a=r.textBaseline,c=r.lineJoin,s=r.miterLimit,l=r.letterSpacing,u=r.stroke,h=r.fill,d=r.fillOpacity,f=r.strokeOpacity,p=r.opacity,v=r.metrics,y=r.dx,g=r.dy,m=v.lines,w=v.height,x=v.lineHeight,b=v.lineMetrics;e.font=v.font,e.lineWidth=i.value,e.textAlign=o.value,e.textBaseline=a.value,e.lineJoin=c.value,t.isNil(s)||(e.miterLimit=s.value);var R=0;"middle"===a.value?R=-w/2-x/2:"bottom"===a.value||"alphabetic"===a.value||"ideographic"===a.value?R=-w:"top"!==a.value&&"hanging"!==a.value||(R=-x);var E=0;y&&y.unit===t.UnitType.kPixels&&(E+=y.value),g&&g.unit===t.UnitType.kPixels&&(R+=g.value);for(var C=0;m.length>C;C++){var P=i.value/2+E;R+=x,!t.isNil(u)&&!u.isNone&&i&&i.value&&this.drawLetterSpacing(e,m[C],b[C],o.value,P,R,l.value,d.value,f.value,p.value,!0),t.isNil(h)||this.drawLetterSpacing(e,m[C],b[C],o.value,P,R,l.value,d.value,f.value,p.value)}},r.drawLetterSpacing=function(e,t,r,n,i,o,a,c,s,l,u){if(void 0===u&&(u=!1),0!==a){var h=e.textAlign;e.textAlign="left";var d=i;"center"===n?d=i-r.width/2:"right"!==n&&"end"!==n||(d=i-r.width);for(var f=Array.from(t),p=e.measureText(t).width,v=0,y=0;f.length>y;++y){var g=f[y];u?this.strokeText(e,g,d,o,s):this.fillText(e,g,d,o,c,l),d+=p-(v=e.measureText(t.substring(y+1)).width)+a,p=v}e.textAlign=h}else u?this.strokeText(e,t,i,o,s):this.fillText(e,t,i,o,c,l)},r.fillText=function(e,r,n,i,o,a){var c,s=!t.isNil(o)&&1!==o;s&&(c=e.globalAlpha,e.globalAlpha=o*a),e.fillText(r,n,i),s&&(e.globalAlpha=c)},r.strokeText=function(e,r,n,i,o){var a,c=!t.isNil(o)&&1!==o;c&&(a=e.globalAlpha,e.globalAlpha=o),e.strokeText(r,n,i),c&&(e.globalAlpha=a)},e}(),e.TextRenderer=s([t.singleton({token:I})],e.TextRenderer);var W=function(){function e(){this.imagePool=void 0}var r=e.prototype;return r.render=function(e,r,n,i){var o=r.fill,a=r.opacity,c=r.fillOpacity,s=r.stroke,l=r.strokeOpacity,u=r.lineWidth,h=r.lineCap,d=r.lineJoin,f=r.shadowType,p=r.shadowColor,v=r.shadowBlur,y=r.filter,g=r.miterLimit,m=!t.isNil(o)&&!o.isNone,w=!t.isNil(s)&&!s.isNone&&u&&u.value>0,x=0===o.alpha,b=!t.isNil(y),R=!t.isNil(p)&&(null==v?void 0:v.value)>0,E=n.nodeName,C="inner"===(null==f?void 0:f.value),P=w&&R&&(E===t.Shape.PATH||E===t.Shape.LINE||E===t.Shape.POLYLINE||x||C);m&&(e.globalAlpha=a.value*c.value,P||this.setShadowAndFilter(n,e,R),this.fill(e,n,o,i),P||this.clearShadowAndFilter(e,b,R)),w&&(e.globalAlpha=a.value*l.value,e.lineWidth=u.value,t.isNil(g)||(e.miterLimit=g.value),t.isNil(h)||(e.lineCap=h.value),t.isNil(d)||(e.lineJoin=d.value),P&&(C&&(e.globalCompositeOperation="source-atop"),this.setShadowAndFilter(n,e,!0),C&&(this.stroke(e,n,s,i),e.globalCompositeOperation="source-over",this.clearShadowAndFilter(e,b,!0))),this.stroke(e,n,s,i))},r.clearShadowAndFilter=function(e,r,n){if(n&&(e.shadowColor="transparent",e.shadowBlur=0),r){var i=e.filter;!t.isNil(i)&&i.indexOf("drop-shadow")>-1&&(e.filter=i.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},r.setShadowAndFilter=function(e,r,n){var i=e.parsedStyle,o=i.shadowColor,a=i.shadowBlur,c=i.shadowOffsetX,s=i.shadowOffsetY;t.isNil(i.filter)||(r.filter=e.style.filter),n&&(r.shadowColor=o.toString(),r.shadowBlur=a&&a.value||0,r.shadowOffsetX=c&&c.value||0,r.shadowOffsetY=s&&s.value||0)},r.fill=function(e,r,n,i){var o=this;Array.isArray(n)?n.forEach((function(t){e.fillStyle=o.getColor(t,r,e),e.fill()})):(t.isPattern(n)&&(e.fillStyle=this.getPattern(n,r,e,i)),e.fill())},r.stroke=function(e,r,n,i){var o=this;Array.isArray(n)?n.forEach((function(t){e.strokeStyle=o.getColor(t,r,e),e.stroke()})):(t.isPattern(n)&&(e.strokeStyle=this.getPattern(n,r,e,i)),e.stroke())},r.getPattern=function(e,t,r,n){return this.imagePool.getOrCreatePatternSync(e,r,(function(){t.renderable.dirty=!0,n.dirtify()}))},r.getColor=function(e,r,n){var i;if(e.type===t.GradientType.LinearGradient||e.type===t.GradientType.RadialGradient){var a=r.getGeometryBounds();i=this.imagePool.getOrCreateGradient(o({type:e.type},e.value,{width:a&&2*a.halfExtents[0]||1,height:a&&2*a.halfExtents[1]||1}),n)}return i},e}();s([t.inject(X),l("design:type",X)],W.prototype,"imagePool",void 0),W=s([t.singleton()],W),e.RectRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.RectRenderer=s([t.singleton({token:A})],e.RectRenderer),e.CircleRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.CircleRenderer=s([t.singleton({token:T})],e.CircleRenderer),e.EllipseRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.EllipseRenderer=s([t.singleton({token:k})],e.EllipseRenderer),e.LineRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.LineRenderer=s([t.singleton({token:M})],e.LineRenderer),e.PolylineRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.PolylineRenderer=s([t.singleton({token:N})],e.PolylineRenderer),e.PolygonRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.PolygonRenderer=s([t.singleton({token:j})],e.PolygonRenderer),e.PathRenderer=function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(W),e.PathRenderer=s([t.singleton({token:B})],e.PathRenderer);var Q,H,J=t.Syringe.defineToken("CanvasRendererPluginOptions"),K=(Q=function(){function e(){this.canvasConfig=void 0,this.camera=void 0,this.contextService=void 0,this.renderingContext=void 0,this.pathGeneratorFactory=void 0,this.pathGeneratorFactoryCache={},this.styleRendererFactory=void 0,this.styleRendererFactoryCache={},this.displayObjectPool=void 0,this.canvasRendererPluginOptions=void 0,this.rBush=void 0,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=x(),this.dprMatrix=x(),this.tmpMat4=x(),this.tmpVec3=C()}var n=e.prototype;return n.apply=function(e){var n=this,o=this.renderingContext.root.ownerDocument.defaultView,a=function(e){var t=e.target.rBushNode;t.aabb&&n.removedRBushNodeAABBs.push(t.aabb)},c=function(e){var t=e.target.rBushNode;t.aabb&&n.removedRBushNodeAABBs.push(t.aabb)};e.hooks.init.tapPromise(H.tag,i(r().mark((function e(){var i,o,s,l,u;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n.renderingContext.root.addEventListener(t.ElementEvent.UNMOUNTED,a),n.renderingContext.root.addEventListener(t.ElementEvent.CULLED,c),i=n.contextService.getDPR(),s=(o=n.canvasConfig).width,l=o.height,u=n.contextService.getContext(),n.clearRect(u,0,0,s*i,l*i),r=n.dprMatrix,h=P(i,i,1),r[0]=h[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=h[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1;case 7:case"end":return e.stop()}var r,h}),e)})))),e.hooks.destroy.tap(H.tag,(function(){n.renderingContext.root.removeEventListener(t.ElementEvent.UNMOUNTED,a),n.renderingContext.root.removeEventListener(t.ElementEvent.CULLED,c)})),e.hooks.beginFrame.tap(H.tag,(function(){var t=n.contextService.getContext(),r=n.contextService.getDPR(),i=n.canvasConfig,o=i.width,a=i.height,c=n.canvasRendererPluginOptions,s=c.dirtyObjectNumThreshold,l=c.dirtyObjectRatioThreshold,u=e.getStats(),h=u.rendered,d=h/u.total;n.clearFullScreen=e.disableDirtyRectangleRendering()||h>s&&d>l,t&&(t.resetTransform(),n.clearFullScreen&&n.clearRect(t,0,0,o*r,a*r))})),e.hooks.endFrame.tap(H.tag,(function(){var r=n.contextService.getContext();if(R(n.vpMatrix,n.dprMatrix,n.camera.getOrthoMatrix()),n.clearFullScreen)n.renderingContext.root.forEach((function(t){t.isVisible()&&!t.isCulled()&&(n.renderDisplayObject(t,e),n.saveDirtyAABB(t))}));else{var i=n.safeMergeAABB.apply(n,[n.mergeDirtyAABBs(n.renderQueue)].concat(n.removedRBushNodeAABBs.map((function(e){var r=e.minX,n=e.minY,i=e.maxX,o=e.maxY,a=new t.AABB;return a.setMinMax(P(r,n,0),P(i,o,0)),a}))));if(n.removedRBushNodeAABBs=[],t.AABB.isEmpty(i))return void(n.renderQueue=[]);var a=n.convertAABB2Rect(i),c=a.x,s=a.y,l=a.width,u=a.height,h=S(n.tmpVec3,P(c,s,0),n.vpMatrix),d=S(C(),P(c+l,s+u,0),n.vpMatrix),f=Math.floor(h[0]),p=Math.floor(h[1]),v=Math.ceil(d[0]-h[0]),y=Math.ceil(d[1]-h[1]);r.save(),n.clearRect(r,f,p,v,y),r.beginPath(),r.rect(f,p,v,y),r.clip(),r.setTransform(n.vpMatrix[0],n.vpMatrix[1],n.vpMatrix[4],n.vpMatrix[5],n.vpMatrix[12],n.vpMatrix[13]),n.canvasConfig.renderer.getConfig().enableDirtyRectangleRenderingDebug&&o.dispatchEvent(new t.CustomEvent(t.CanvasEvent.DIRTY_RECTANGLE,{dirtyRect:a})),n.searchDirtyObjects(i).sort((function(e,t){return e.sortable.renderOrder-t.sortable.renderOrder})).forEach((function(t){t&&t.isVisible()&&!t.isCulled()&&n.renderDisplayObject(t,e)})),r.restore(),n.renderQueue.forEach((function(e){n.saveDirtyAABB(e)})),n.renderQueue=[]}n.restoreStack.forEach((function(){r.restore()})),n.restoreStack=[]})),e.hooks.render.tap(H.tag,(function(e){n.clearFullScreen||n.renderQueue.push(e)}))},n.clearRect=function(e,t,r,n,i){e.clearRect(t,r,n,i);var o=this.canvasConfig.background;o&&(e.fillStyle=o,e.fillRect(t,r,n,i))},n.renderDisplayObject=function(e,r){for(var n=this.contextService.getContext(),i=this.restoreStack[this.restoreStack.length-1];i&&e.parentNode!==i;)n.restore(),this.restoreStack.pop(),i=this.restoreStack[this.restoreStack.length-1];var o=e.nodeName;void 0===this.styleRendererFactoryCache[o]&&(this.styleRendererFactoryCache[o]=this.styleRendererFactory(o));var a=this.styleRendererFactoryCache[o];void 0===this.pathGeneratorFactoryCache[o]&&(this.pathGeneratorFactoryCache[o]=this.pathGeneratorFactory(o));var c=this.pathGeneratorFactoryCache[o],s=e.parsedStyle.clipPath;if(s){this.applyWorldTransform(n,s,e.getWorldTransform()),void 0===this.pathGeneratorFactoryCache[s.nodeName]&&(this.pathGeneratorFactoryCache[s.nodeName]=this.pathGeneratorFactory(s.nodeName));var l=this.pathGeneratorFactoryCache[s.nodeName];l&&(n.save(),this.restoreStack.push(e),n.beginPath(),l(n,s.parsedStyle),n.closePath(),n.clip())}a&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),c&&(n.beginPath(),c(n,e.parsedStyle),e.nodeName!==t.Shape.LINE&&e.nodeName!==t.Shape.PATH&&e.nodeName!==t.Shape.POLYLINE&&n.closePath()),a&&(a.render(n,e.parsedStyle,e,r),n.restore()),e.renderable.dirty=!1},n.convertAABB2Rect=function(e){var t=e.getMin(),r=e.getMax(),n=Math.floor(t[0]),i=Math.floor(t[1]);return{x:n,y:i,width:Math.ceil(r[0])-n,height:Math.ceil(r[1])-i}},n.mergeDirtyAABBs=function(e){var r=new t.AABB;return e.forEach((function(e){var t=e.getRenderBounds();r.add(t);var n=e.renderable.dirtyRenderBounds;n&&r.add(n)})),r},n.searchDirtyObjects=function(e){var t=this,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(e){var r=e.renderable;r.dirtyRenderBounds||(r.dirtyRenderBounds=new t.AABB);var n=e.getRenderBounds();n&&r.dirtyRenderBounds.update(n.center,n.halfExtents)},n.applyAttributesToContext=function(e,r){var n=r.parsedStyle,i=n.stroke,o=n.fill,a=n.opacity,c=n.lineDash,s=n.lineDashOffset;c&&Array.isArray(c)&&e.setLineDash(c.map((function(e){return e.value}))),t.isNil(s)||(e.lineDashOffset=s.value),t.isNil(a)||(e.globalAlpha*=a.value),t.isNil(i)||Array.isArray(i)||i.isNone||(e.strokeStyle=r.attributes.stroke),t.isNil(o)||Array.isArray(o)||o.isNone||(e.fillStyle=r.attributes.fill)},n.applyWorldTransform=function(e,t,r){var n=0,i=0,o=(t.parsedStyle||{}).anchor,a=o&&o[0].value||0,c=o&&o[1].value||0;if(0!==a||0!==c){var s=t.getGeometryBounds();n=-a*(s&&2*s.halfExtents[0]||0),i=-c*(s&&2*s.halfExtents[1]||0)}r?(b(this.tmpMat4,t.getLocalTransform()),this.tmpVec3[0]=n,this.tmpVec3[1]=i,this.tmpVec3[2]=0,E(this.tmpMat4,this.tmpMat4,this.tmpVec3),R(this.tmpMat4,r,this.tmpMat4),R(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(b(this.tmpMat4,t.getWorldTransform()),this.tmpVec3[0]=n,this.tmpVec3[1]=i,this.tmpVec3[2]=0,E(this.tmpMat4,this.tmpMat4,this.tmpVec3),R(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},n.safeMergeAABB=function(){for(var e=new t.AABB,r=arguments.length,n=new Array(r),i=0;r>i;i++)n[i]=arguments[i];return n.forEach((function(t){e.add(t)})),e},e}(),Q.tag="CanvasRenderer",H=Q);s([t.inject(t.CanvasConfig),l("design:type",Object)],K.prototype,"canvasConfig",void 0),s([t.inject(t.DefaultCamera),l("design:type",t.Camera)],K.prototype,"camera",void 0),s([t.inject(t.ContextService),l("design:type",Object)],K.prototype,"contextService",void 0),s([t.inject(t.RenderingContext),l("design:type",Object)],K.prototype,"renderingContext",void 0),s([t.inject(u),l("design:type",Function)],K.prototype,"pathGeneratorFactory",void 0),s([t.inject(O),l("design:type",Function)],K.prototype,"styleRendererFactory",void 0),s([t.inject(t.DisplayObjectPool),l("design:type",t.DisplayObjectPool)],K.prototype,"displayObjectPool",void 0),s([t.inject(J),l("design:type",Object)],K.prototype,"canvasRendererPluginOptions",void 0),s([t.inject(t.RBushRoot),l("design:type",t.RBush)],K.prototype,"rBush",void 0),K=H=s([t.singleton({contrib:t.RenderingPluginContribution})],K);var q=t.Module((function(r){var n;r(e.CircleRenderer),r(e.EllipseRenderer),r(e.RectRenderer),r(e.ImageRenderer),r(e.TextRenderer),r(e.LineRenderer),r(e.PolylineRenderer),r(e.PolygonRenderer),r(e.PathRenderer);var i=((n={})[t.Shape.CIRCLE]=T,n[t.Shape.ELLIPSE]=k,n[t.Shape.RECT]=A,n[t.Shape.IMAGE]=G,n[t.Shape.TEXT]=I,n[t.Shape.LINE]=M,n[t.Shape.POLYLINE]=N,n[t.Shape.POLYGON]=j,n[t.Shape.PATH]=B,n);r({token:O,useFactory:function(e){return function(t){var r=i[t];return r&&e.container.isBound(r)?e.container.get(r):null}}}),r(K)})),z=function(e){function t(t){var r;return void 0===t&&(t={}),(r=e.call(this)||this).options=void 0,r.name="canvas-renderer",r.options=t,r}a(t,e);var r=t.prototype;return r.init=function(){this.container.register(J,{useValue:o({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options)}),this.container.load(q,!0)},r.destroy=function(){this.container.unload(q),this.container.remove(J)},t}(t.AbstractRendererPlugin);e.CircleRendererContribution=T,e.EllipseRendererContribution=k,e.ImageRendererContribution=G,e.LineRendererContribution=M,e.PathRendererContribution=B,e.Plugin=z,e.PolygonRendererContribution=j,e.PolylineRendererContribution=N,e.RectRendererContribution=A,e.StyleRendererFactory=O,e.TextRendererContribution=I,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -6,2 +6,7 @@ import type { DisplayObject, ParsedBaseStyleProps, RenderingService } from '@antv/g'; | ||
render(context: CanvasRenderingContext2D, parsedStyle: ParsedBaseStyleProps, object: DisplayObject, renderingService: RenderingService): void; | ||
private clearShadowAndFilter; | ||
/** | ||
* apply before fill and stroke but only once | ||
*/ | ||
private setShadowAndFilter; | ||
private fill; | ||
@@ -8,0 +13,0 @@ private stroke; |
{ | ||
"name": "@antv/g-plugin-canvas-renderer", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "A G plugin of renderer implementation with Canvas2D API", | ||
@@ -30,3 +30,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@antv/g-math": "^1.6.0-alpha.0", | ||
"@antv/g-math": "^1.6.0", | ||
"@antv/g-plugin-canvas-path-generator": "^1.0.1", | ||
"@antv/g-plugin-image-loader": "^1.0.1", | ||
"tslib": "^2.3.1" | ||
@@ -38,5 +40,3 @@ }, | ||
"peerDependencies": { | ||
"@antv/g": "^5.0.1", | ||
"@antv/g-plugin-canvas-path-generator": "^0.0.0", | ||
"@antv/g-plugin-image-loader": "^0.0.0" | ||
"@antv/g": "^5.0.1" | ||
}, | ||
@@ -46,3 +46,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "5e346e68fda61488806180f03564e4d340ae91c3" | ||
"gitHead": "200fd2696d8e94946e7ad095288dffd437e37334" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
266027
5618
+ Added@antv/g-plugin-canvas-path-generator@1.3.24(transitive)
+ Added@antv/g-plugin-image-loader@1.3.24(transitive)
Updated@antv/g-math@^1.6.0