@antv/g 5.12.0 → 5.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -5298,16 +5298,11 @@
5298
5298
  return result[0].length === result[1].length ? result : equalizeSegments(result[0], result[1], tl);
5299
5299
  }
5300
5300
 
5301
- var toString = {}.toString;
5302
- var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
5303
-
5304
5301
  /**
5305
- * 是否为函数
5306
- * @param {*} fn 对象
5307
- * @return {Boolean} 是否函数
5302
+ * @see https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_isfunction
5308
5303
  */
5309
5304
  var isFunction = (function (value) {
5310
- return isType(value, 'Function');
5305
+ return typeof value === 'function';
5311
5306
  });
5312
5307
 
5313
5308
  // isFinite,
@@ -5319,6 +5314,9 @@
5319
5314
  return value === null || value === undefined;
5320
5315
  };
5321
5316
 
5317
+ var toString = {}.toString;
5318
+ var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
5319
+
5322
5320
  var isObject = (function (value) {
5323
5321
  /**
5324
5322
  * isObject({}) => true
@@ -6495,7 +6493,7 @@
6495
6493
  * Axis-Aligned Bounding Box
6496
6494
  * 为了便于后续 Frustum Culling,通过查找表定义 p-vertex 和 n-vertex
6497
6495
  * @see https://github.com/antvis/GWebGPUEngine/issues/3
6498
- */var AABB=/*#__PURE__*/function(){AABB.isEmpty=function isEmpty(aabb){return !aabb||aabb.halfExtents[0]===0&&aabb.halfExtents[1]===0&&aabb.halfExtents[2]===0;};function AABB(center,halfExtents){this.center=create$2();this.halfExtents=create$2();this.min=create$2();this.max=create$2();this.update(center,halfExtents);}var _proto=AABB.prototype;_proto.update=function update(center,halfExtents){if(center){copy$1(this.center,center);}if(halfExtents){copy$1(this.halfExtents,halfExtents||fromValues$2(0,0,0));}this.min=sub$1(this.min,this.center,this.halfExtents);this.max=add$1(this.max,this.center,this.halfExtents);};_proto.setMinMax=function setMinMax(min,max){add$1(this.center,max,min);scale$1(this.center,this.center,0.5);sub$1(this.halfExtents,max,min);scale$1(this.halfExtents,this.halfExtents,0.5);copy$1(this.min,min);copy$1(this.max,max);};_proto.getMin=function getMin(){return this.min;};_proto.getMax=function getMax(){return this.max;};_proto.add=function add(aabb){if(AABB.isEmpty(aabb)){return;}if(AABB.isEmpty(this)){this.setMinMax(aabb.getMin(),aabb.getMax());return;}var tc=this.center;var tcx=tc[0];var tcy=tc[1];var tcz=tc[2];var th=this.halfExtents;var thx=th[0];var thy=th[1];var thz=th[2];var tminx=tcx-thx;var tmaxx=tcx+thx;var tminy=tcy-thy;var tmaxy=tcy+thy;var tminz=tcz-thz;var tmaxz=tcz+thz;var oc=aabb.center;var ocx=oc[0];var ocy=oc[1];var ocz=oc[2];var oh=aabb.halfExtents;var ohx=oh[0];var ohy=oh[1];var ohz=oh[2];var ominx=ocx-ohx;var omaxx=ocx+ohx;var ominy=ocy-ohy;var omaxy=ocy+ohy;var ominz=ocz-ohz;var omaxz=ocz+ohz;if(ominx<tminx){tminx=ominx;}if(omaxx>tmaxx){tmaxx=omaxx;}if(ominy<tminy){tminy=ominy;}if(omaxy>tmaxy){tmaxy=omaxy;}if(ominz<tminz){tminz=ominz;}if(omaxz>tmaxz){tmaxz=omaxz;}tc[0]=(tminx+tmaxx)*0.5;tc[1]=(tminy+tmaxy)*0.5;tc[2]=(tminz+tmaxz)*0.5;th[0]=(tmaxx-tminx)*0.5;th[1]=(tmaxy-tminy)*0.5;th[2]=(tmaxz-tminz)*0.5;this.min[0]=tminx;this.min[1]=tminy;this.min[2]=tminz;this.max[0]=tmaxx;this.max[1]=tmaxy;this.max[2]=tmaxz;};_proto.setFromTransformedAABB=function setFromTransformedAABB(aabb,m){var bc=this.center;var br=this.halfExtents;var ac=aabb.center;var ar=aabb.halfExtents;var mx0=m[0];var mx1=m[4];var mx2=m[8];var my0=m[1];var my1=m[5];var my2=m[9];var mz0=m[2];var mz1=m[6];var mz2=m[10];var mx0a=Math.abs(mx0);var mx1a=Math.abs(mx1);var mx2a=Math.abs(mx2);var my0a=Math.abs(my0);var my1a=Math.abs(my1);var my2a=Math.abs(my2);var mz0a=Math.abs(mz0);var mz1a=Math.abs(mz1);var mz2a=Math.abs(mz2);set$1(bc,m[12]+mx0*ac[0]+mx1*ac[1]+mx2*ac[2],m[13]+my0*ac[0]+my1*ac[1]+my2*ac[2],m[14]+mz0*ac[0]+mz1*ac[1]+mz2*ac[2]);set$1(br,mx0a*ar[0]+mx1a*ar[1]+mx2a*ar[2],my0a*ar[0]+my1a*ar[1]+my2a*ar[2],mz0a*ar[0]+mz1a*ar[1]+mz2a*ar[2]);this.min=sub$1(this.min,bc,br);this.max=add$1(this.max,bc,br);};_proto.intersects=function intersects(aabb){var aMax=this.getMax();var aMin=this.getMin();var bMax=aabb.getMax();var bMin=aabb.getMin();return aMin[0]<=bMax[0]&&aMax[0]>=bMin[0]&&aMin[1]<=bMax[1]&&aMax[1]>=bMin[1]&&aMin[2]<=bMax[2]&&aMax[2]>=bMin[2];};_proto.intersection=function intersection(aabb){if(!this.intersects(aabb)){return null;}var intersection=new AABB();var min$1=max(create$2(),this.getMin(),aabb.getMin());var max$1=min(create$2(),this.getMax(),aabb.getMax());intersection.setMinMax(min$1,max$1);return intersection;};_proto.containsPoint=function containsPoint(point){var min=this.getMin();var max=this.getMax();return !(point[0]<min[0]||point[0]>max[0]||point[1]<min[1]||point[1]>max[1]||point[2]<min[2]||point[2]>max[2]);}/**
6496
+ */var AABB=/*#__PURE__*/function(){AABB.isEmpty=function isEmpty(aabb){return !aabb||aabb.halfExtents[0]===0&&aabb.halfExtents[1]===0&&aabb.halfExtents[2]===0;};function AABB(center,halfExtents){if(center===void 0){center=[0,0,0];}if(halfExtents===void 0){halfExtents=[0,0,0];}this.center=create$2();this.halfExtents=create$2();this.min=create$2();this.max=create$2();this.update(center,halfExtents);}var _proto=AABB.prototype;_proto.update=function update(center,halfExtents){copy$1(this.center,center);copy$1(this.halfExtents,halfExtents);sub$1(this.min,this.center,this.halfExtents);add$1(this.max,this.center,this.halfExtents);};_proto.setMinMax=function setMinMax(min,max){add$1(this.center,max,min);scale$1(this.center,this.center,0.5);sub$1(this.halfExtents,max,min);scale$1(this.halfExtents,this.halfExtents,0.5);copy$1(this.min,min);copy$1(this.max,max);};_proto.getMin=function getMin(){return this.min;};_proto.getMax=function getMax(){return this.max;};_proto.add=function add(aabb){if(AABB.isEmpty(aabb)){return;}if(AABB.isEmpty(this)){this.setMinMax(aabb.getMin(),aabb.getMax());return;}var tc=this.center;var tcx=tc[0];var tcy=tc[1];var tcz=tc[2];var th=this.halfExtents;var thx=th[0];var thy=th[1];var thz=th[2];var tminx=tcx-thx;var tmaxx=tcx+thx;var tminy=tcy-thy;var tmaxy=tcy+thy;var tminz=tcz-thz;var tmaxz=tcz+thz;var oc=aabb.center;var ocx=oc[0];var ocy=oc[1];var ocz=oc[2];var oh=aabb.halfExtents;var ohx=oh[0];var ohy=oh[1];var ohz=oh[2];var ominx=ocx-ohx;var omaxx=ocx+ohx;var ominy=ocy-ohy;var omaxy=ocy+ohy;var ominz=ocz-ohz;var omaxz=ocz+ohz;if(ominx<tminx){tminx=ominx;}if(omaxx>tmaxx){tmaxx=omaxx;}if(ominy<tminy){tminy=ominy;}if(omaxy>tmaxy){tmaxy=omaxy;}if(ominz<tminz){tminz=ominz;}if(omaxz>tmaxz){tmaxz=omaxz;}tc[0]=(tminx+tmaxx)*0.5;tc[1]=(tminy+tmaxy)*0.5;tc[2]=(tminz+tmaxz)*0.5;th[0]=(tmaxx-tminx)*0.5;th[1]=(tmaxy-tminy)*0.5;th[2]=(tmaxz-tminz)*0.5;this.min[0]=tminx;this.min[1]=tminy;this.min[2]=tminz;this.max[0]=tmaxx;this.max[1]=tmaxy;this.max[2]=tmaxz;};_proto.setFromTransformedAABB=function setFromTransformedAABB(aabb,m){var bc=this.center;var br=this.halfExtents;var ac=aabb.center;var ar=aabb.halfExtents;var mx0=m[0];var mx1=m[4];var mx2=m[8];var my0=m[1];var my1=m[5];var my2=m[9];var mz0=m[2];var mz1=m[6];var mz2=m[10];var mx0a=Math.abs(mx0);var mx1a=Math.abs(mx1);var mx2a=Math.abs(mx2);var my0a=Math.abs(my0);var my1a=Math.abs(my1);var my2a=Math.abs(my2);var mz0a=Math.abs(mz0);var mz1a=Math.abs(mz1);var mz2a=Math.abs(mz2);set$1(bc,m[12]+mx0*ac[0]+mx1*ac[1]+mx2*ac[2],m[13]+my0*ac[0]+my1*ac[1]+my2*ac[2],m[14]+mz0*ac[0]+mz1*ac[1]+mz2*ac[2]);set$1(br,mx0a*ar[0]+mx1a*ar[1]+mx2a*ar[2],my0a*ar[0]+my1a*ar[1]+my2a*ar[2],mz0a*ar[0]+mz1a*ar[1]+mz2a*ar[2]);this.min=sub$1(this.min,bc,br);this.max=add$1(this.max,bc,br);};_proto.intersects=function intersects(aabb){var aMax=this.getMax();var aMin=this.getMin();var bMax=aabb.getMax();var bMin=aabb.getMin();return aMin[0]<=bMax[0]&&aMax[0]>=bMin[0]&&aMin[1]<=bMax[1]&&aMax[1]>=bMin[1]&&aMin[2]<=bMax[2]&&aMax[2]>=bMin[2];};_proto.intersection=function intersection(aabb){if(!this.intersects(aabb)){return null;}var intersection=new AABB();var min$1=max(create$2(),this.getMin(),aabb.getMin());var max$1=min(create$2(),this.getMax(),aabb.getMax());intersection.setMinMax(min$1,max$1);return intersection;};_proto.containsPoint=function containsPoint(point){var min=this.getMin();var max=this.getMax();return !(point[0]<min[0]||point[0]>max[0]||point[1]<min[1]||point[1]>max[1]||point[2]<min[2]||point[2]>max[2]);}/**
6499
6497
  * get n-vertex
6500
6498
  * @param plane plane of CullingVolume
6501
6499
  */;_proto.getNegativeFarPoint=function getNegativeFarPoint(plane){if(plane.pnVertexFlag===0x111){return copy$1(create$2(),this.min);}else if(plane.pnVertexFlag===0x110){return fromValues$2(this.min[0],this.min[1],this.max[2]);}else if(plane.pnVertexFlag===0x101){return fromValues$2(this.min[0],this.max[1],this.min[2]);}else if(plane.pnVertexFlag===0x100){return fromValues$2(this.min[0],this.max[1],this.max[2]);}else if(plane.pnVertexFlag===0x011){return fromValues$2(this.max[0],this.min[1],this.min[2]);}else if(plane.pnVertexFlag===0x010){return fromValues$2(this.max[0],this.min[1],this.max[2]);}else if(plane.pnVertexFlag===0x001){return fromValues$2(this.max[0],this.max[1],this.min[2]);}else {return fromValues$2(this.max[0],this.max[1],this.max[2]);}}/**
@@ -6513,7 +6511,7 @@
6513
6511
  set$1(this.planes[2].normal,m3+m1,m7+m5,m11+m9);this.planes[2].distance=m15+m13;// top
6514
6512
  set$1(this.planes[3].normal,m3-m1,m7-m5,m11-m9);this.planes[3].distance=m15-m13;// far
6515
6513
  set$1(this.planes[4].normal,m3-m2,m7-m6,m11-m10);this.planes[4].distance=m15-m14;// near
6516
- set$1(this.planes[5].normal,m3+m2,m7+m6,m11+m10);this.planes[5].distance=m15+m14;this.planes.forEach(function(plane){plane.normalize();plane.updatePNVertexFlag();});};return Frustum;}();var Point=/*#__PURE__*/function(){function Point(x,y){if(x===void 0){x=0;}if(y===void 0){y=0;}this.x=0;this.y=0;this.x=x;this.y=y;}var _proto=Point.prototype;_proto.clone=function clone(){return new Point(this.x,this.y);};_proto.copyFrom=function copyFrom(p){this.x=p.x;this.y=p.y;};return Point;}();var Rectangle=/*#__PURE__*/function(){function Rectangle(x,y,width,height){this.x=void 0;this.y=void 0;this.width=void 0;this.height=void 0;this.left=void 0;this.right=void 0;this.top=void 0;this.bottom=void 0;this.x=x;this.y=y;this.width=width;this.height=height;this.left=x;this.right=x+width;this.top=y;this.bottom=y+height;}var _proto=Rectangle.prototype;_proto.toJSON=function toJSON(){};return Rectangle;}();(function(Shape){Shape["GROUP"]="g";Shape["CIRCLE"]="circle";Shape["ELLIPSE"]="ellipse";Shape["IMAGE"]="image";Shape["RECT"]="rect";Shape["LINE"]="line";Shape["POLYLINE"]="polyline";Shape["POLYGON"]="polygon";Shape["TEXT"]="text";Shape["PATH"]="path";Shape["HTML"]="html";Shape["MESH"]="mesh";})(exports.Shape||(exports.Shape={}));var camelCase=memoize(function(str){if(str===void 0){str='';}return str.replace(/-([a-z])/g,function(g){return g[1].toUpperCase();});});function DCHECK(bool){if(!bool){throw new Error();}}function DCHECK_EQ(a,b){if(a!==b){throw new Error();}}function DCHECK_NE(a,b){if(a===b){throw new Error();}}function isFunction$1(func){return typeof func==='function';}var definedProps=function definedProps(obj){return Object.fromEntries(Object.entries(obj).filter(function(_ref){var v=_ref[1];return v!==undefined;}));};var FORMAT_ATTR_MAP={d:{alias:'path'},strokeDasharray:{alias:'lineDash'},strokeWidth:{alias:'lineWidth'},textAnchor:{alias:'textAlign',values:{middle:'center'}},src:{alias:'img'}};var formatAttributeName=memoize(function(name){var attributeName=camelCase(name);var map=FORMAT_ATTR_MAP[attributeName];attributeName=(map===null||map===void 0?void 0:map.alias)||attributeName;return [attributeName,map];});function formatAttribute(name,value){var _map$values;var _formatAttributeName=formatAttributeName(name),attributeName=_formatAttributeName[0],map=_formatAttributeName[1];var attributeValue=isString(value)&&(map===null||map===void 0?void 0:(_map$values=map.values)===null||_map$values===void 0?void 0:_map$values[value])||value;return [attributeName,attributeValue];}var canvasMap={};var defaultCanvasIdCounter=0;/**
6514
+ set$1(this.planes[5].normal,m3+m2,m7+m6,m11+m10);this.planes[5].distance=m15+m14;this.planes.forEach(function(plane){plane.normalize();plane.updatePNVertexFlag();});};return Frustum;}();var Point=/*#__PURE__*/function(){function Point(x,y){if(x===void 0){x=0;}if(y===void 0){y=0;}this.x=0;this.y=0;this.x=x;this.y=y;}var _proto=Point.prototype;_proto.clone=function clone(){return new Point(this.x,this.y);};_proto.copyFrom=function copyFrom(p){this.x=p.x;this.y=p.y;};return Point;}();var Rectangle=/*#__PURE__*/function(){function Rectangle(x,y,width,height){this.x=void 0;this.y=void 0;this.width=void 0;this.height=void 0;this.left=void 0;this.right=void 0;this.top=void 0;this.bottom=void 0;this.x=x;this.y=y;this.width=width;this.height=height;this.left=x;this.right=x+width;this.top=y;this.bottom=y+height;}var _proto=Rectangle.prototype;_proto.toJSON=function toJSON(){};return Rectangle;}();(function(Shape){Shape["GROUP"]="g";Shape["CIRCLE"]="circle";Shape["ELLIPSE"]="ellipse";Shape["IMAGE"]="image";Shape["RECT"]="rect";Shape["LINE"]="line";Shape["POLYLINE"]="polyline";Shape["POLYGON"]="polygon";Shape["TEXT"]="text";Shape["PATH"]="path";Shape["HTML"]="html";Shape["MESH"]="mesh";})(exports.Shape||(exports.Shape={}));var camelCase=memoize(function(str){if(str===void 0){str='';}return str.replace(/-([a-z])/g,function(g){return g[1].toUpperCase();});});function DCHECK(bool){if(!bool){throw new Error();}}function DCHECK_EQ(a,b){if(a!==b){throw new Error();}}function DCHECK_NE(a,b){if(a===b){throw new Error();}}function isFunction$1(func){return typeof func==='function';}var definedProps=function definedProps(obj){return Object.fromEntries(Object.entries(obj).filter(function(_ref){var v=_ref[1];return v!==undefined;}));};var FORMAT_ATTR_MAP={d:{alias:'path'},strokeDasharray:{alias:'lineDash'},strokeWidth:{alias:'lineWidth'},textAnchor:{alias:'textAlign'},src:{alias:'img'}};var formatAttributeName=memoize(function(name){var attributeName=camelCase(name);var map=FORMAT_ATTR_MAP[attributeName];attributeName=(map===null||map===void 0?void 0:map.alias)||attributeName;return attributeName;});var canvasMap={};var defaultCanvasIdCounter=0;/**
6517
6515
  * destroy existed canvas with the same id
6518
6516
  */function cleanExistedCanvas(container,canvas){if(container){var id=typeof container==='string'?container:container.id||defaultCanvasIdCounter++;if(canvasMap[id]){canvasMap[id].destroy();}canvasMap[id]=canvas;}}var isBrowser=typeof window!=='undefined'&&typeof window.document!=='undefined';function sortByZIndex(o1,o2){var zIndex1=Number(o1.style.zIndex);var zIndex2=Number(o2.style.zIndex);if(zIndex1===zIndex2){// return o1.entity.getComponent(Sortable).lastSortedIndex - o2.entity.getComponent(Sortable).lastSortedIndex;
6519
6517
  var parent=o1.parentNode;if(parent){var children=parent.childNodes||[];return children.indexOf(o1)-children.indexOf(o2);}}return zIndex1-zIndex2;}function findClosestClipPathTarget(object){var el=object;do{var _el$style;var clipPath=(_el$style=el.style)===null||_el$style===void 0?void 0:_el$style.clipPath;if(clipPath)return el;el=el.parentElement;}while(el!==null);return null;}var PX_SUFFIX='px';function setDOMSize($el,width,height){if(isBrowser&&$el.style){$el.style.width=width+PX_SUFFIX;$el.style.height=height+PX_SUFFIX;}}function getStyle($el,property){if(isBrowser){return document.defaultView.getComputedStyle($el,null).getPropertyValue(property);}}function getWidth($el){var width=getStyle($el,'width');if(width==='auto'){return $el.offsetWidth;}return parseFloat(width);}function getHeight($el){var height=getStyle($el,'height');if(height==='auto'){return $el.offsetHeight;}return parseFloat(height);}var ERROR_MSG_METHOD_NOT_IMPLEMENTED='Method not implemented.';var ERROR_MSG_USE_DOCUMENT_ELEMENT='Use document.documentElement instead.';// borrow from hammer.js
@@ -7352,7 +7350,8 @@
7352
7350
  * update local position
7353
7351
  */_proto.postProcessor=function postProcessor(object){var x;var y;var z;switch(object.nodeName){case exports.Shape.CIRCLE:case exports.Shape.ELLIPSE:var _object$parsedStyle=object.parsedStyle,cx=_object$parsedStyle.cx,cy=_object$parsedStyle.cy;if(!isNil(cx)){x=cx;}if(!isNil(cy)){y=cy;}break;case exports.Shape.LINE:var _object$parsedStyle2=object.parsedStyle,x1=_object$parsedStyle2.x1,x2=_object$parsedStyle2.x2,y1=_object$parsedStyle2.y1,y2=_object$parsedStyle2.y2;var minX=Math.min(x1,x2);var minY=Math.min(y1,y2);x=minX;y=minY;z=0;break;case exports.Shape.RECT:case exports.Shape.IMAGE:case exports.Shape.GROUP:case exports.Shape.HTML:case exports.Shape.TEXT:case exports.Shape.MESH:if(!isNil(object.parsedStyle.x)){x=object.parsedStyle.x;}if(!isNil(object.parsedStyle.y)){y=object.parsedStyle.y;}break;}if(object.nodeName!==exports.Shape.PATH&&object.nodeName!==exports.Shape.POLYLINE&&object.nodeName!==exports.Shape.POLYGON){object.parsedStyle.defX=x||0;object.parsedStyle.defY=y||0;}var needResetLocalPosition=!isNil(x)||!isNil(y)||!isNil(z);if(needResetLocalPosition){var _object$getLocalPosit=object.getLocalPosition(),ox=_object$getLocalPosit[0],oy=_object$getLocalPosit[1],oz=_object$getLocalPosit[2];object.setLocalPosition(isNil(x)?ox:x,isNil(y)?oy:y,isNil(z)?oz:z);}};return CSSPropertyLocalPosition;}(CSSPropertyLengthOrPercentage);var CSSPropertyMarker=/*#__PURE__*/function(){function CSSPropertyMarker(){}var _proto=CSSPropertyMarker.prototype;_proto.calculator=function calculator(name,oldMarker,newMarker,object){var _newMarker;// unset
7354
7352
  if(newMarker instanceof CSSKeywordValue){newMarker=null;}var cloned=(_newMarker=newMarker)===null||_newMarker===void 0?void 0:_newMarker.cloneNode(true);if(cloned){// FIXME: SVG should not inherit parent's style, add a flag here
7355
- cloned.style.isMarker=true;}return cloned;};return CSSPropertyMarker;}();var CSSPropertyNumber=/*#__PURE__*/function(){function CSSPropertyNumber(){this.mixer=mergeNumbers;this.parser=parseNumber;}var _proto=CSSPropertyNumber.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};return CSSPropertyNumber;}();var CSSPropertyOffsetDistance=/*#__PURE__*/function(){function CSSPropertyOffsetDistance(){this.parser=parseNumber;this.mixer=clampedMergeNumbers(0,1);}var _proto=CSSPropertyOffsetDistance.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};_proto.postProcessor=function postProcessor(object){if(!object.attributes.offsetPath){return;}var offsetPathNodeName=object.attributes.offsetPath.nodeName;if(offsetPathNodeName===exports.Shape.LINE||offsetPathNodeName===exports.Shape.PATH||offsetPathNodeName===exports.Shape.POLYLINE){var point=object.attributes.offsetPath.getPoint(object.parsedStyle.offsetDistance);if(point){object.setLocalPosition(point.x,point.y);}}};return CSSPropertyOffsetDistance;}();/**
7353
+ cloned.style.isMarker=true;}return cloned;};return CSSPropertyMarker;}();var CSSPropertyNumber=/*#__PURE__*/function(){function CSSPropertyNumber(){this.mixer=mergeNumbers;this.parser=parseNumber;}var _proto=CSSPropertyNumber.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};return CSSPropertyNumber;}();var CSSPropertyOffsetDistance=/*#__PURE__*/function(){function CSSPropertyOffsetDistance(){this.parser=parseNumber;this.mixer=clampedMergeNumbers(0,1);}var _proto=CSSPropertyOffsetDistance.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};_proto.postProcessor=function postProcessor(object){var _object$parsedStyle=object.parsedStyle,offsetPath=_object$parsedStyle.offsetPath,offsetDistance=_object$parsedStyle.offsetDistance;if(!offsetPath){return;}var nodeName=offsetPath.nodeName;if(nodeName===exports.Shape.LINE||nodeName===exports.Shape.PATH||nodeName===exports.Shape.POLYLINE){// set position in world space
7354
+ var point=offsetPath.getPoint(offsetDistance);if(point){object.parsedStyle.defX=point.x;object.parsedStyle.defY=point.y;object.setLocalPosition(point.x,point.y);}}};return CSSPropertyOffsetDistance;}();/**
7356
7355
  * opacity
7357
7356
  */var CSSPropertyOpacity=/*#__PURE__*/function(){function CSSPropertyOpacity(){this.parser=parseNumber;this.mixer=clampedMergeNumbers(0,1);}var _proto=CSSPropertyOpacity.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};return CSSPropertyOpacity;}();var CSSPropertyPath=/*#__PURE__*/function(){function CSSPropertyPath(){this.parser=parsePath;this.mixer=mergePaths;}var _proto=CSSPropertyPath.prototype;_proto.calculator=function calculator(name,oldParsed,parsed){// unset
7358
7357
  if(parsed instanceof CSSKeywordValue&&parsed.value==='unset'){return {absolutePath:[],hasArc:false,segments:[],polygons:[],polylines:[],curve:[],totalLength:0,zCommandIndexes:[],rect:new Rectangle(0,0,0,0)};}return parsed;};/**
@@ -7588,14 +7587,14 @@
7588
7587
  // return hook;
7589
7588
  // }
7590
7589
  // SyncWaterfallHook.prototype = null;
7591
- var genericFontFamilies=['serif','sans-serif','monospace','cursive','fantasy','system-ui'];function toFontString(attributes){var fontSize=attributes.fontSize,fontFamily=attributes.fontFamily,fontStyle=attributes.fontStyle,fontVariant=attributes.fontVariant,fontWeight=attributes.fontWeight;// build canvas api font setting from individual components. Convert a numeric this.fontSize to px
7590
+ var genericFontFamilies=['serif','sans-serif','monospace','cursive','fantasy','system-ui'];var stringRegExp=/([\"\'])[^\'\"]+\1/;function toFontString(attributes){var fontSize=attributes.fontSize,fontFamily=attributes.fontFamily,fontStyle=attributes.fontStyle,fontVariant=attributes.fontVariant,fontWeight=attributes.fontWeight;// build canvas api font setting from individual components. Convert a numeric this.fontSize to px
7592
7591
  // const fontSizeString: string = isNumber(fontSize) ? `${fontSize}px` : fontSize.toString();
7593
7592
  var fontSizeString=isNumber(fontSize)&&fontSize+"px"||'16px';// Clean-up fontFamily property by quoting each font name
7594
7593
  // this will support font names with spaces
7595
7594
  // @ts-ignore
7596
7595
  var fontFamilies=isString(fontFamily)?fontFamily.split(','):[fontFamily];for(var i=fontFamilies.length-1;i>=0;i--){// Trim any extra white-space
7597
7596
  var _fontFamily=fontFamilies[i].trim();// Check if font already contains strings
7598
- if(!/([\"\'])[^\'\"]+\1/.test(_fontFamily)&&genericFontFamilies.indexOf(_fontFamily)<0){_fontFamily="\""+_fontFamily+"\"";}fontFamilies[i]=_fontFamily;}return fontStyle+" "+fontVariant+" "+fontWeight+" "+fontSizeString+" "+fontFamilies.join(',');}/**
7597
+ if(!stringRegExp.test(_fontFamily)&&genericFontFamilies.indexOf(_fontFamily)<0){_fontFamily="\""+_fontFamily+"\"";}fontFamilies[i]=_fontFamily;}return fontStyle+" "+fontVariant+" "+fontWeight+" "+fontSizeString+" "+fontFamilies.join(',');}/**
7599
7598
  * Blink used them in code generation(css_properties.json5)
7600
7599
  */var BUILT_IN_PROPERTIES=[{/**
7601
7600
  * used in CSS Layout API
@@ -7641,11 +7640,11 @@
7641
7640
  {n:'text',l:true,d:'',syntax:exports.PropertySyntax.TEXT,p:50},{n:'textTransform',l:true,inh:true,k:['capitalize','uppercase','lowercase','none'],d:'none',syntax:exports.PropertySyntax.TEXT_TRANSFORM,p:51// it must get parsed after text
7642
7641
  },{n:'font',l:true},{n:'fontSize',int:true,inh:true,/**
7643
7642
  * @see https://www.w3schools.com/css/css_font_size.asp
7644
- */d:'16px',l:true,syntax:exports.PropertySyntax.LENGTH_PERCENTAGE},{n:'fontFamily',l:true,inh:true,d:'sans-serif'},{n:'fontStyle',l:true,inh:true,k:['normal','italic','oblique'],d:'normal'},{n:'fontWeight',l:true,inh:true,k:['normal','bold','bolder','lighter'],d:'normal'},{n:'fontVariant',l:true,inh:true,k:['normal','small-caps'],d:'normal'},{n:'lineHeight',l:true,syntax:exports.PropertySyntax.LENGTH,int:true,d:'0'},{n:'letterSpacing',l:true,syntax:exports.PropertySyntax.LENGTH,int:true,d:'0'},{n:'miterLimit',l:true,syntax:exports.PropertySyntax.NUMBER,d:function d(nodeName){if(nodeName===exports.Shape.PATH||nodeName===exports.Shape.POLYGON||nodeName===exports.Shape.POLYLINE){return '4';}return '10';}},{n:'wordWrap',l:true},{n:'wordWrapWidth',l:true},{n:'maxLines',l:true},{n:'textOverflow',l:true,d:'clip'},{n:'leading',l:true},{n:'textBaseline',l:true,inh:true,k:['top','hanging','middle','alphabetic','ideographic','bottom'],d:'alphabetic'},{n:'textAlign',l:true,inh:true,k:['start','center','end','left','right'],d:'start'},// {
7643
+ */d:'16px',l:true,syntax:exports.PropertySyntax.LENGTH_PERCENTAGE},{n:'fontFamily',l:true,inh:true,d:'sans-serif'},{n:'fontStyle',l:true,inh:true,k:['normal','italic','oblique'],d:'normal'},{n:'fontWeight',l:true,inh:true,k:['normal','bold','bolder','lighter'],d:'normal'},{n:'fontVariant',l:true,inh:true,k:['normal','small-caps'],d:'normal'},{n:'lineHeight',l:true,syntax:exports.PropertySyntax.LENGTH,int:true,d:'0'},{n:'letterSpacing',l:true,syntax:exports.PropertySyntax.LENGTH,int:true,d:'0'},{n:'miterLimit',l:true,syntax:exports.PropertySyntax.NUMBER,d:function d(nodeName){if(nodeName===exports.Shape.PATH||nodeName===exports.Shape.POLYGON||nodeName===exports.Shape.POLYLINE){return '4';}return '10';}},{n:'wordWrap',l:true},{n:'wordWrapWidth',l:true},{n:'maxLines',l:true},{n:'textOverflow',l:true,d:'clip'},{n:'leading',l:true},{n:'textBaseline',l:true,inh:true,k:['top','hanging','middle','alphabetic','ideographic','bottom'],d:'alphabetic'},{n:'textAlign',l:true,inh:true,k:['start','center','middle','end','left','right'],d:'start'},// {
7645
7644
  // n: 'whiteSpace',
7646
7645
  // l: true,
7647
7646
  // },
7648
- {n:'markerStart',syntax:exports.PropertySyntax.MARKER},{n:'markerEnd',syntax:exports.PropertySyntax.MARKER},{n:'markerMid',syntax:exports.PropertySyntax.MARKER},{n:'markerStartOffset',syntax:exports.PropertySyntax.LENGTH,l:true,int:true,d:'0'},{n:'markerEndOffset',syntax:exports.PropertySyntax.LENGTH,l:true,int:true,d:'0'}];var propertyMetadataCache={};var unresolvedProperties={};var priorityMap={};var sortAttributeNames=memoize(function(attributeNames){return attributeNames.sort(function(a,b){return priorityMap[a]-priorityMap[b];});});var tmpVec3a=create$2();var tmpVec3b=create$2();var tmpVec3c=create$2();var isPropertyResolved=function isPropertyResolved(object,name){if(!unresolvedProperties[object.entity]||unresolvedProperties[object.entity].length===0){return true;}return unresolvedProperties[object.entity].includes(name);};var DefaultStyleValueRegistry=/*#__PURE__*/function(){/**
7647
+ {n:'markerStart',syntax:exports.PropertySyntax.MARKER},{n:'markerEnd',syntax:exports.PropertySyntax.MARKER},{n:'markerMid',syntax:exports.PropertySyntax.MARKER},{n:'markerStartOffset',syntax:exports.PropertySyntax.LENGTH,l:true,int:true,d:'0'},{n:'markerEndOffset',syntax:exports.PropertySyntax.LENGTH,l:true,int:true,d:'0'}];var propertyMetadataCache={};var unresolvedProperties=new WeakMap();var priorityMap={};var sortAttributeNames=memoize(function(attributeNames){return attributeNames.sort(function(a,b){return priorityMap[a]-priorityMap[b];});});var tmpVec3a=create$2();var tmpVec3b=create$2();var tmpVec3c=create$2();var isPropertyResolved=function isPropertyResolved(object,name){var properties=unresolvedProperties.get(object);if(!properties||properties.length===0){return true;}return properties.includes(name);};var DefaultStyleValueRegistry=/*#__PURE__*/function(){/**
7649
7648
  * need recalc later
7650
7649
  */ // dirty = false;
7651
7650
  function DefaultStyleValueRegistry(){var _this=this;BUILT_IN_PROPERTIES.forEach(function(property){_this.registerMetadata(property);});}var _proto=DefaultStyleValueRegistry.prototype;_proto.registerMetadata=function registerMetadata(metadata){[metadata.n].concat(metadata.a||[]).forEach(function(name){propertyMetadataCache[name]=metadata;priorityMap[name]=metadata.p||0;});};_proto.unregisterMetadata=function unregisterMetadata(name){delete propertyMetadataCache[name];};_proto.getPropertySyntax=function getPropertySyntax(syntax){return runtime.CSSPropertySyntaxFactory[syntax];}/**
@@ -7656,7 +7655,7 @@
7656
7655
  *
7657
7656
  * * calculate used value
7658
7657
  * * post process
7659
- */;_proto.processProperties=function processProperties(object,attributes,options){var _this2=this;if(options===void 0){options={skipUpdateAttribute:false,skipParse:false,forceUpdateGeometry:false,usedAttributes:[]};}var _options=options,skipUpdateAttribute=_options.skipUpdateAttribute,skipParse=_options.skipParse,forceUpdateGeometry=_options.forceUpdateGeometry,usedAttributes=_options.usedAttributes;var needUpdateGeometry=forceUpdateGeometry;var attributeNames=Object.keys(attributes);attributeNames.forEach(function(attributeName){var _propertyMetadataCach;var _formatAttribute=formatAttribute(attributeName,attributes[attributeName]),name=_formatAttribute[0],value=_formatAttribute[1];if(!skipUpdateAttribute){object.attributes[name]=value;}if(!needUpdateGeometry&&((_propertyMetadataCach=propertyMetadataCache[name])===null||_propertyMetadataCach===void 0?void 0:_propertyMetadataCach.l)){needUpdateGeometry=true;}});if(!skipParse){attributeNames.forEach(function(name){object.computedStyle[name]=_this2.parseProperty(name,object.attributes[name],object);});}// let hasUnresolvedProperties = false;
7658
+ */;_proto.processProperties=function processProperties(object,attributes,options){var _this2=this;if(options===void 0){options={skipUpdateAttribute:false,skipParse:false,forceUpdateGeometry:false,usedAttributes:[]};}var _options=options,skipUpdateAttribute=_options.skipUpdateAttribute,skipParse=_options.skipParse,forceUpdateGeometry=_options.forceUpdateGeometry,usedAttributes=_options.usedAttributes;var needUpdateGeometry=forceUpdateGeometry;var attributeNames=Object.keys(attributes);attributeNames.forEach(function(attributeName){var _propertyMetadataCach;var name=formatAttributeName(attributeName);if(!skipUpdateAttribute){object.attributes[name]=attributes[attributeName];}if(!needUpdateGeometry&&((_propertyMetadataCach=propertyMetadataCache[name])===null||_propertyMetadataCach===void 0?void 0:_propertyMetadataCach.l)){needUpdateGeometry=true;}});if(!skipParse){attributeNames.forEach(function(name){object.computedStyle[name]=_this2.parseProperty(name,object.attributes[name],object);});}// let hasUnresolvedProperties = false;
7660
7659
  // parse according to priority
7661
7660
  attributeNames=sortAttributeNames((usedAttributes===null||usedAttributes===void 0?void 0:usedAttributes.length)?Array.from(new Set(attributeNames.concat(usedAttributes))):attributeNames);// attributeNames.sort((a, b) => priorityMap[a] - priorityMap[b]);
7662
7661
  attributeNames.forEach(function(name){// some style props maybe deleted after parsing such as `anchor` in Text
@@ -7687,7 +7686,7 @@
7687
7686
  // return false;
7688
7687
  return used;};_proto.postProcessProperty=function postProcessProperty(name,object){var metadata=propertyMetadataCache[name];if(metadata&&metadata.syntax){var handler=metadata.syntax&&this.getPropertySyntax(metadata.syntax);var propertyHandler=handler;if(propertyHandler&&propertyHandler.postProcessor){propertyHandler.postProcessor(object);}}}/**
7689
7688
  * resolve later
7690
- */;_proto.addUnresolveProperty=function addUnresolveProperty(object,name){if(!unresolvedProperties[object.entity]){unresolvedProperties[object.entity]=[];}if(unresolvedProperties[object.entity].indexOf(name)===-1){unresolvedProperties[object.entity].push(name);}};_proto.tryToResolveProperty=function tryToResolveProperty(object,name,options){if(options===void 0){options={};}var _options2=options,inherited=_options2.inherited;if(inherited){if(object.parentElement&&isPropertyResolved(object.parentElement,name)){// const computedValue = object.parentElement.computedStyle[name];
7689
+ */;_proto.addUnresolveProperty=function addUnresolveProperty(object,name){var properties=unresolvedProperties.get(object);if(!properties){unresolvedProperties.set(object,[]);properties=unresolvedProperties.get(object);}if(properties.indexOf(name)===-1){properties.push(name);}};_proto.tryToResolveProperty=function tryToResolveProperty(object,name,options){if(options===void 0){options={};}var _options2=options,inherited=_options2.inherited;if(inherited){if(object.parentElement&&isPropertyResolved(object.parentElement,name)){// const computedValue = object.parentElement.computedStyle[name];
7691
7690
  var usedValue=object.parentElement.parsedStyle[name];if(// usedValue instanceof CSSKeywordValue &&
7692
7691
  usedValue==='unset'||usedValue==='initial'||usedValue==='inherit'){return;}// else if (
7693
7692
  // usedValue instanceof CSSUnitValue &&
@@ -7695,7 +7694,7 @@
7695
7694
  // ) {
7696
7695
  // return false;
7697
7696
  // }
7698
- return usedValue;}}return;};_proto.recalc=function recalc(object){var properties=unresolvedProperties[object.entity];if(properties&&properties.length){var attributes={};properties.forEach(function(property){attributes[property]=object.attributes[property];});this.processProperties(object,attributes);delete unresolvedProperties[object.entity];}}/**
7697
+ return usedValue;}}return;};_proto.recalc=function recalc(object){var properties=unresolvedProperties.get(object);if(properties&&properties.length){var attributes={};properties.forEach(function(property){attributes[property]=object.attributes[property];});this.processProperties(object,attributes);unresolvedProperties.delete(object);}}/**
7699
7698
  * update geometry when relative props changed,
7700
7699
  * eg. r of Circle, width/height of Rect
7701
7700
  */;_proto.updateGeometry=function updateGeometry(object){var geometryUpdater=runtime.geometryUpdaterFactory[object.nodeName];if(geometryUpdater){var geometry=object.geometry;if(!geometry.contentBounds){geometry.contentBounds=new AABB();}if(!geometry.renderBounds){geometry.renderBounds=new AABB();}var parsedStyle=object.parsedStyle;var _geometryUpdater$upda=geometryUpdater.update(parsedStyle,object),width=_geometryUpdater$upda.width,height=_geometryUpdater$upda.height,_geometryUpdater$upda2=_geometryUpdater$upda.depth,depth=_geometryUpdater$upda2===void 0?0:_geometryUpdater$upda2,_geometryUpdater$upda3=_geometryUpdater$upda.offsetX,offsetX=_geometryUpdater$upda3===void 0?0:_geometryUpdater$upda3,_geometryUpdater$upda4=_geometryUpdater$upda.offsetY,offsetY=_geometryUpdater$upda4===void 0?0:_geometryUpdater$upda4,_geometryUpdater$upda5=_geometryUpdater$upda.offsetZ,offsetZ=_geometryUpdater$upda5===void 0?0:_geometryUpdater$upda5;// account for negative width / height of Rect
@@ -7806,11 +7805,11 @@
7806
7805
  */ // eslint-disable-next-line @typescript-eslint/ban-types
7807
7806
  ;_proto.emit=function emit(eventName,object){this.dispatchEvent(new CustomEvent(eventName,object));}/**
7808
7807
  * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
7809
- */;_proto.dispatchEvent=function dispatchEvent(e){if(!(e instanceof FederatedEvent)){throw new Error('DisplayObject cannot propagate events outside of the Federated Events API');}// should account for Element / Document / Canvas
7808
+ */;_proto.dispatchEvent=function dispatchEvent(e,skipPropagate){if(skipPropagate===void 0){skipPropagate=false;}if(!(e instanceof FederatedEvent)){throw new Error('DisplayObject cannot propagate events outside of the Federated Events API');}// should account for Element / Document / Canvas
7810
7809
  var canvas;// @ts-ignore
7811
7810
  if(this.document){canvas=this;// @ts-ignore
7812
7811
  }else if(this.defaultView){canvas=this.defaultView;}else {var _this$ownerDocument;canvas=(_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:_this$ownerDocument.defaultView;}// assign event manager
7813
- if(canvas){var _e$manager;e.manager=canvas.getEventService()||null;if(!e.manager){return false;}e.defaultPrevented=false;e.path=[];e.target=this;(_e$manager=e.manager)===null||_e$manager===void 0?void 0:_e$manager.dispatchEvent(e);}return !e.defaultPrevented;};return EventTarget;}();/**
7812
+ if(canvas){var _e$manager;e.manager=canvas.getEventService()||null;if(!e.manager){return false;}e.defaultPrevented=false;e.path=[];if(!skipPropagate){e.target=this;}(_e$manager=e.manager)===null||_e$manager===void 0?void 0:_e$manager.dispatchEvent(e,e.type,skipPropagate);}return !e.defaultPrevented;};return EventTarget;}();/**
7814
7813
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node
7815
7814
  */var Node=/*#__PURE__*/function(_EventTarget){_inheritsLoose(Node,_EventTarget);function Node(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_EventTarget.call.apply(_EventTarget,[this].concat(args))||this;_this.shadow=false;_this.ownerDocument=null;_this.isConnected=false;_this.baseURI='';_this.childNodes=[];_this.nodeType=0;_this.nodeName='';_this.nodeValue=null;_this.parentNode=null;return _this;}Node.isNode=function isNode(target){return !!target.childNodes;};var _proto=Node.prototype;/**
7816
7815
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/getRootNode
@@ -7913,21 +7912,16 @@
7913
7912
  * it has been inserted
7914
7913
  * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeInserted
7915
7914
  */ElementEvent["INSERTED"]="DOMNodeInserted";/**
7916
- * it has had a child inserted
7917
- */ElementEvent["CHILD_INSERTED"]="child-inserted";/**
7918
7915
  * it is being removed
7919
7916
  * @see https://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeRemoved
7920
7917
  */ElementEvent["REMOVED"]="removed";/**
7921
- * it has had a child removed
7922
- */ElementEvent["CHILD_REMOVED"]="child-removed";/**
7923
7918
  * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnodeinsertedintodocument
7924
7919
  */ElementEvent["MOUNTED"]="DOMNodeInsertedIntoDocument";/**
7925
7920
  * @see https://www.w3.org/TR/DOM-Level-3-Events/#domnoderemovedfromdocument
7926
7921
  */ElementEvent["UNMOUNTED"]="DOMNodeRemovedFromDocument";ElementEvent["BOUNDS_CHANGED"]="bounds-changed";// GEOMETRY_BOUNDS_CHANGED = 'geometry-bounds-changed',
7927
7922
  /**
7928
7923
  * trigger when z-index changed
7929
- */ElementEvent["RENDER_ORDER_CHANGED"]="render-order-changed";ElementEvent["CULLED"]="culled";})(exports.ElementEvent||(exports.ElementEvent={}));var MutationEvent=/*#__PURE__*/function(_FederatedEvent){_inheritsLoose(MutationEvent,_FederatedEvent);function MutationEvent(typeArg,relatedNode,prevValue,newValue,attrName,attrChange,prevParsedValue,newParsedValue){var _this;_this=_FederatedEvent.call(this,null)||this;_this.relatedNode=void 0;_this.prevValue=void 0;_this.newValue=void 0;_this.attrName=void 0;_this.attrChange=void 0;_this.prevParsedValue=void 0;_this.newParsedValue=void 0;_this.relatedNode=relatedNode;_this.prevValue=prevValue;_this.newValue=newValue;_this.attrName=attrName;_this.attrChange=attrChange;_this.prevParsedValue=prevParsedValue;_this.newParsedValue=newParsedValue;_this.type=typeArg;return _this;}return MutationEvent;}(FederatedEvent);MutationEvent.ADDITION=2;MutationEvent.MODIFICATION=1;MutationEvent.REMOVAL=3;var entityCounter=0;function resetEntityCounter(){entityCounter=0;}// let this.sceneGraphService: SceneGraphService;
7930
- var childInsertedEvent=new CustomEvent(exports.ElementEvent.CHILD_INSERTED,{child:null});var insertedEvent=new MutationEvent(exports.ElementEvent.INSERTED,null,'','','',0,'','');var removedEvent=new MutationEvent(exports.ElementEvent.REMOVED,null,'','','',0,'','');var destroyEvent=new CustomEvent(exports.ElementEvent.DESTROY);var childRemovedEvent=new CustomEvent(exports.ElementEvent.CHILD_REMOVED,{child:null});/**
7924
+ */ElementEvent["RENDER_ORDER_CHANGED"]="render-order-changed";ElementEvent["CULLED"]="culled";})(exports.ElementEvent||(exports.ElementEvent={}));var MutationEvent=/*#__PURE__*/function(_FederatedEvent){_inheritsLoose(MutationEvent,_FederatedEvent);function MutationEvent(typeArg,relatedNode,prevValue,newValue,attrName,attrChange,prevParsedValue,newParsedValue){var _this;_this=_FederatedEvent.call(this,null)||this;_this.relatedNode=void 0;_this.prevValue=void 0;_this.newValue=void 0;_this.attrName=void 0;_this.attrChange=void 0;_this.prevParsedValue=void 0;_this.newParsedValue=void 0;_this.relatedNode=relatedNode;_this.prevValue=prevValue;_this.newValue=newValue;_this.attrName=attrName;_this.attrChange=attrChange;_this.prevParsedValue=prevParsedValue;_this.newParsedValue=newParsedValue;_this.type=typeArg;return _this;}return MutationEvent;}(FederatedEvent);MutationEvent.ADDITION=2;MutationEvent.MODIFICATION=1;MutationEvent.REMOVAL=3;var entityCounter=0;function resetEntityCounter(){entityCounter=0;}var insertedEvent=new MutationEvent(exports.ElementEvent.INSERTED,null,'','','',0,'','');var removedEvent=new MutationEvent(exports.ElementEvent.REMOVED,null,'','','',0,'','');var destroyEvent=new CustomEvent(exports.ElementEvent.DESTROY);/**
7931
7925
  * Has following capabilities:
7932
7926
  * * Node insert/remove, eg. appendChild, removeChild, remove...
7933
7927
  * * Query eg. querySelector getElementById...
@@ -7953,43 +7947,9 @@
7953
7947
  };_this.attributes={};return _this;}Element.isElement=function isElement(target){return !!target.getAttribute;}/**
7954
7948
  * Unique id.
7955
7949
  */;var _proto=Element.prototype;// eslint-disable-next-line @typescript-eslint/no-unused-vars
7956
- _proto.cloneNode=function cloneNode(deep){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.appendChild=function appendChild(child,index){runtime.sceneGraphService.attach(child,this,index);// this.dispatchEvent(
7957
- // new CustomEvent(ElementEvent.CHILD_INSERTED, {
7958
- // child,
7959
- // }),
7960
- // );
7961
- childInsertedEvent.detail.child=child;// @ts-ignore
7962
- // this.ownerDocument?.defaultView?.mountChildren(child);
7963
- this.dispatchEvent(childInsertedEvent);// child.emit(ElementEvent.INSERTED, {
7964
- // parent: this,
7965
- // index,
7966
- // });
7967
- insertedEvent.relatedNode=this;child.dispatchEvent(insertedEvent);return child;};_proto.insertBefore=function insertBefore(newChild,refChild){if(!refChild){this.appendChild(newChild);}else {var index=this.childNodes.indexOf(refChild);this.appendChild(newChild,index-1);}return newChild;};_proto.replaceChild=function replaceChild(newChild,oldChild){var index=this.childNodes.indexOf(oldChild);this.removeChild(oldChild);this.appendChild(newChild,index);return oldChild;};_proto.removeChild=function removeChild(child){// should emit on itself before detach
7968
- // child.emit(ElementEvent.REMOVED, {
7969
- // parent: this,
7970
- // });
7971
- removedEvent.relatedNode=this;child.dispatchEvent(removedEvent);// emit destroy event
7972
- // if (destroy) {
7973
- // // child.destroy();
7974
- // child.dispatchEvent(destroyEvent);
7975
- // (child as unknown as Element).destroyed = true;
7976
- // }
7977
- // emit on parent
7978
- childRemovedEvent.detail.child=child;this.dispatchEvent(childRemovedEvent);// this.dispatchEvent(
7979
- // new CustomEvent(ElementEvent.CHILD_REMOVED, {
7980
- // child,
7981
- // }),
7982
- // );
7983
- // remove from scene graph
7984
- runtime.sceneGraphService.detach(child);// cannot emit Destroy event now
7985
- // if (destroy) {
7986
- // // this.removeChildren();
7987
- // // remove event listeners
7988
- // // @ts-ignore
7989
- // child.emitter.removeAllListeners();
7990
- // displayObjectPool.remove((child as unknown as Element).entity);
7991
- // }
7992
- return child;}/**
7950
+ _proto.cloneNode=function cloneNode(deep){throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);};_proto.appendChild=function appendChild(child,index){var _this$ownerDocument;runtime.sceneGraphService.attach(child,this,index);if((_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:_this$ownerDocument.defaultView){this.ownerDocument.defaultView.mountChildren(child);}insertedEvent.relatedNode=this;child.dispatchEvent(insertedEvent);return child;};_proto.insertBefore=function insertBefore(newChild,refChild){if(!refChild){this.appendChild(newChild);}else {var index=this.childNodes.indexOf(refChild);this.appendChild(newChild,index-1);}return newChild;};_proto.replaceChild=function replaceChild(newChild,oldChild){var index=this.childNodes.indexOf(oldChild);this.removeChild(oldChild);this.appendChild(newChild,index);return oldChild;};_proto.removeChild=function removeChild(child){var _child$ownerDocument;// should emit on itself before detach
7951
+ removedEvent.relatedNode=this;child.dispatchEvent(removedEvent);if((_child$ownerDocument=child.ownerDocument)===null||_child$ownerDocument===void 0?void 0:_child$ownerDocument.defaultView){child.ownerDocument.defaultView.unmountChildren(child);}// remove from scene graph
7952
+ runtime.sceneGraphService.detach(child);return child;}/**
7993
7953
  * Remove all children and destroy them.
7994
7954
  */;_proto.removeChildren=function removeChildren(){var _this2=this;this.childNodes.slice().forEach(function(child){_this2.removeChild(child);child.destroy();});}/**
7995
7955
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
@@ -8041,8 +8001,8 @@
8041
8001
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
8042
8002
  */_proto.getAttributeNames=function getAttributeNames(){return Object.keys(this.attributes);}/**
8043
8003
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
8044
- */;_proto.getAttribute=function getAttribute(name){var value=this.attributes[name];if(value===undefined){var _formatAttribute=formatAttribute(name.toString(),''),attributeName=_formatAttribute[0];value=this.attributes[attributeName];}// if the given attribute does not exist, the value returned will either be null or ""
8045
- return isNil(value)?null:value;}/**
8004
+ */;_proto.getAttribute=function getAttribute(name){var value=this.attributes[name];if(value===undefined){var attributeName=formatAttributeName(name);value=this.attributes[attributeName];// if the given attribute does not exist, the value returned will either be null or ""
8005
+ return isNil(value)?null:value;}else {return value;}}/**
8046
8006
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
8047
8007
  */;_proto.hasAttribute=function hasAttribute(qualifiedName){return this.getAttributeNames().includes(qualifiedName);}/**
8048
8008
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes
@@ -8084,7 +8044,7 @@
8084
8044
  * which can lead to unintended consequences if an attempt is made to cache the entire event object.
8085
8045
  *
8086
8046
  * Therefore, while keeping the above performance considerations in mind, it is possible to provide a clone method that creates a new object when the user really wants to cache it, e.g.
8087
- */;_proto.clone=function clone(){return this.manager.clonePointerEvent(this);};return FederatedPointerEvent;}(FederatedMouseEvent);var FederatedWheelEvent=/*#__PURE__*/function(_FederatedMouseEvent){_inheritsLoose(FederatedWheelEvent,_FederatedMouseEvent);function FederatedWheelEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedMouseEvent.call.apply(_FederatedMouseEvent,[this].concat(args))||this;_this.deltaMode=void 0;_this.deltaX=void 0;_this.deltaY=void 0;_this.deltaZ=void 0;_this.DOM_DELTA_LINE=0;_this.DOM_DELTA_PAGE=1;_this.DOM_DELTA_PIXEL=2;return _this;}var _proto=FederatedWheelEvent.prototype;_proto.clone=function clone(){return this.manager.cloneWheelEvent(this);};return FederatedWheelEvent;}(FederatedMouseEvent);var mutationEvent=new MutationEvent(exports.ElementEvent.ATTR_MODIFIED,null,null,null,null,MutationEvent.MODIFICATION,null,null);var DEFAULT_STYLE_PROPS={anchor:'',opacity:'',fillOpacity:'',strokeOpacity:'',fill:'',stroke:'',transform:'',transformOrigin:'',visibility:'',pointerEvents:'',lineWidth:'',lineCap:'',lineJoin:'',increasedLineWidthForHitTesting:'',fontSize:'',fontFamily:'',fontStyle:'',fontWeight:'',fontVariant:'',textAlign:'',textBaseline:'',textTransform:'',zIndex:'',filter:'',shadowType:''};var DEFAULT_PARSED_STYLE_PROPS={anchor:[0,0],fill:noneColor,stroke:noneColor,transform:[],zIndex:0,filter:[],shadowType:'outer'};/**
8047
+ */;_proto.clone=function clone(){return this.manager.clonePointerEvent(this);};return FederatedPointerEvent;}(FederatedMouseEvent);var FederatedWheelEvent=/*#__PURE__*/function(_FederatedMouseEvent){_inheritsLoose(FederatedWheelEvent,_FederatedMouseEvent);function FederatedWheelEvent(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_FederatedMouseEvent.call.apply(_FederatedMouseEvent,[this].concat(args))||this;_this.deltaMode=void 0;_this.deltaX=void 0;_this.deltaY=void 0;_this.deltaZ=void 0;_this.DOM_DELTA_LINE=0;_this.DOM_DELTA_PAGE=1;_this.DOM_DELTA_PIXEL=2;return _this;}var _proto=FederatedWheelEvent.prototype;_proto.clone=function clone(){return this.manager.cloneWheelEvent(this);};return FederatedWheelEvent;}(FederatedMouseEvent);var mutationEvent=new MutationEvent(exports.ElementEvent.ATTR_MODIFIED,null,null,null,null,MutationEvent.MODIFICATION,null,null);var DEFAULT_STYLE_PROPS={anchor:'',opacity:'',fillOpacity:'',strokeOpacity:'',fill:'',stroke:'',transform:'',transformOrigin:'',visibility:'',pointerEvents:'',lineWidth:'',lineCap:'',lineJoin:'',increasedLineWidthForHitTesting:'',fontSize:'',fontFamily:'',fontStyle:'',fontWeight:'',fontVariant:'',textAlign:'',textBaseline:'',textTransform:'',zIndex:'',filter:'',shadowType:''};var DEFAULT_PARSED_STYLE_PROPS={anchor:[0,0],fill:noneColor,stroke:noneColor,transform:[],zIndex:0,filter:[],shadowType:'outer'};var INHERITABLE_STYLE_PROPS=['opacity','fillOpacity','strokeOpacity','transformOrigin','visibility','pointerEvents','lineWidth','lineCap','lineJoin','increasedLineWidthForHitTesting','fontSize','fontFamily','fontStyle','fontWeight','fontVariant','textAlign','textBaseline','textTransform'];/**
8088
8048
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
8089
8049
  *
8090
8050
  * mixins: Animatable, Transformable, Visible
@@ -8107,7 +8067,7 @@
8107
8067
  * push to active animations after calling `animate()`
8108
8068
  */function DisplayObject(config){var _this$config$capture;var _this;_this=_Element.call(this)||this;// assign name, id to config
8109
8069
  // eg. group.get('name')
8110
- _this.config=void 0;_this.isCustomElement=false;_this.activeAnimations=[];_this.config=config;// compatible with G 3.0
8070
+ _this.config=void 0;_this.isCustomElement=false;_this.isMutationObserved=false;_this.activeAnimations=[];_this.getClip=function(){return this.style.clipPath||null;};_this.config=config;// compatible with G 3.0
8111
8071
  _this.config.interactive=(_this$config$capture=_this.config.capture)!==null&&_this$config$capture!==void 0?_this$config$capture:_this.config.interactive;// init scene graph node
8112
8072
  _this.id=_this.config.id||'';_this.name=_this.config.name||'';if(_this.config.className||_this.config.class){_this.className=_this.config.className||_this.config.class;}_this.nodeName=_this.config.type||exports.Shape.GROUP;// compatible with G 3.0
8113
8073
  _this.config.style=_extends({},_this.config.style,_this.config.attrs);if(_this.config.visible!=null){_this.config.style.visibility=_this.config.visible===false?'hidden':'visible';}if(_this.config.interactive!=null){_this.config.style.pointerEvents=_this.config.interactive===false?'none':'auto';}// merge parsed value
@@ -8126,19 +8086,12 @@
8126
8086
  id:this.id,name:this.name,className:this.name,interactive:this.interactive,style:clonedStyle});// apply transform
8127
8087
  cloned.setLocalTransform(this.getLocalTransform());if(deep){this.children.forEach(function(child){// skip marker
8128
8088
  if(!child.style.isMarker){var clonedChild=child.cloneNode(deep);cloned.appendChild(clonedChild);}});}return cloned;};_proto.initAttributes=function initAttributes(attributes){if(attributes===void 0){attributes={};}var renderable=this.renderable;// account for FCP, process properties as less as possible
8129
- runtime.styleValueRegistry.processProperties(this,attributes,{forceUpdateGeometry:true,usedAttributes:[// 'anchor',
8130
- // 'transform',
8131
- // 'zIndex',
8132
- // 'filter',
8133
- // 'shadowType',
8134
- // 'fill',
8135
- // 'stroke',
8136
- 'opacity','fillOpacity','strokeOpacity','transformOrigin','visibility','pointerEvents','lineWidth','lineCap','lineJoin','increasedLineWidthForHitTesting','fontSize','fontFamily','fontStyle','fontWeight','fontVariant','textAlign','textBaseline','textTransform']});// redraw at next frame
8137
- renderable.dirty=true;};_proto.setAttribute=function setAttribute(name,value,force){if(force===void 0){force=false;}var _formatAttribute=formatAttribute(name,value),attributeName=_formatAttribute[0],attributeValue=_formatAttribute[1];// ignore undefined value
8138
- if(isUndefined(value)){return;}if(force||attributeValue!==this.attributes[attributeName]){this.internalSetAttribute(attributeName,attributeValue);_Element.prototype.setAttribute.call(this,attributeName,attributeValue);}}/**
8089
+ runtime.styleValueRegistry.processProperties(this,attributes,{forceUpdateGeometry:true,usedAttributes:INHERITABLE_STYLE_PROPS});// redraw at next frame
8090
+ renderable.dirty=true;};_proto.setAttribute=function setAttribute(name,value,force){if(force===void 0){force=false;}var attributeName=formatAttributeName(name);// ignore undefined value
8091
+ if(isUndefined(value)){return;}if(force||value!==this.attributes[attributeName]){this.internalSetAttribute(attributeName,value);_Element.prototype.setAttribute.call(this,attributeName,value);}}/**
8139
8092
  * called when attributes get changed or initialized
8140
8093
  */;_proto.internalSetAttribute=function internalSetAttribute(name,value,parseOptions){var _runtime$styleValueRe;if(parseOptions===void 0){parseOptions={};}var renderable=this.renderable;var oldValue=this.attributes[name];var oldParsedValue=this.parsedStyle[name];runtime.styleValueRegistry.processProperties(this,(_runtime$styleValueRe={},_runtime$styleValueRe[name]=value,_runtime$styleValueRe),parseOptions);// redraw at next frame
8141
- renderable.dirty=true;var newParsedValue=this.parsedStyle[name];if(this.isConnected){mutationEvent.relatedNode=this;mutationEvent.prevValue=oldValue;mutationEvent.newValue=value;mutationEvent.attrName=name;mutationEvent.prevParsedValue=oldParsedValue;mutationEvent.newParsedValue=newParsedValue;this.dispatchEvent(mutationEvent);}if((this.isCustomElement&&this.isConnected||!this.isCustomElement)&&this.attributeChangedCallback){this.attributeChangedCallback(name,oldValue,value,oldParsedValue,newParsedValue);}}// #region transformable
8094
+ renderable.dirty=true;var newParsedValue=this.parsedStyle[name];if(this.isConnected){mutationEvent.relatedNode=this;mutationEvent.prevValue=oldValue;mutationEvent.newValue=value;mutationEvent.attrName=name;mutationEvent.prevParsedValue=oldParsedValue;mutationEvent.newParsedValue=newParsedValue;if(this.isMutationObserved){this.dispatchEvent(mutationEvent);}else {mutationEvent.target=this;this.ownerDocument.defaultView.dispatchEvent(mutationEvent,true);}}if((this.isCustomElement&&this.isConnected||!this.isCustomElement)&&this.attributeChangedCallback){this.attributeChangedCallback(name,oldValue,value,oldParsedValue,newParsedValue);}}// #region transformable
8142
8095
  /**
8143
8096
  * returns different values than getBoundingClientRect(), as the latter returns value relative to the viewport
8144
8097
  * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox
@@ -8168,11 +8121,9 @@
8168
8121
  * get scaling in world space
8169
8122
  */;_proto.getScale=function getScale(){return runtime.sceneGraphService.getScale(this);}/**
8170
8123
  * only return degrees of Z axis in world space
8171
- */;_proto.getEulerAngles=function getEulerAngles(){// eslint-disable-next-line @typescript-eslint/no-unused-vars
8172
- var _getEuler=getEuler(create$2(),runtime.sceneGraphService.getWorldTransform(this)),ex=_getEuler[0],ey=_getEuler[1],ez=_getEuler[2];return rad2deg(ez);}/**
8124
+ */;_proto.getEulerAngles=function getEulerAngles(){var _getEuler=getEuler(create$2(),runtime.sceneGraphService.getWorldTransform(this)),ez=_getEuler[2];return rad2deg(ez);}/**
8173
8125
  * only return degrees of Z axis in local space
8174
- */;_proto.getLocalEulerAngles=function getLocalEulerAngles(){// eslint-disable-next-line @typescript-eslint/no-unused-vars
8175
- var _getEuler2=getEuler(create$2(),runtime.sceneGraphService.getLocalRotation(this)),ex=_getEuler2[0],ey=_getEuler2[1],ez=_getEuler2[2];return rad2deg(ez);}/**
8126
+ */;_proto.getLocalEulerAngles=function getLocalEulerAngles(){var _getEuler2=getEuler(create$2(),runtime.sceneGraphService.getLocalRotation(this)),ez=_getEuler2[2];return rad2deg(ez);}/**
8176
8127
  * set euler angles(degrees) in world space
8177
8128
  */;_proto.setEulerAngles=function setEulerAngles(z){runtime.sceneGraphService.setEulerAngles(this,0,0,z);return this;}/**
8178
8129
  * set euler angles(degrees) in local space
@@ -8206,8 +8157,7 @@
8206
8157
  */;_proto.getConfig=function getConfig(){return this.config;};_proto.attr=function attr(){var _this2=this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var name=args[0],value=args[1];if(!name){return this.attributes;}if(isObject(name)){Object.keys(name).forEach(function(key){_this2.setAttribute(key,name[key]);});return this;}if(args.length===2){this.setAttribute(name,value);return this;}return this.attributes[name];}/**
8207
8158
  * return 3x3 matrix in world space
8208
8159
  * @deprecated
8209
- */;_proto.getMatrix=function getMatrix(transformMat4){var transform=transformMat4||this.getWorldTransform();var _mat4$getTranslation=getTranslation(create$2(),transform),tx=_mat4$getTranslation[0],ty=_mat4$getTranslation[1];var _mat4$getScaling=getScaling(create$2(),transform),sx=_mat4$getScaling[0],sy=_mat4$getScaling[1];var rotation=getRotation(create$4(),transform);// eslint-disable-next-line @typescript-eslint/no-unused-vars
8210
- var _getEuler3=getEuler(create$2(),rotation),eux=_getEuler3[0],euy=_getEuler3[1],euz=_getEuler3[2];// gimbal lock at 90 degrees
8160
+ */;_proto.getMatrix=function getMatrix(transformMat4){var transform=transformMat4||this.getWorldTransform();var _mat4$getTranslation=getTranslation(create$2(),transform),tx=_mat4$getTranslation[0],ty=_mat4$getTranslation[1];var _mat4$getScaling=getScaling(create$2(),transform),sx=_mat4$getScaling[0],sy=_mat4$getScaling[1];var rotation=getRotation(create$4(),transform);var _getEuler3=getEuler(create$2(),rotation),eux=_getEuler3[0],euz=_getEuler3[2];// gimbal lock at 90 degrees
8211
8161
  return fromRotationTranslationScale$1(eux||euz,tx,ty,sx,sy);}/**
8212
8162
  * return 3x3 matrix in local space
8213
8163
  * @deprecated
@@ -8223,7 +8173,48 @@
8223
8173
  */;_proto.show=function show(){this.style.visibility='visible';}/**
8224
8174
  * Use `visibility: hidden` instead.
8225
8175
  * @deprecated
8226
- */;_proto.hide=function hide(){this.style.visibility='hidden';};_createClass(DisplayObject,[{key:"interactive",get:function get(){return this.isInteractive();},set:function set(b){this.style.pointerEvents=b?'auto':'none';}}]);return DisplayObject;}(Element);var _excluded=["style"];var Circle=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Circle,_DisplayObject);function Circle(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded);return _DisplayObject.call(this,_extends({type:exports.Shape.CIRCLE,style:_extends({cx:'',cy:'',r:''},style),initialParsedStyle:{anchor:[0.5,0.5]}},rest))||this;}return Circle;}(DisplayObject);var _excluded$1=["style"];/**
8176
+ */;_proto.hide=function hide(){this.style.visibility='hidden';}/**
8177
+ * Use `childElementCount` instead.
8178
+ * @deprecated
8179
+ */;_proto.getCount=function getCount(){return this.childElementCount;}/**
8180
+ * Use `parentElement` instead.
8181
+ * @deprecated
8182
+ */;_proto.getParent=function getParent(){return this.parentElement;}/**
8183
+ * Use `children` instead.
8184
+ * @deprecated
8185
+ */;_proto.getChildren=function getChildren(){return this.children;}/**
8186
+ * Use `firstElementChild` instead.
8187
+ * @deprecated
8188
+ */;_proto.getFirst=function getFirst(){return this.firstElementChild;}/**
8189
+ * Use `lastElementChild` instead.
8190
+ * @deprecated
8191
+ */;_proto.getLast=function getLast(){return this.lastElementChild;}/**
8192
+ * Use `this.children[index]` instead.
8193
+ * @deprecated
8194
+ */;_proto.getChildByIndex=function getChildByIndex(index){return this.children[index]||null;}/**
8195
+ * Use `appendChild` instead.
8196
+ * @deprecated
8197
+ */;_proto.add=function add(child,index){return this.appendChild(child,index);}/**
8198
+ * Use `this.style.clipPath` instead.
8199
+ * @deprecated
8200
+ */;_proto.setClip=function setClip(clipPath){this.style.clipPath=clipPath;}/**
8201
+ * Use `this.style.clipPath` instead.
8202
+ * @deprecated
8203
+ */;/**
8204
+ * @deprecated
8205
+ */_proto.set=function set(name,value){// @ts-ignore
8206
+ this.config[name]=value;}/**
8207
+ * @deprecated
8208
+ */;_proto.get=function get(name){return this.config[name];}/**
8209
+ * Use `setPosition` instead.
8210
+ * @deprecated
8211
+ */;_proto.moveTo=function moveTo(position,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}this.setPosition(position,y,z);return this;}/**
8212
+ * Use `setPosition` instead.
8213
+ * @deprecated
8214
+ */;_proto.move=function move(position,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}this.setPosition(position,y,z);return this;}/**
8215
+ * Use `this.style.zIndex` instead.
8216
+ * @deprecated
8217
+ */;_proto.setZIndex=function setZIndex(zIndex){this.style.zIndex=zIndex;return this;};_createClass(DisplayObject,[{key:"interactive",get:function get(){return this.isInteractive();},set:function set(b){this.style.pointerEvents=b?'auto':'none';}}]);return DisplayObject;}(Element);var _excluded=["style"];var Circle=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Circle,_DisplayObject);function Circle(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded);return _DisplayObject.call(this,_extends({type:exports.Shape.CIRCLE,style:_extends({cx:'',cy:'',r:''},style),initialParsedStyle:{anchor:[0.5,0.5]}},rest))||this;}return Circle;}(DisplayObject);var _excluded$1=["style"];/**
8227
8218
  * shadow root
8228
8219
  * @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
8229
8220
  */var CustomElement=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(CustomElement,_DisplayObject);// static get observedAttributes(): string[] {
@@ -8258,9 +8249,9 @@
8258
8249
  * Also support for using marker.
8259
8250
  */var Line=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Line,_DisplayObject);function Line(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$6);_this=_DisplayObject.call(this,_extends({type:exports.Shape.LINE,style:_extends({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0,isBillboard:false},style)},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd;if(markerStart&&markerStart instanceof DisplayObject){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerEnd&&markerEnd instanceof DisplayObject){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Line.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='x1'||attrName==='y1'||attrName==='x2'||attrName==='y2'||attrName==='markerStartOffset'||attrName==='markerEndOffset'){this.transformMarker(true);this.transformMarker(false);}else if(attrName==='markerStart'){if(prevParsedValue&&prevParsedValue instanceof DisplayObject){this.markerStartAngle=0;prevParsedValue.remove();}// CSSKeyword 'unset'
8260
8251
  if(newParsedValue&&newParsedValue instanceof DisplayObject){this.markerStartAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(true);}}else if(attrName==='markerEnd'){if(prevParsedValue&&prevParsedValue instanceof DisplayObject){this.markerEndAngle=0;prevParsedValue.remove();}if(newParsedValue&&newParsedValue instanceof DisplayObject){this.markerEndAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(false);}}};_proto.transformMarker=function transformMarker(isStart){var _this$parsedStyle2=this.parsedStyle,markerStart=_this$parsedStyle2.markerStart,markerEnd=_this$parsedStyle2.markerEnd,markerStartOffset=_this$parsedStyle2.markerStartOffset,markerEndOffset=_this$parsedStyle2.markerEndOffset,x1=_this$parsedStyle2.x1,x2=_this$parsedStyle2.x2,y1=_this$parsedStyle2.y1,y2=_this$parsedStyle2.y2,defX=_this$parsedStyle2.defX,defY=_this$parsedStyle2.defY;var marker=isStart?markerStart:markerEnd;if(!marker||!(marker instanceof DisplayObject)){return;}var rad=0;var x;var y;var ox;var oy;var offset;var originalAngle;if(isStart){ox=x1-defX;oy=y1-defY;x=x2-x1;y=y2-y1;offset=markerStartOffset||0;originalAngle=this.markerStartAngle;}else {ox=x2-defX;oy=y2-defY;x=x1-x2;y=y1-y2;offset=markerEndOffset||0;originalAngle=this.markerEndAngle;}rad=Math.atan2(y,x);// account for markerOffset
8261
- marker.setLocalEulerAngles(rad*180/Math.PI+originalAngle);marker.setLocalPosition(ox+Math.cos(rad)*offset,oy+Math.sin(rad)*offset);};_proto.getPoint=function getPoint(ratio){// TODO: account for z1/z2 in 3D line
8262
- var _this$parsedStyle3=this.parsedStyle,x1=_this$parsedStyle3.x1,y1=_this$parsedStyle3.y1,x2=_this$parsedStyle3.x2,y2=_this$parsedStyle3.y2,defX=_this$parsedStyle3.defX,defY=_this$parsedStyle3.defY;var _LineUtil$pointAt=line.pointAt(x1,y1,x2,y2,ratio),x=_LineUtil$pointAt.x,y=_LineUtil$pointAt.y;var transformed=transformMat4(create$2(),fromValues$2(x-defX,y-defY,0),this.getLocalTransform());// apply local transformation
8263
- return new Point(transformed[0],transformed[1]);};_proto.getPointAtLength=function getPointAtLength(distance){return this.getPoint(distance/this.getTotalLength());};_proto.getTotalLength=function getTotalLength(){// TODO: account for z1/z2 in 3D line
8252
+ marker.setLocalEulerAngles(rad*180/Math.PI+originalAngle);marker.setLocalPosition(ox+Math.cos(rad)*offset,oy+Math.sin(rad)*offset);};_proto.getPoint=function getPoint(ratio,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}// TODO: account for z1/z2 in 3D line
8253
+ var _this$parsedStyle3=this.parsedStyle,x1=_this$parsedStyle3.x1,y1=_this$parsedStyle3.y1,x2=_this$parsedStyle3.x2,y2=_this$parsedStyle3.y2,defX=_this$parsedStyle3.defX,defY=_this$parsedStyle3.defY;var _LineUtil$pointAt=line.pointAt(x1,y1,x2,y2,ratio),x=_LineUtil$pointAt.x,y=_LineUtil$pointAt.y;var transformed=transformMat4(create$2(),fromValues$2(x-defX,y-defY,0),inWorldSpace?this.getWorldTransform():this.getLocalTransform());// apply local transformation
8254
+ return new Point(transformed[0],transformed[1]);};_proto.getPointAtLength=function getPointAtLength(distance,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}return this.getPoint(distance/this.getTotalLength(),inWorldSpace);};_proto.getTotalLength=function getTotalLength(){// TODO: account for z1/z2 in 3D line
8264
8255
  var _this$parsedStyle4=this.parsedStyle,x1=_this$parsedStyle4.x1,y1=_this$parsedStyle4.y1,x2=_this$parsedStyle4.x2,y2=_this$parsedStyle4.y2;return line.length(x1,y1,x2,y2);};return Line;}(DisplayObject);var _excluded$7=["style"];var Path=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Path,_DisplayObject);/**
8265
8256
  * markers placed at the mid
8266
8257
  */function Path(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$7);_this=_DisplayObject.call(this,_extends({type:exports.Shape.PATH,style:_extends({path:'',miterLimit:''},style)},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;_this.markerMidList=[];var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd,markerMid=_this$parsedStyle.markerMid;if(markerStart&&markerStart instanceof DisplayObject){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerMid&&markerMid instanceof DisplayObject){_this.placeMarkerMid(markerMid);}if(markerEnd&&markerEnd instanceof DisplayObject){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Path.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='path'){// recalc markers
@@ -8275,10 +8266,10 @@
8275
8266
  */;_proto.getTotalLength=function getTotalLength(){return getOrCalculatePathTotalLength(this);}/**
8276
8267
  * Returns the point at a given distance along the path.
8277
8268
  * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGeometryElement/getPointAtLength
8278
- */;_proto.getPointAtLength=function getPointAtLength$1(distance){var _this$parsedStyle4=this.parsedStyle,defX=_this$parsedStyle4.defX,defY=_this$parsedStyle4.defY,absolutePath=_this$parsedStyle4.path.absolutePath;var _getPointAtLength2=getPointAtLength(absolutePath,distance),x=_getPointAtLength2.x,y=_getPointAtLength2.y;var transformed=transformMat4(create$2(),fromValues$2(x-defX,y-defY,0),this.getLocalTransform());// apply local transformation
8269
+ */;_proto.getPointAtLength=function getPointAtLength$1(distance,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}var _this$parsedStyle4=this.parsedStyle,defX=_this$parsedStyle4.defX,defY=_this$parsedStyle4.defY,absolutePath=_this$parsedStyle4.path.absolutePath;var _getPointAtLength2=getPointAtLength(absolutePath,distance),x=_getPointAtLength2.x,y=_getPointAtLength2.y;var transformed=transformMat4(create$2(),fromValues$2(x-defX,y-defY,0),inWorldSpace?this.getWorldTransform():this.getLocalTransform());// apply local transformation
8279
8270
  return new Point(transformed[0],transformed[1]);}/**
8280
8271
  * Returns the point at a given ratio of the total length in path.
8281
- */;_proto.getPoint=function getPoint(ratio){return this.getPointAtLength(ratio*getOrCalculatePathTotalLength(this));}/**
8272
+ */;_proto.getPoint=function getPoint(ratio,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}return this.getPointAtLength(ratio*getOrCalculatePathTotalLength(this),inWorldSpace);}/**
8282
8273
  * Get start tangent vector
8283
8274
  */;_proto.getStartTangent=function getStartTangent(){var segments=this.parsedStyle.path.segments;var result=[];if(segments.length>1){var startPoint=segments[0].currentPoint;var endPoint=segments[1].currentPoint;var tangent=segments[1].startTangent;result=[];if(tangent){result.push([startPoint[0]-tangent[0],startPoint[1]-tangent[1]]);result.push([startPoint[0],startPoint[1]]);}else {result.push([endPoint[0],endPoint[1]]);result.push([startPoint[0],startPoint[1]]);}}return result;}/**
8284
8275
  * Get end tangent vector
@@ -8291,7 +8282,7 @@
8291
8282
  this.markerMidList.forEach(function(marker){marker.remove();});this.markerMidList=[];if(marker&&marker instanceof DisplayObject){for(var i=1;i<(this.style.isClosed?points.length:points.length-1);i++){var ox=points[i][0]-defX;var oy=points[i][1]-defY;var cloned=i===1?marker:marker.cloneNode(true);this.markerMidList.push(cloned);this.appendChild(cloned);cloned.setLocalPosition(ox,oy);// TODO: orient of marker
8292
8283
  }}};return Polygon;}(DisplayObject);var _excluded$9=["style"];/**
8293
8284
  * Polyline inherits the marker-related capabilities of Polygon.
8294
- */var Polyline=/*#__PURE__*/function(_Polygon){_inheritsLoose(Polyline,_Polygon);function Polyline(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$9);return _Polygon.call(this,_extends({type:exports.Shape.POLYLINE,style:_extends({points:'',miterLimit:'',isClosed:false},style)},rest))||this;}var _proto=Polyline.prototype;_proto.getTotalLength=function getTotalLength(){return this.parsedStyle.points.totalLength;};_proto.getPointAtLength=function getPointAtLength(distance){return this.getPoint(distance/this.getTotalLength());};_proto.getPoint=function getPoint(ratio){var _this$parsedStyle=this.parsedStyle,defX=_this$parsedStyle.defX,defY=_this$parsedStyle.defY,_this$parsedStyle$poi=_this$parsedStyle.points,points=_this$parsedStyle$poi.points,segments=_this$parsedStyle$poi.segments;var subt=0;var index=0;segments.forEach(function(v,i){if(ratio>=v[0]&&ratio<=v[1]){subt=(ratio-v[0])/(v[1]-v[0]);index=i;}});var _LineUtil$pointAt=line.pointAt(points[index][0],points[index][1],points[index+1][0],points[index+1][1],subt),x=_LineUtil$pointAt.x,y=_LineUtil$pointAt.y;var transformed=transformMat4(create$2(),fromValues$2(x-defX,y-defY,0),this.getLocalTransform());// apply local transformation
8285
+ */var Polyline=/*#__PURE__*/function(_Polygon){_inheritsLoose(Polyline,_Polygon);function Polyline(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$9);return _Polygon.call(this,_extends({type:exports.Shape.POLYLINE,style:_extends({points:'',miterLimit:'',isClosed:false},style)},rest))||this;}var _proto=Polyline.prototype;_proto.getTotalLength=function getTotalLength(){return this.parsedStyle.points.totalLength;};_proto.getPointAtLength=function getPointAtLength(distance,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}return this.getPoint(distance/this.getTotalLength(),inWorldSpace);};_proto.getPoint=function getPoint(ratio,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}var _this$parsedStyle=this.parsedStyle,defX=_this$parsedStyle.defX,defY=_this$parsedStyle.defY,_this$parsedStyle$poi=_this$parsedStyle.points,points=_this$parsedStyle$poi.points,segments=_this$parsedStyle$poi.segments;var subt=0;var index=0;segments.forEach(function(v,i){if(ratio>=v[0]&&ratio<=v[1]){subt=(ratio-v[0])/(v[1]-v[0]);index=i;}});var _LineUtil$pointAt=line.pointAt(points[index][0],points[index][1],points[index+1][0],points[index+1][1],subt),x=_LineUtil$pointAt.x,y=_LineUtil$pointAt.y;var transformed=transformMat4(create$2(),fromValues$2(x-defX,y-defY,0),inWorldSpace?this.getWorldTransform():this.getLocalTransform());// apply local transformation
8295
8286
  return new Point(transformed[0],transformed[1]);};_proto.getStartTangent=function getStartTangent(){var points=this.parsedStyle.points.points;var result=[];result.push([points[1][0],points[1][1]]);result.push([points[0][0],points[0][1]]);return result;};_proto.getEndTangent=function getEndTangent(){var points=this.parsedStyle.points.points;var l=points.length-1;var result=[];result.push([points[l-1][0],points[l-1][1]]);result.push([points[l][0],points[l][1]]);return result;};return Polyline;}(Polygon);var _excluded$a=["style"];var Rect=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Rect,_DisplayObject);function Rect(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$a);return _DisplayObject.call(this,_extends({type:exports.Shape.RECT,style:_extends({x:'',y:'',width:'',height:'',radius:''},style)},rest))||this;}return Rect;}(DisplayObject);var _excluded$b=["style"];/**
8296
8287
  * <text> @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextElement
8297
8288
  */var Text=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Text,_DisplayObject);/**
@@ -8385,7 +8376,8 @@
8385
8376
  * Sets an offset in a larger frustum, used in PixelPicking
8386
8377
  */;_proto.setViewOffset=function setViewOffset(fullWidth,fullHeight,x,y,width,height){this.aspect=fullWidth/fullHeight;if(this.view===undefined){this.view={enabled:true,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};}this.view.enabled=true;this.view.fullWidth=fullWidth;this.view.fullHeight=fullHeight;this.view.offsetX=x;this.view.offsetY=y;this.view.width=width;this.view.height=height;if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,this.far,this.fov,this.aspect);}else {this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far);}return this;};_proto.clearViewOffset=function clearViewOffset(){if(this.view!==undefined){this.view.enabled=false;}if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,this.far,this.fov,this.aspect);}else {this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far);}return this;};_proto.setZoom=function setZoom(zoom){this.zoom=zoom;if(this.projectionMode===exports.CameraProjectionMode.ORTHOGRAPHIC){this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far);}else if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,this.far,this.fov,this.aspect);}return this;}/**
8387
8378
  * Zoom by specified point in viewport coordinates.
8388
- */;_proto.setZoomByViewportPoint=function setZoomByViewportPoint(zoom,viewportPoint){var _this$canvas$viewport=this.canvas.viewport2Canvas({x:viewportPoint[0],y:viewportPoint[1]}),ox=_this$canvas$viewport.x,oy=_this$canvas$viewport.y;this.setPosition(ox,oy);this.setFocalPoint(ox,oy);this.setZoom(zoom);var _this$canvas$viewport2=this.canvas.viewport2Canvas({x:viewportPoint[0],y:viewportPoint[1]}),cx=_this$canvas$viewport2.x,cy=_this$canvas$viewport2.y;this.pan(ox-cx,oy-cy);return this;};_proto.setPerspective=function setPerspective(near,far,fov,aspect){var _this$view;this.projectionMode=exports.CameraProjectionMode.PERSPECTIVE;this.fov=fov;this.near=near;this.far=far;this.aspect=aspect;var top=this.near*Math.tan(deg2rad(0.5*this.fov))/this.zoom;var height=2*top;var width=this.aspect*height;var left=-0.5*width;if((_this$view=this.view)===null||_this$view===void 0?void 0:_this$view.enabled){var fullWidth=this.view.fullWidth;var fullHeight=this.view.fullHeight;left+=this.view.offsetX*width/fullWidth;top-=this.view.offsetY*height/fullHeight;width*=this.view.width/fullWidth;height*=this.view.height/fullHeight;}makePerspective(this.projectionMatrix,left,left+width,top,top-height,near,this.far);// flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
8379
+ */;_proto.setZoomByViewportPoint=function setZoomByViewportPoint(zoom,viewportPoint){var _this$canvas$viewport=this.canvas.viewport2Canvas({x:viewportPoint[0],y:viewportPoint[1]}),ox=_this$canvas$viewport.x,oy=_this$canvas$viewport.y;var roll=this.roll;this.rotate(0,0,-roll);this.setPosition(ox,oy);this.setFocalPoint(ox,oy);this.setZoom(zoom);this.rotate(0,0,roll);var _this$canvas$viewport2=this.canvas.viewport2Canvas({x:viewportPoint[0],y:viewportPoint[1]}),cx=_this$canvas$viewport2.x,cy=_this$canvas$viewport2.y;// project to rotated axis
8380
+ var dvec=fromValues$2(cx-ox,cy-oy,0);var dx=dot(dvec,this.right)/length(this.right);var dy=dot(dvec,this.up)/length(this.up);this.pan(-dx,-dy);return this;};_proto.setPerspective=function setPerspective(near,far,fov,aspect){var _this$view;this.projectionMode=exports.CameraProjectionMode.PERSPECTIVE;this.fov=fov;this.near=near;this.far=far;this.aspect=aspect;var top=this.near*Math.tan(deg2rad(0.5*this.fov))/this.zoom;var height=2*top;var width=this.aspect*height;var left=-0.5*width;if((_this$view=this.view)===null||_this$view===void 0?void 0:_this$view.enabled){var fullWidth=this.view.fullWidth;var fullHeight=this.view.fullHeight;left+=this.view.offsetX*width/fullWidth;top-=this.view.offsetY*height/fullHeight;width*=this.view.width/fullWidth;height*=this.view.height/fullHeight;}makePerspective(this.projectionMatrix,left,left+width,top,top-height,near,this.far);// flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
8389
8381
  scale(this.projectionMatrix,this.projectionMatrix,fromValues$2(1,-1,1));invert(this.projectionMatrixInverse,this.projectionMatrix);this.triggerUpdate();return this;};_proto.setOrthographic=function setOrthographic(l,r,t,b,near,far){var _this$view2;this.projectionMode=exports.CameraProjectionMode.ORTHOGRAPHIC;this.rright=r;this.left=l;this.top=t;this.bottom=b;this.near=near;this.far=far;var dx=(this.rright-this.left)/(2*this.zoom);var dy=(this.top-this.bottom)/(2*this.zoom);var cx=(this.rright+this.left)/2;var cy=(this.top+this.bottom)/2;var left=cx-dx;var right=cx+dx;var top=cy+dy;var bottom=cy-dy;if((_this$view2=this.view)===null||_this$view2===void 0?void 0:_this$view2.enabled){var scaleW=(this.rright-this.left)/this.view.fullWidth/this.zoom;var scaleH=(this.top-this.bottom)/this.view.fullHeight/this.zoom;left+=scaleW*this.view.offsetX;right=left+scaleW*this.view.width;top-=scaleH*this.view.offsetY;bottom=top-scaleH*this.view.height;}ortho(this.projectionMatrix,left,right,bottom,top,near,far);// flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
8390
8382
  scale(this.projectionMatrix,this.projectionMatrix,fromValues$2(1,-1,1));invert(this.projectionMatrixInverse,this.projectionMatrix);this._getOrthoMatrix();this.triggerUpdate();return this;}/**
8391
8383
  * Move the camera in world coordinates.
@@ -8439,7 +8431,7 @@
8439
8431
  var minX=Math.min.apply(Math,points.map(function(point){return point[0];}));var maxX=Math.max.apply(Math,points.map(function(point){return point[0];}));var minY=Math.min.apply(Math,points.map(function(point){return point[1];}));var maxY=Math.max.apply(Math,points.map(function(point){return point[1];}));var width=maxX-minX;var height=maxY-minY;return {width:width,height:height};};return PolylineUpdater;}();var RectUpdater=/*#__PURE__*/function(){function RectUpdater(){}var _proto=RectUpdater.prototype;_proto.update=function update(parsedStyle,object){var img=parsedStyle.img,_parsedStyle$width=parsedStyle.width,width=_parsedStyle$width===void 0?0:_parsedStyle$width,_parsedStyle$height=parsedStyle.height,height=_parsedStyle$height===void 0?0:_parsedStyle$height;var contentWidth=width;var contentHeight=height;// resize with HTMLImageElement's size
8440
8432
  if(img&&!isString(img)){if(!contentWidth){contentWidth=img.width;parsedStyle.width=contentWidth;}if(!contentHeight){contentHeight=img.height;parsedStyle.height=contentHeight;}}return {width:contentWidth,height:contentHeight};};return RectUpdater;}();var TextUpdater=/*#__PURE__*/function(){function TextUpdater(globalRuntime){this.globalRuntime=void 0;this.globalRuntime=globalRuntime;}var _proto=TextUpdater.prototype;_proto.isReadyToMeasure=function isReadyToMeasure(parsedStyle,object){var text=parsedStyle.text,textAlign=parsedStyle.textAlign,textBaseline=parsedStyle.textBaseline,fontSize=parsedStyle.fontSize,fontStyle=parsedStyle.fontStyle,fontWeight=parsedStyle.fontWeight,fontVariant=parsedStyle.fontVariant,lineWidth=parsedStyle.lineWidth;return text&&fontSize&&fontStyle&&fontWeight&&fontVariant&&textAlign&&textBaseline&&!isNil(lineWidth);};_proto.update=function update(parsedStyle,object){var _object$ownerDocument,_object$ownerDocument2;var text=parsedStyle.text,textAlign=parsedStyle.textAlign,lineWidth=parsedStyle.lineWidth,textBaseline=parsedStyle.textBaseline,dx=parsedStyle.dx,dy=parsedStyle.dy;var _ref=(object===null||object===void 0?void 0:(_object$ownerDocument=object.ownerDocument)===null||_object$ownerDocument===void 0?void 0:(_object$ownerDocument2=_object$ownerDocument.defaultView)===null||_object$ownerDocument2===void 0?void 0:_object$ownerDocument2.getConfig())||{},offscreenCanvas=_ref.offscreenCanvas;if(!this.isReadyToMeasure(parsedStyle,object)){parsedStyle.metrics={font:'',width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]};return {width:0,height:0,x:0,y:0,offsetX:0,offsetY:0};}var metrics=this.globalRuntime.textService.measureText(text,parsedStyle,offscreenCanvas);parsedStyle.metrics=metrics;var width=metrics.width,height=metrics.height,lineHeight=metrics.lineHeight,fontProperties=metrics.fontProperties;// anchor is left-top by default
8441
8433
  var halfExtents=[width/2,height/2,0];// default 'left'
8442
- var anchor=[0,1];var lineXOffset=0;if(textAlign==='center'){lineXOffset=lineWidth/2;anchor=[0.5,1];}else if(textAlign==='right'||textAlign==='end'){lineXOffset=lineWidth;anchor=[1,1];}var lineYOffset=0;if(textBaseline==='middle'){// eslint-disable-next-line prefer-destructuring
8434
+ var anchor=[0,1];var lineXOffset=0;if(textAlign==='center'||textAlign==='middle'){lineXOffset=lineWidth/2;anchor=[0.5,1];}else if(textAlign==='right'||textAlign==='end'){lineXOffset=lineWidth;anchor=[1,1];}var lineYOffset=0;if(textBaseline==='middle'){// eslint-disable-next-line prefer-destructuring
8443
8435
  lineYOffset=halfExtents[1];}else if(textBaseline==='top'||textBaseline==='hanging'){lineYOffset=halfExtents[1]*2;}else if(textBaseline==='alphabetic'){lineYOffset=lineHeight-fontProperties.ascent;}else if(textBaseline==='bottom'||textBaseline==='ideographic'){lineYOffset=0;}// TODO: ideographic & bottom
8444
8436
  if(dx){lineXOffset+=dx;}if(dy){lineYOffset+=dy;}// update anchor
8445
8437
  parsedStyle.anchor=[anchor[0],anchor[1],0];return {width:halfExtents[0]*2,height:halfExtents[1]*2,offsetX:lineXOffset,offsetY:lineYOffset};};return TextUpdater;}();var PROPAGATION_LIMIT=2048;var EventService=/*#__PURE__*/function(){function EventService(globalRuntime,context){var _this=this;this.globalRuntime=void 0;this.context=void 0;this.rootTarget=void 0;this.emitter=new eventemitter3.EventEmitter();this.cursor='default';this.mappingTable={};this.mappingState={trackingData:{}};this.eventPool=new Map();this.pickHandler=void 0;this.tmpMatrix=create$1();this.tmpVec3=create$2();this.onPointerDown=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(from){var e,isRightButton,trackingData;return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(from instanceof FederatedPointerEvent){_context.next=2;break;}return _context.abrupt("return");case 2:_context.next=4;return _this.createPointerEvent(from);case 4:e=_context.sent;_this.dispatchEvent(e,'pointerdown');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchstart');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightdown':'mousedown');}trackingData=_this.trackingData(from.pointerId);trackingData.pressTargetsByButton[from.button]=e.composedPath();_this.freeEvent(e);case 10:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}();this.onPointerUp=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(from){var now,e,isRightButton,trackingData,pressTarget,clickTarget,currentTarget,_isRightButton,_e$detail,clickEvent,clickHistory;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(from instanceof FederatedPointerEvent){_context2.next=2;break;}return _context2.abrupt("return");case 2:now=performance.now();_context2.next=5;return _this.createPointerEvent(from);case 5:e=_context2.sent;_this.dispatchEvent(e,'pointerup');if(e.pointerType==='touch'){_this.dispatchEvent(e,'touchend');}else if(e.pointerType==='mouse'||e.pointerType==='pen'){isRightButton=e.button===2;_this.dispatchEvent(e,isRightButton?'rightup':'mouseup');}trackingData=_this.trackingData(from.pointerId);pressTarget=_this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);clickTarget=pressTarget;// pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
@@ -8466,7 +8458,9 @@
8466
8458
  _this.notifyTarget(enterEvent,'mouseenter');}if(Node.isNode(enterEvent.target)){enterEvent.target=enterEvent.target.parentNode;}}trackingData.overTargets=e.composedPath();_this.freeEvent(e);_this.freeEvent(enterEvent);case 16:case"end":return _context5.stop();}}},_callee5);}));return function(_x5){return _ref5.apply(this,arguments);};}();this.onPointerUpOutside=/*#__PURE__*/function(){var _ref6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(from){var trackingData,pressTarget,e,currentTarget;return _regeneratorRuntime().wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:if(from instanceof FederatedPointerEvent){_context6.next=2;break;}return _context6.abrupt("return");case 2:trackingData=_this.trackingData(from.pointerId);pressTarget=_this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);_context6.next=6;return _this.createPointerEvent(from);case 6:e=_context6.sent;if(pressTarget){currentTarget=pressTarget;while(currentTarget){e.currentTarget=currentTarget;_this.notifyTarget(e,'pointerupoutside');if(e.pointerType==='touch');else if(e.pointerType==='mouse'||e.pointerType==='pen'){_this.notifyTarget(e,e.button===2?'rightupoutside':'mouseupoutside');}if(Node.isNode(currentTarget)){currentTarget=currentTarget.parentNode;}}delete trackingData.pressTargetsByButton[from.button];}_this.freeEvent(e);case 9:case"end":return _context6.stop();}}},_callee6);}));return function(_x6){return _ref6.apply(this,arguments);};}();this.onWheel=/*#__PURE__*/function(){var _ref7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(from){var wheelEvent;return _regeneratorRuntime().wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:if(from instanceof FederatedWheelEvent){_context7.next=2;break;}return _context7.abrupt("return");case 2:_context7.next=4;return _this.createWheelEvent(from);case 4:wheelEvent=_context7.sent;_this.dispatchEvent(wheelEvent);_this.freeEvent(wheelEvent);case 7:case"end":return _context7.stop();}}},_callee7);}));return function(_x7){return _ref7.apply(this,arguments);};}();this.globalRuntime=globalRuntime;this.context=context;}var _proto=EventService.prototype;_proto.init=function init(){this.rootTarget=this.context.renderingContext.root.parentNode;// document
8467
8459
  this.addEventMapping('pointerdown',this.onPointerDown);this.addEventMapping('pointerup',this.onPointerUp);this.addEventMapping('pointermove',this.onPointerMove);this.addEventMapping('pointerout',this.onPointerOut);this.addEventMapping('pointerleave',this.onPointerOut);this.addEventMapping('pointerover',this.onPointerOver);this.addEventMapping('pointerupoutside',this.onPointerUpOutside);this.addEventMapping('wheel',this.onWheel);};_proto.client2Viewport=function client2Viewport(client){var bbox=this.context.contextService.getBoundingClientRect();return new Point(client.x-((bbox===null||bbox===void 0?void 0:bbox.left)||0),client.y-((bbox===null||bbox===void 0?void 0:bbox.top)||0));};_proto.viewport2Client=function viewport2Client(canvas){var bbox=this.context.contextService.getBoundingClientRect();return new Point(canvas.x+((bbox===null||bbox===void 0?void 0:bbox.left)||0),canvas.y+((bbox===null||bbox===void 0?void 0:bbox.top)||0));};_proto.viewport2Canvas=function viewport2Canvas(_ref8){var x=_ref8.x,y=_ref8.y;var canvas=this.rootTarget.defaultView;var camera=canvas.getCamera();var _this$context$config=this.context.config,width=_this$context$config.width,height=_this$context$config.height;var projectionMatrixInverse=camera.getPerspectiveInverse();var worldMatrix=camera.getWorldTransform();var vpMatrix=multiply(this.tmpMatrix,worldMatrix,projectionMatrixInverse);var viewport=set$1(this.tmpVec3,x/width*2-1,(1-y/height)*2-1,0);transformMat4(viewport,viewport,vpMatrix);return new Point(viewport[0],viewport[1]);};_proto.canvas2Viewport=function canvas2Viewport(canvasP){var canvas=this.rootTarget.defaultView;var camera=canvas.getCamera();// World -> Clip
8468
8460
  var projectionMatrix=camera.getPerspective();var viewMatrix=camera.getViewTransform();var vpMatrix=multiply(this.tmpMatrix,projectionMatrix,viewMatrix);var clip=set$1(this.tmpVec3,canvasP.x,canvasP.y,0);transformMat4(this.tmpVec3,this.tmpVec3,vpMatrix);// Clip -> NDC -> Viewport, flip Y
8469
- var _this$context$config2=this.context.config,width=_this$context$config2.width,height=_this$context$config2.height;return new Point((clip[0]+1)/2*width,(1-(clip[1]+1)/2)*height);};_proto.setPickHandler=function setPickHandler(pickHandler){this.pickHandler=pickHandler;};_proto.addEventMapping=function addEventMapping(type,fn){if(!this.mappingTable[type]){this.mappingTable[type]=[];}this.mappingTable[type].push({fn:fn,priority:0});this.mappingTable[type].sort(function(a,b){return a.priority-b.priority;});};_proto.mapEvent=function mapEvent(e){if(!this.rootTarget){return;}var mappers=this.mappingTable[e.type];if(mappers){for(var i=0,j=mappers.length;i<j;i++){mappers[i].fn(e);}}else {console.warn("[EventService]: Event mapping not defined for "+e.type);}};_proto.dispatchEvent=function dispatchEvent(e,type){e.propagationStopped=false;e.propagationImmediatelyStopped=false;this.propagate(e,type);this.emitter.emit(type||e.type,e);};_proto.propagate=function propagate(e,type){if(!e.target){return;}// [target, parent, root, Canvas]
8461
+ var _this$context$config2=this.context.config,width=_this$context$config2.width,height=_this$context$config2.height;return new Point((clip[0]+1)/2*width,(1-(clip[1]+1)/2)*height);};_proto.setPickHandler=function setPickHandler(pickHandler){this.pickHandler=pickHandler;};_proto.addEventMapping=function addEventMapping(type,fn){if(!this.mappingTable[type]){this.mappingTable[type]=[];}this.mappingTable[type].push({fn:fn,priority:0});this.mappingTable[type].sort(function(a,b){return a.priority-b.priority;});};_proto.mapEvent=function mapEvent(e){if(!this.rootTarget){return;}var mappers=this.mappingTable[e.type];if(mappers){for(var i=0,j=mappers.length;i<j;i++){mappers[i].fn(e);}}else {console.warn("[EventService]: Event mapping not defined for "+e.type);}};_proto.dispatchEvent=function dispatchEvent(e,type,skipPropagate){// Canvas should skip
8462
+ if(!skipPropagate){e.propagationStopped=false;e.propagationImmediatelyStopped=false;this.propagate(e,type);}else {// target phase
8463
+ e.eventPhase=e.AT_TARGET;var canvas=this.rootTarget.defaultView||null;e.currentTarget=canvas;this.notifyListeners(e,type);}this.emitter.emit(type||e.type,e);};_proto.propagate=function propagate(e,type){if(!e.target){return;}// [target, parent, root, Canvas]
8470
8464
  var composedPath=e.composedPath();// event flow: capture -> target -> bubbling
8471
8465
  // capture phase
8472
8466
  e.eventPhase=e.CAPTURING_PHASE;for(var i=composedPath.length-1;i>=1;i--){e.currentTarget=composedPath[i];this.notifyTarget(e,type);if(e.propagationStopped||e.propagationImmediatelyStopped)return;}// target phase
@@ -8548,7 +8542,7 @@
8548
8542
  // dirtycheck first
8549
8543
  var objectChanged=enableDirtyCheck?this.hooks.dirtycheck.call(displayObject):displayObject;if(objectChanged){var objectToRender=enableCulling?this.hooks.cull.call(objectChanged,this.context.camera):objectChanged;if(objectToRender){this.stats.rendered++;renderingContext.renderListCurrentFrame.push(objectToRender);}}displayObject.renderable.dirty=false;displayObject.sortable.renderOrder=this.zIndexCounter++;this.stats.total++;// sort is very expensive, use cached result if posible
8550
8544
  var sortable=displayObject.sortable;var renderOrderChanged=false;if(sortable.dirty){sortable.sorted=displayObject.childNodes.slice().sort(sortByZIndex);renderOrderChanged=true;sortable.dirty=false;}// recursive rendering its children
8551
- (sortable.sorted||displayObject.childNodes).forEach(function(child){_this2.renderDisplayObject(child,canvasConfig,renderingContext);});if(renderOrderChanged){displayObject.forEach(function(child){_this2.renderOrderChangedEvent.detail={renderOrder:child.sortable.renderOrder};child.dispatchEvent(_this2.renderOrderChangedEvent);});}};_proto.destroy=function destroy(){this.inited=false;this.hooks.destroy.call();};_proto.dirtify=function dirtify(){// need re-render
8545
+ (sortable.sorted||displayObject.childNodes).forEach(function(child){_this2.renderDisplayObject(child,canvasConfig,renderingContext);});if(renderOrderChanged){displayObject.forEach(function(child){_this2.renderOrderChangedEvent.target=child;_this2.renderOrderChangedEvent.detail={renderOrder:child.sortable.renderOrder};child.ownerDocument.defaultView.dispatchEvent(_this2.renderOrderChangedEvent,true);});}};_proto.destroy=function destroy(){this.inited=false;this.hooks.destroy.call();};_proto.dirtify=function dirtify(){// need re-render
8552
8546
  this.context.renderingContext.renderReasons.add(exports.RenderReason.DISPLAY_OBJECT_CHANGED);};return RenderingService;}();var ATTRIBUTE_REGEXP=/\[\s*(.*)=(.*)\s*\]/;/**
8553
8547
  * support the following DOM API:
8554
8548
  * * getElementById
@@ -8621,7 +8615,7 @@
8621
8615
  *
8622
8616
  * 对应 g 原版的 translate 2D
8623
8617
  * @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L665-L676
8624
- */;_proto.setLocalRotation=function setLocalRotation(element,rotation,y,z,w){if(typeof rotation==='number'){rotation=fromValues$4(rotation,y,z,w);}var transform=element.transformable;copy$3(transform.localRotation,rotation);this.dirtifyLocal(element,transform);};_proto.setLocalSkew=function setLocalSkew(element,skew,y){if(typeof skew==='number'){skew=fromValues$5(skew,y);}var transform=element.transformable;copy$4(transform.localSkew,skew);this.dirtifyLocal(element,transform);};_proto.dirtifyLocal=function dirtifyLocal(element,transform){if(!transform.localDirtyFlag){transform.localDirtyFlag=true;if(!transform.dirtyFlag){this.dirtifyWorld(element,transform);}}};_proto.dirtifyWorld=function dirtifyWorld(element,transform){if(!transform.dirtyFlag){this.unfreezeParentToRoot(element);}this.dirtifyWorldInternal(element,transform);this.dirtifyToRoot(element,true);};_proto.triggerPendingEvents=function triggerPendingEvents(){var _this2=this;var set=new Set();var trigger=function trigger(element,detail){if(!set.has(element.entity)){_this2.boundsChangedEvent.detail=detail;element.dispatchEvent(_this2.boundsChangedEvent);set.add(element.entity);}};this.pendingEvents.forEach(function(_ref){var element=_ref[0],detail=_ref[1];if(detail.affectChildren){element.forEach(function(e){trigger(e,detail);});}else {trigger(element,detail);}});this.pendingEvents=[];};_proto.dirtifyToRoot=function dirtifyToRoot(element,affectChildren){if(affectChildren===void 0){affectChildren=false;}var p=element;// only need to re-render itself
8618
+ */;_proto.setLocalRotation=function setLocalRotation(element,rotation,y,z,w){if(typeof rotation==='number'){rotation=fromValues$4(rotation,y,z,w);}var transform=element.transformable;copy$3(transform.localRotation,rotation);this.dirtifyLocal(element,transform);};_proto.setLocalSkew=function setLocalSkew(element,skew,y){if(typeof skew==='number'){skew=fromValues$5(skew,y);}var transform=element.transformable;copy$4(transform.localSkew,skew);this.dirtifyLocal(element,transform);};_proto.dirtifyLocal=function dirtifyLocal(element,transform){if(!transform.localDirtyFlag){transform.localDirtyFlag=true;if(!transform.dirtyFlag){this.dirtifyWorld(element,transform);}}};_proto.dirtifyWorld=function dirtifyWorld(element,transform){if(!transform.dirtyFlag){this.unfreezeParentToRoot(element);}this.dirtifyWorldInternal(element,transform);this.dirtifyToRoot(element,true);};_proto.triggerPendingEvents=function triggerPendingEvents(){var _this2=this;var set=new Set();var trigger=function trigger(element,detail){if(element.isConnected&&!set.has(element.entity)){_this2.boundsChangedEvent.detail=detail;_this2.boundsChangedEvent.target=element;element.ownerDocument.defaultView.dispatchEvent(_this2.boundsChangedEvent,true);set.add(element.entity);}};this.pendingEvents.forEach(function(_ref){var element=_ref[0],detail=_ref[1];if(detail.affectChildren){element.forEach(function(e){trigger(e,detail);});}else {trigger(element,detail);}});this.pendingEvents=[];set.clear();};_proto.dirtifyToRoot=function dirtifyToRoot(element,affectChildren){if(affectChildren===void 0){affectChildren=false;}var p=element;// only need to re-render itself
8625
8619
  if(p.renderable){p.renderable.dirty=true;}while(p){var renderable=p.renderable;if(renderable){renderable.renderBoundsDirty=true;renderable.boundsDirty=true;}p=p.parentNode;}// inform dependencies
8626
8620
  this.informDependentDisplayObjects(element);// reuse the same custom event
8627
8621
  this.pendingEvents.push([element,{affectChildren:affectChildren}]);};_proto.updateDisplayObjectDependency=function updateDisplayObjectDependency(name,oldPath,newPath,object){// clear ref to old clip path
@@ -8690,7 +8684,7 @@
8690
8684
  // }
8691
8685
  lineHeight+=leading;// handle vertical text baseline
8692
8686
  var offsetY=0;if(textBaseline==='middle'){offsetY=-height/2;}else if(textBaseline==='bottom'||textBaseline==='alphabetic'||textBaseline==='ideographic'){offsetY=-height;}else if(textBaseline==='top'||textBaseline==='hanging'){offsetY=0;}return {font:font,width:_width,height:height,lines:lines,lineWidths:lineWidths,lineHeight:lineHeight,maxLineWidth:maxLineWidth,fontProperties:fontProperties,lineMetrics:lineWidths.map(function(width,i){var offsetX=0;// handle horizontal text align
8693
- if(textAlign==='center'){offsetX-=width/2;}else if(textAlign==='right'||textAlign==='end'){offsetX-=width;}return new Rectangle(offsetX-lineWidth/2,offsetY+i*lineHeight,width+lineWidth,lineHeight);})};}};_proto.setGraphemeOnPath=function setGraphemeOnPath(){};_proto.wordWrap=function wordWrap(text,parsedStyle,offscreenCanvas){var _this2=this;var _parsedStyle$wordWrap=parsedStyle.wordWrapWidth,wordWrapWidth=_parsedStyle$wordWrap===void 0?0:_parsedStyle$wordWrap,letterSpacing=parsedStyle.letterSpacing,_parsedStyle$maxLines=parsedStyle.maxLines,maxLines=_parsedStyle$maxLines===void 0?Infinity:_parsedStyle$maxLines,textOverflow=parsedStyle.textOverflow;var context=this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);var maxWidth=wordWrapWidth+letterSpacing;var ellipsis='';if(textOverflow==='ellipsis'){ellipsis='...';}else if(textOverflow&&textOverflow!=='clip'){ellipsis=textOverflow;}var lines=[];var currentIndex=0;var currentWidth=0;var cache={};var calcWidth=function calcWidth(char){return _this2.getFromCache(char,letterSpacing,cache,context);};var ellipsisWidth=Array.from(ellipsis).reduce(function(prev,cur){return prev+calcWidth(cur);},0);var chars=Array.from(text);for(var i=0;i<chars.length;i++){var char=chars[i];var prevChar=text[i-1];var nextChar=text[i+1];var width=calcWidth(char);if(this.isNewline(char)){currentIndex++;currentWidth=0;lines[currentIndex]='';continue;}if(currentWidth>0&&currentWidth+width>maxWidth){if(currentIndex+1>=maxLines){parsedStyle.isOverflowing=true;// If there is not enough space to display the string itself, it is clipped.
8687
+ if(textAlign==='center'||textAlign==='middle'){offsetX-=width/2;}else if(textAlign==='right'||textAlign==='end'){offsetX-=width;}return new Rectangle(offsetX-lineWidth/2,offsetY+i*lineHeight,width+lineWidth,lineHeight);})};}};_proto.setGraphemeOnPath=function setGraphemeOnPath(){};_proto.wordWrap=function wordWrap(text,parsedStyle,offscreenCanvas){var _this2=this;var _parsedStyle$wordWrap=parsedStyle.wordWrapWidth,wordWrapWidth=_parsedStyle$wordWrap===void 0?0:_parsedStyle$wordWrap,letterSpacing=parsedStyle.letterSpacing,_parsedStyle$maxLines=parsedStyle.maxLines,maxLines=_parsedStyle$maxLines===void 0?Infinity:_parsedStyle$maxLines,textOverflow=parsedStyle.textOverflow;var context=this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);var maxWidth=wordWrapWidth+letterSpacing;var ellipsis='';if(textOverflow==='ellipsis'){ellipsis='...';}else if(textOverflow&&textOverflow!=='clip'){ellipsis=textOverflow;}var lines=[];var currentIndex=0;var currentWidth=0;var cache={};var calcWidth=function calcWidth(char){return _this2.getFromCache(char,letterSpacing,cache,context);};var ellipsisWidth=Array.from(ellipsis).reduce(function(prev,cur){return prev+calcWidth(cur);},0);var chars=Array.from(text);for(var i=0;i<chars.length;i++){var char=chars[i];var prevChar=text[i-1];var nextChar=text[i+1];var width=calcWidth(char);if(this.isNewline(char)){currentIndex++;currentWidth=0;lines[currentIndex]='';continue;}if(currentWidth>0&&currentWidth+width>maxWidth){if(currentIndex+1>=maxLines){parsedStyle.isOverflowing=true;// If there is not enough space to display the string itself, it is clipped.
8694
8688
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
8695
8689
  if(ellipsisWidth>0&&ellipsisWidth<=maxWidth){// Backspace from line's end.
8696
8690
  var lastLineWidth=0;var lastLineIndex=0;for(var _i2=0;_i2<lines[currentIndex].length;_i2++){var _width2=calcWidth(lines[currentIndex][_i2]);if(lastLineWidth+_width2+ellipsisWidth>maxWidth){lastLineIndex=_i2;break;}lastLineWidth+=_width2;}lines[currentIndex]=(lines[currentIndex]||'').slice(0,lastLineIndex)+ellipsis;}break;}currentIndex++;currentWidth=0;lines[currentIndex]='';if(this.isBreakingSpace(char)){continue;}if(!this.canBreakInLastChar(char)){lines=this.trimToBreakable(lines);currentWidth=this.sumTextWidthByCache(lines[currentIndex]||'',cache);}if(this.shouldBreakByKinsokuShorui(char,nextChar)){lines=this.trimByKinsokuShorui(lines);currentWidth+=calcWidth(prevChar||'');}}currentWidth+=width;lines[currentIndex]=(lines[currentIndex]||'')+char;}return lines.join('\n');};_proto.isBreakingSpace=function isBreakingSpace(char){if(typeof char!=='string'){return false;}return TEXT_METRICS.BreakingSpaces.indexOf(char.charCodeAt(0))>=0;};_proto.isNewline=function isNewline(char){if(typeof char!=='string'){return false;}return TEXT_METRICS.Newlines.indexOf(char.charCodeAt(0))>=0;};_proto.trimToBreakable=function trimToBreakable(prev){var next=[].concat(prev);var prevLine=next[next.length-2];var index=this.findBreakableIndex(prevLine);if(index===-1||!prevLine)return next;var trimmedChar=prevLine.slice(index,index+1);var isTrimmedWithSpace=this.isBreakingSpace(trimmedChar);var trimFrom=index+1;var trimTo=index+(isTrimmedWithSpace?0:1);next[next.length-1]+=prevLine.slice(trimFrom,prevLine.length);next[next.length-2]=prevLine.slice(0,trimTo);return next;};_proto.canBreakInLastChar=function canBreakInLastChar(char){if(char&&LATIN_REGEX.test(char))return false;return true;};_proto.sumTextWidthByCache=function sumTextWidthByCache(text,cache){return text.split('').reduce(function(sum,c){if(!cache[c])throw Error('cannot count the word without cache');return sum+cache[c];},0);};_proto.findBreakableIndex=function findBreakableIndex(line){for(var i=line.length-1;i>=0;i--){if(!LATIN_REGEX.test(line[i]))return i;}return -1;};_proto.getFromCache=function getFromCache(key,letterSpacing,cache,context){var width=cache[key];if(typeof width!=='number'){var spacing=key.length*letterSpacing;width=context.measureText(key).width+spacing;cache[key]=width;}return width;};return TextService;}();var runtime={};/**
@@ -8769,23 +8763,26 @@
8769
8763
  if(isShape2D&&(k===4||k===5)){continue;}// p-vertex n-vertex <-|plane p-vertex n-vertex
8770
8764
  // 使用 p-vertex 和 n-vertex 加速,避免进行平面和 aabb 全部顶点的相交检测
8771
8765
  var _planes$k=planes[k],normal=_planes$k.normal,distance=_planes$k.distance;if(dot(normal,aabb.getPositiveFarPoint(planes[k]))+distance<0){return exports.Mask.OUTSIDE;}if(dot(normal,aabb.getNegativeFarPoint(planes[k]))+distance<0){// 和当前面相交,对应位置为1,继续检测下一个面
8772
- mask|=flag;}}return mask;};return FrustumCullingStrategy;}();var PrepareRendererPlugin=/*#__PURE__*/function(){function PrepareRendererPlugin(){this.rBush=void 0;this.toSync=new Set();}var _proto=PrepareRendererPlugin.prototype;_proto.pushToSync=function pushToSync(list){var _this=this;list.forEach(function(i){_this.toSync.add(i);});}// private isFirstTimeRendering = true;
8773
- ;_proto.apply=function apply(context){var _this2=this;var renderingService=context.renderingService,renderingContext=context.renderingContext,rBushRoot=context.rBushRoot;this.rBush=rBushRoot;var handleAttributeChanged=function handleAttributeChanged(e){var object=e.target;object.renderable.dirty=true;renderingService.dirtify();};var handleBoundsChanged=function handleBoundsChanged(e){var affectChildren=e.detail.affectChildren;var object=e.target;if(affectChildren){object.forEach(function(node){_this2.pushToSync([node]);});}_this2.pushToSync(e.composedPath().slice(0,-2));renderingService.dirtify();};var handleMounted=function handleMounted(e){var object=e.target;_this2.pushToSync(e.composedPath().slice(0,-2));// recalc style values
8774
- runtime.styleValueRegistry.recalc(object);runtime.sceneGraphService.dirtifyToRoot(object);renderingService.dirtify();};var handleUnmounted=function handleUnmounted(e){var object=e.target;var rBushNode=object.rBushNode;if(rBushNode.aabb){_this2.rBush.remove(rBushNode.aabb);}_this2.toSync.delete(object);runtime.sceneGraphService.dirtifyToRoot(e.target);renderingService.dirtify();};renderingService.hooks.init.tapPromise(PrepareRendererPlugin.tag,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:renderingContext.root.addEventListener(exports.ElementEvent.MOUNTED,handleMounted);renderingContext.root.addEventListener(exports.ElementEvent.UNMOUNTED,handleUnmounted);renderingContext.root.addEventListener(exports.ElementEvent.ATTR_MODIFIED,handleAttributeChanged);renderingContext.root.addEventListener(exports.ElementEvent.BOUNDS_CHANGED,handleBoundsChanged);case 4:case"end":return _context.stop();}}},_callee);})));renderingService.hooks.destroy.tap(PrepareRendererPlugin.tag,function(){renderingContext.root.removeEventListener(exports.ElementEvent.MOUNTED,handleMounted);renderingContext.root.removeEventListener(exports.ElementEvent.UNMOUNTED,handleUnmounted);renderingContext.root.removeEventListener(exports.ElementEvent.ATTR_MODIFIED,handleAttributeChanged);renderingContext.root.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED,handleBoundsChanged);});renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag,function(){// if (this.isFirstTimeRendering) {
8766
+ mask|=flag;}}return mask;};return FrustumCullingStrategy;}();var PrepareRendererPlugin=/*#__PURE__*/function(){function PrepareRendererPlugin(){this.rBush=void 0;this.toSync=new Set();}var _proto=PrepareRendererPlugin.prototype;// private isFirstTimeRendering = true;
8767
+ _proto.apply=function apply(context){var _this=this;var renderingService=context.renderingService,renderingContext=context.renderingContext,rBushRoot=context.rBushRoot;var canvas=renderingContext.root.ownerDocument.defaultView;this.rBush=rBushRoot;var handleAttributeChanged=function handleAttributeChanged(e){var object=e.target;object.renderable.dirty=true;renderingService.dirtify();};var handleBoundsChanged=function handleBoundsChanged(e){var affectChildren=e.detail.affectChildren;var object=e.target;if(affectChildren){object.forEach(function(node){_this.toSync.add(node);});}var p=object;while(p){if(p.renderable){_this.toSync.add(p);}p=p.parentElement;}// this.pushToSync(e.composedPath().slice(0, -2) as DisplayObject[]);
8768
+ renderingService.dirtify();};var handleMounted=function handleMounted(e){var object=e.target;// recalc style values
8769
+ runtime.styleValueRegistry.recalc(object);runtime.sceneGraphService.dirtifyToRoot(object);renderingService.dirtify();};var handleUnmounted=function handleUnmounted(e){var object=e.target;var rBushNode=object.rBushNode;if(rBushNode.aabb){_this.rBush.remove(rBushNode.aabb);}_this.toSync.delete(object);runtime.sceneGraphService.dirtifyToRoot(object);renderingService.dirtify();};renderingService.hooks.init.tapPromise(PrepareRendererPlugin.tag,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:canvas.addEventListener(exports.ElementEvent.MOUNTED,handleMounted);canvas.addEventListener(exports.ElementEvent.UNMOUNTED,handleUnmounted);canvas.addEventListener(exports.ElementEvent.ATTR_MODIFIED,handleAttributeChanged);canvas.addEventListener(exports.ElementEvent.BOUNDS_CHANGED,handleBoundsChanged);case 4:case"end":return _context.stop();}}},_callee);})));renderingService.hooks.destroy.tap(PrepareRendererPlugin.tag,function(){canvas.removeEventListener(exports.ElementEvent.MOUNTED,handleMounted);canvas.removeEventListener(exports.ElementEvent.UNMOUNTED,handleUnmounted);canvas.removeEventListener(exports.ElementEvent.ATTR_MODIFIED,handleAttributeChanged);canvas.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED,handleBoundsChanged);});renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag,function(){// if (this.isFirstTimeRendering) {
8775
8770
  // // @see https://github.com/antvis/G/issues/1117
8776
8771
  // setTimeout(() => this.syncRTree());
8777
8772
  // this.isFirstTimeRendering = false;
8778
8773
  // } else {
8779
8774
  // this.syncRTree();
8780
8775
  // }
8781
- _this2.syncRTree();});};_proto.syncRTree=function syncRTree(){var _this3=this;// bounds changed, need re-inserting its children
8776
+ _this.syncRTree();});};_proto.syncRTree=function syncRTree(){var _this2=this;// bounds changed, need re-inserting its children
8782
8777
  var bulk=[];Array.from(this.toSync)// some objects may be removed since last frame
8783
8778
  .filter(function(object){return object.isConnected;}).forEach(function(node){var rBushNode=node.rBushNode;// clear dirty node
8784
- if(rBushNode&&rBushNode.aabb){_this3.rBush.remove(rBushNode.aabb);}var renderBounds=node.getRenderBounds();if(renderBounds){var _renderBounds$getMin=renderBounds.getMin(),minX=_renderBounds$getMin[0],minY=_renderBounds$getMin[1];var _renderBounds$getMax=renderBounds.getMax(),maxX=_renderBounds$getMax[0],maxY=_renderBounds$getMax[1];if(!rBushNode.aabb){// @ts-ignore
8779
+ if(rBushNode&&rBushNode.aabb){_this2.rBush.remove(rBushNode.aabb);}var renderBounds=node.getRenderBounds();if(renderBounds){var _renderBounds$getMin=renderBounds.getMin(),minX=_renderBounds$getMin[0],minY=_renderBounds$getMin[1];var _renderBounds$getMax=renderBounds.getMax(),maxX=_renderBounds$getMax[0],maxY=_renderBounds$getMax[1];if(!rBushNode.aabb){// @ts-ignore
8785
8780
  rBushNode.aabb={};}rBushNode.aabb.id=node.entity;rBushNode.aabb.minX=minX;rBushNode.aabb.minY=minY;rBushNode.aabb.maxX=maxX;rBushNode.aabb.maxY=maxY;}if(rBushNode.aabb){// TODO: NaN occurs when width/height of Rect is 0
8786
8781
  if(!isNaN(rBushNode.aabb.maxX)&&!isNaN(rBushNode.aabb.maxX)&&!isNaN(rBushNode.aabb.minX)&&!isNaN(rBushNode.aabb.minY)){bulk.push(rBushNode.aabb);}}});// use bulk inserting, which is ~2-3 times faster
8787
8782
  // @see https://github.com/mourner/rbush#bulk-inserting-data
8788
8783
  this.rBush.load(bulk);bulk.length=0;this.toSync.clear();};return PrepareRendererPlugin;}();PrepareRendererPlugin.tag='Prepare';(function(CanvasEvent){CanvasEvent["READY"]="ready";CanvasEvent["BEFORE_RENDER"]="beforerender";CanvasEvent["AFTER_RENDER"]="afterrender";CanvasEvent["BEFORE_DESTROY"]="beforedestroy";CanvasEvent["AFTER_DESTROY"]="afterdestroy";CanvasEvent["RESIZE"]="resize";CanvasEvent["DIRTY_RECTANGLE"]="dirtyrectangle";})(exports.CanvasEvent||(exports.CanvasEvent={}));var DEFAULT_CAMERA_Z=500;var DEFAULT_CAMERA_NEAR=0.1;var DEFAULT_CAMERA_FAR=1000;/**
8784
+ * reuse custom event preventing from re-create them in every frame
8785
+ */var mountedEvent=new CustomEvent(exports.ElementEvent.MOUNTED);var unmountedEvent=new CustomEvent(exports.ElementEvent.UNMOUNTED);var beforeRenderEvent=new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);var afterRenderEvent=new CustomEvent(exports.CanvasEvent.AFTER_RENDER);/**
8789
8786
  * can be treated like Window in DOM
8790
8787
  * provide some extra methods like `window`, such as:
8791
8788
  * * `window.requestAnimationFrame`
@@ -8816,10 +8813,8 @@
8816
8813
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element
8817
8814
  */ /**
8818
8815
  * rAF in auto rendering
8819
- */ /**
8820
- * reuse custom event preventing from re-create them in every frame
8821
8816
  */function Canvas(config){var _this;_this=_EventTarget.call(this)||this;// create document
8822
- _this.document=void 0;_this.customElements=void 0;_this.requestAnimationFrame=void 0;_this.cancelAnimationFrame=void 0;_this.devicePixelRatio=void 0;_this.supportsPointerEvents=void 0;_this.supportsTouchEvents=void 0;_this.isTouchEvent=void 0;_this.isMouseEvent=void 0;_this.Element=DisplayObject;_this.frameId=void 0;_this.inited=false;_this.readyPromise=void 0;_this.resolveReadyPromise=void 0;_this.mountEvent=new CustomEvent(exports.ElementEvent.MOUNTED);_this.unmountEvent=new CustomEvent(exports.ElementEvent.UNMOUNTED);_this.beforeRenderEvent=new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);_this.afterRenderEvent=new CustomEvent(exports.CanvasEvent.AFTER_RENDER);_this.context={};_this.document=new Document();_this.document.defaultView=_assertThisInitialized(_this);// create registry of custom elements
8817
+ _this.document=void 0;_this.customElements=void 0;_this.requestAnimationFrame=void 0;_this.cancelAnimationFrame=void 0;_this.devicePixelRatio=void 0;_this.supportsPointerEvents=void 0;_this.supportsTouchEvents=void 0;_this.isTouchEvent=void 0;_this.isMouseEvent=void 0;_this.Element=DisplayObject;_this.frameId=void 0;_this.inited=false;_this.readyPromise=void 0;_this.resolveReadyPromise=void 0;_this.context={};_this.document=new Document();_this.document.defaultView=_assertThisInitialized(_this);// create registry of custom elements
8823
8818
  _this.customElements=new CustomElementRegistry();var container=config.container,canvas=config.canvas,offscreenCanvas=config.offscreenCanvas,width=config.width,height=config.height,devicePixelRatio=config.devicePixelRatio,renderer=config.renderer,background=config.background,cursor=config.cursor,document=config.document,requestAnimationFrame=config.requestAnimationFrame,cancelAnimationFrame=config.cancelAnimationFrame,createImage=config.createImage,supportsPointerEvents=config.supportsPointerEvents,supportsTouchEvents=config.supportsTouchEvents,supportsCSSTransform=config.supportsCSSTransform,isTouchEvent=config.isTouchEvent,isMouseEvent=config.isMouseEvent;cleanExistedCanvas(container,_assertThisInitialized(_this));var canvasWidth=width;var canvasHeight=height;var dpr=devicePixelRatio;// use user-defined <canvas> or OffscreenCanvas
8824
8819
  if(canvas){// infer width & height with dpr
8825
8820
  dpr=devicePixelRatio||isBrowser&&window.devicePixelRatio||1;dpr=dpr>=1?Math.ceil(dpr):1;canvasWidth=width||getWidth(canvas)||canvas.width/dpr;canvasHeight=height||getHeight(canvas)||canvas.height/dpr;}/**
@@ -8828,13 +8823,13 @@
8828
8823
  * limits query
8829
8824
  */ // the following feature-detect from hammer.js
8830
8825
  // @see https://github.com/hammerjs/hammer.js/blob/master/src/inputjs/input-consts.js#L5
8831
- _this.supportsTouchEvents=supportsTouchEvents!==null&&supportsTouchEvents!==void 0?supportsTouchEvents:'ontouchstart'in globalThis;_this.supportsPointerEvents=supportsPointerEvents!==null&&supportsPointerEvents!==void 0?supportsPointerEvents:!!globalThis.PointerEvent;_this.isTouchEvent=isTouchEvent!==null&&isTouchEvent!==void 0?isTouchEvent:function(event){return _this.supportsTouchEvents&&event instanceof globalThis.TouchEvent;};_this.isMouseEvent=isMouseEvent!==null&&isMouseEvent!==void 0?isMouseEvent:function(event){return !globalThis.MouseEvent||event instanceof globalThis.MouseEvent&&(!_this.supportsPointerEvents||!(event instanceof globalThis.PointerEvent));};_this.initRenderingContext({container:container,canvas:canvas,width:canvasWidth,height:canvasHeight,renderer:renderer,offscreenCanvas:offscreenCanvas,devicePixelRatio:dpr,cursor:cursor||'default',background:background||'transparent',createImage:createImage,document:document,supportsCSSTransform:supportsCSSTransform});_this.initDefaultCamera(canvasWidth,canvasHeight);_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _this.initRenderer(renderer);case 2:_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));if(_this.readyPromise){_this.resolveReadyPromise();}case 4:case"end":return _context.stop();}}},_callee);}))();return _this;}var _proto=Canvas.prototype;_proto.initRenderingContext=function initRenderingContext(mergedConfig){var _this2=this;this.context.config=mergedConfig;// bind rendering context, shared by all renderers
8826
+ _this.supportsTouchEvents=supportsTouchEvents!==null&&supportsTouchEvents!==void 0?supportsTouchEvents:'ontouchstart'in globalThis;_this.supportsPointerEvents=supportsPointerEvents!==null&&supportsPointerEvents!==void 0?supportsPointerEvents:!!globalThis.PointerEvent;_this.isTouchEvent=isTouchEvent!==null&&isTouchEvent!==void 0?isTouchEvent:function(event){return _this.supportsTouchEvents&&event instanceof globalThis.TouchEvent;};_this.isMouseEvent=isMouseEvent!==null&&isMouseEvent!==void 0?isMouseEvent:function(event){return !globalThis.MouseEvent||event instanceof globalThis.MouseEvent&&(!_this.supportsPointerEvents||!(event instanceof globalThis.PointerEvent));};_this.initRenderingContext({container:container,canvas:canvas,width:canvasWidth,height:canvasHeight,renderer:renderer,offscreenCanvas:offscreenCanvas,devicePixelRatio:dpr,cursor:cursor||'default',background:background||'transparent',createImage:createImage,document:document,supportsCSSTransform:supportsCSSTransform});_this.initDefaultCamera(canvasWidth,canvasHeight);_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _this.initRenderer(renderer);case 2:_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));if(_this.readyPromise){_this.resolveReadyPromise();}case 4:case"end":return _context.stop();}}},_callee);}))();return _this;}var _proto=Canvas.prototype;_proto.initRenderingContext=function initRenderingContext(mergedConfig){this.context.config=mergedConfig;// bind rendering context, shared by all renderers
8832
8827
  this.context.renderingContext={/**
8833
8828
  * the root node in scene graph
8834
- */root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set(),force:false,dirty:false};this.document.documentElement.addEventListener(exports.ElementEvent.CHILD_INSERTED,function(e){_this2.mountChildren(e.detail.child);});this.document.documentElement.addEventListener(exports.ElementEvent.CHILD_REMOVED,function(e){_this2.unmountChildren(e.detail.child);});};_proto.initDefaultCamera=function initDefaultCamera(width,height){var _this3=this;// set a default ortho camera
8829
+ */root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set(),force:false,dirty:false};};_proto.initDefaultCamera=function initDefaultCamera(width,height){var _this2=this;// set a default ortho camera
8835
8830
  var camera=new runtime.CameraContribution();camera.setType(exports.CameraType.EXPLORING,exports.CameraTrackingMode.DEFAULT).setPosition(width/2,height/2,DEFAULT_CAMERA_Z).setFocalPoint(width/2,height/2,0).setOrthographic(width/-2,width/2,height/2,height/-2,DEFAULT_CAMERA_NEAR,DEFAULT_CAMERA_FAR);// keep ref since it will use raf in camera animation
8836
8831
  camera.canvas=this;// redraw when camera changed
8837
- camera.eventEmitter.on(CameraEvent.UPDATED,function(){_this3.context.renderingContext.renderReasons.add(exports.RenderReason.CAMERA_CHANGED);});// bind camera
8832
+ camera.eventEmitter.on(CameraEvent.UPDATED,function(){_this2.context.renderingContext.renderReasons.add(exports.RenderReason.CAMERA_CHANGED);});// bind camera
8838
8833
  this.context.camera=camera;};_proto.getConfig=function getConfig(){return this.context.config;}/**
8839
8834
  * get the root displayObject in scenegraph
8840
8835
  * @alias this.document.documentElement
@@ -8860,7 +8855,7 @@
8860
8855
  var canvasConfig=this.context.config;canvasConfig.width=width;canvasConfig.height=height;// resize context
8861
8856
  this.getContextService().resize(width,height);// resize camera
8862
8857
  var camera=this.context.camera;var projectionMode=camera.getProjectionMode();camera.setPosition(width/2,height/2,DEFAULT_CAMERA_Z).setFocalPoint(width/2,height/2,0);if(projectionMode===exports.CameraProjectionMode.ORTHOGRAPHIC){camera.setOrthographic(width/-2,width/2,height/2,height/-2,camera.getNear(),camera.getFar());}else {camera.setAspect(width/height);}this.dispatchEvent(new CustomEvent(exports.CanvasEvent.RESIZE,{width:width,height:height}));}// proxy to document.documentElement
8863
- ;_proto.appendChild=function appendChild(child,index){return this.document.documentElement.appendChild(child,index);};_proto.insertBefore=function insertBefore(newChild,refChild){return this.document.documentElement.insertBefore(newChild,refChild);};_proto.removeChild=function removeChild(child){return this.document.documentElement.removeChild(child);};_proto.removeChildren=function removeChildren(){this.document.documentElement.removeChildren();};_proto.render=function render(){this.dispatchEvent(this.beforeRenderEvent);var renderingService=this.getRenderingService();renderingService.render(this.getConfig());this.dispatchEvent(this.afterRenderEvent);};_proto.run=function run(){var _this4=this;var tick=function tick(){_this4.render();_this4.frameId=requestAnimationFrame(tick);};tick();};_proto.initRenderer=/*#__PURE__*/function(){var _initRenderer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(renderer){return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(renderer){_context2.next=2;break;}throw new Error('Renderer is required.');case 2:// reset
8858
+ ;_proto.appendChild=function appendChild(child,index){return this.document.documentElement.appendChild(child,index);};_proto.insertBefore=function insertBefore(newChild,refChild){return this.document.documentElement.insertBefore(newChild,refChild);};_proto.removeChild=function removeChild(child){return this.document.documentElement.removeChild(child);};_proto.removeChildren=function removeChildren(){this.document.documentElement.removeChildren();};_proto.render=function render(){this.dispatchEvent(beforeRenderEvent);var renderingService=this.getRenderingService();renderingService.render(this.getConfig());this.dispatchEvent(afterRenderEvent);};_proto.run=function run(){var _this3=this;var tick=function tick(){_this3.render();_this3.frameId=requestAnimationFrame(tick);};tick();};_proto.initRenderer=/*#__PURE__*/function(){var _initRenderer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(renderer){return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(renderer){_context2.next=2;break;}throw new Error('Renderer is required.');case 2:// reset
8864
8859
  this.inited=false;this.readyPromise=undefined;// FIXME: should re-create here?
8865
8860
  this.context.rBushRoot=new RBush();// reset rendering plugins
8866
8861
  this.context.renderingPlugins=[];this.context.renderingPlugins.push(new EventPlugin(),new PrepareRendererPlugin(),new DirtyCheckPlugin(),new CullingPlugin([new FrustumCullingStrategy()]));//
@@ -8868,21 +8863,55 @@
8868
8863
  this.context.contextService=new this.context.ContextService(_extends({},runtime,this.context));// init rendering service
8869
8864
  this.context.renderingService=new RenderingService(runtime,this.context);// init event service
8870
8865
  this.context.eventService=new EventService(runtime,this.context);this.context.eventService.init();_context2.next=14;return this.context.contextService.init();case 14:_context2.next=16;return this.context.renderingService.init();case 16:this.inited=true;this.getRoot().forEach(function(node){var renderable=node.renderable;if(renderable){renderable.renderBoundsDirty=true;renderable.boundsDirty=true;renderable.dirty=true;}});// keep current scenegraph unchanged, just trigger mounted event
8871
- this.mountChildren(this.getRoot());if(renderer.getConfig().enableAutoRendering){this.run();}case 20:case"end":return _context2.stop();}}},_callee2,this);}));function initRenderer(_x){return _initRenderer.apply(this,arguments);}return initRenderer;}();_proto.loadRendererContainerModule=function loadRendererContainerModule(renderer){var _this5=this;// load other container modules provided by g-canvas/g-svg/g-webgl
8872
- var plugins=renderer.getPlugins();plugins.forEach(function(plugin){plugin.context=_this5.context;plugin.init();});};_proto.setRenderer=/*#__PURE__*/function(){var _setRenderer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(renderer){var canvasConfig,oldRenderer;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:// update canvas' config
8866
+ this.mountChildren(this.getRoot());if(renderer.getConfig().enableAutoRendering){this.run();}case 20:case"end":return _context2.stop();}}},_callee2,this);}));function initRenderer(_x){return _initRenderer.apply(this,arguments);}return initRenderer;}();_proto.loadRendererContainerModule=function loadRendererContainerModule(renderer){var _this4=this;// load other container modules provided by g-canvas/g-svg/g-webgl
8867
+ var plugins=renderer.getPlugins();plugins.forEach(function(plugin){plugin.context=_this4.context;plugin.init();});};_proto.setRenderer=/*#__PURE__*/function(){var _setRenderer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(renderer){var canvasConfig,oldRenderer;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:// update canvas' config
8873
8868
  canvasConfig=this.getConfig();if(!(canvasConfig.renderer===renderer)){_context3.next=3;break;}return _context3.abrupt("return");case 3:oldRenderer=canvasConfig.renderer;canvasConfig.renderer=renderer;// keep all children undestroyed
8874
8869
  this.destroy(false,true);// destroy all plugins, reverse will mutate origin array
8875
- [].concat(oldRenderer===null||oldRenderer===void 0?void 0:oldRenderer.getPlugins()).reverse().forEach(function(plugin){plugin.destroy();});_context3.next=9;return this.initRenderer(renderer);case 9:case"end":return _context3.stop();}}},_callee3,this);}));function setRenderer(_x2){return _setRenderer.apply(this,arguments);}return setRenderer;}();_proto.setCursor=function setCursor(cursor){var canvasConfig=this.getConfig();canvasConfig.cursor=cursor;this.getContextService().applyCursorStyle(cursor);};_proto.unmountChildren=function unmountChildren(parent){var _this6=this;if(this.inited){var path=[];parent.forEach(function(child){if(child.isConnected){path.push(child);}});// unmount from leaf to root
8870
+ [].concat(oldRenderer===null||oldRenderer===void 0?void 0:oldRenderer.getPlugins()).reverse().forEach(function(plugin){plugin.destroy();});_context3.next=9;return this.initRenderer(renderer);case 9:case"end":return _context3.stop();}}},_callee3,this);}));function setRenderer(_x2){return _setRenderer.apply(this,arguments);}return setRenderer;}();_proto.setCursor=function setCursor(cursor){var canvasConfig=this.getConfig();canvasConfig.cursor=cursor;this.getContextService().applyCursorStyle(cursor);};_proto.unmountChildren=function unmountChildren(parent){var _this5=this;if(this.inited){var path=[];parent.forEach(function(child){if(child.isConnected){path.push(child);}});// unmount from leaf to root
8876
8871
  path.reverse().forEach(function(child){// trigger before unmounted
8877
- if(child instanceof CustomElement){if(child.disconnectedCallback){child.disconnectedCallback();}}child.dispatchEvent(_this6.unmountEvent);// skip document.documentElement
8878
- if(child!==_this6.document.documentElement){child.ownerDocument=null;}child.isConnected=false;});}};_proto.mountChildren=function mountChildren(parent){var _this7=this;if(this.inited){parent.forEach(function(child){if(!child.isConnected){child.ownerDocument=_this7.document;child.isConnected=true;child.dispatchEvent(_this7.mountEvent);// trigger after mounted
8879
- if(child instanceof CustomElement){if(child.connectedCallback){child.connectedCallback();}}}});}else {console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.",'appended child: ',parent.nodeName);}};_proto.client2Viewport=function client2Viewport(client){return this.getEventService().client2Viewport(client);};_proto.viewport2Client=function viewport2Client(canvas){return this.getEventService().viewport2Client(canvas);};_proto.viewport2Canvas=function viewport2Canvas(viewport){return this.getEventService().viewport2Canvas(viewport);};_proto.canvas2Viewport=function canvas2Viewport(canvas){return this.getEventService().canvas2Viewport(canvas);}/**
8872
+ if(child.isCustomElement){if(child.disconnectedCallback){child.disconnectedCallback();}}if(child.isMutationObserved){child.dispatchEvent(unmountedEvent);}else {unmountedEvent.target=child;_this5.dispatchEvent(unmountedEvent,true);}// skip document.documentElement
8873
+ if(child!==_this5.document.documentElement){child.ownerDocument=null;}child.isConnected=false;});}};_proto.mountChildren=function mountChildren(parent){var _this6=this;if(this.inited){parent.forEach(function(child){if(!child.isConnected){child.ownerDocument=_this6.document;child.isConnected=true;if(child.isMutationObserved){child.dispatchEvent(mountedEvent);}else {mountedEvent.target=child;_this6.dispatchEvent(mountedEvent,true);}// trigger after mounted
8874
+ if(child.isCustomElement){if(child.connectedCallback){child.connectedCallback();}}}});}else {console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.",'appended child: ',parent.nodeName);}};_proto.client2Viewport=function client2Viewport(client){return this.getEventService().client2Viewport(client);};_proto.viewport2Client=function viewport2Client(canvas){return this.getEventService().viewport2Client(canvas);};_proto.viewport2Canvas=function viewport2Canvas(viewport){return this.getEventService().viewport2Canvas(viewport);};_proto.canvas2Viewport=function canvas2Viewport(canvas){return this.getEventService().canvas2Viewport(canvas);}/**
8880
8875
  * @deprecated
8881
8876
  * @alias client2Viewport
8882
8877
  */;_proto.getPointByClient=function getPointByClient(clientX,clientY){return this.client2Viewport({x:clientX,y:clientY});}/**
8883
8878
  * @deprecated
8884
8879
  * @alias viewport2Client
8885
- */;_proto.getClientByPoint=function getClientByPoint(x,y){return this.viewport2Client({x:x,y:y});};_createClass(Canvas,[{key:"ready",get:function get(){var _this8=this;if(!this.readyPromise){this.readyPromise=new Promise(function(resolve){_this8.resolveReadyPromise=function(){resolve(_this8);};});if(this.inited){this.resolveReadyPromise();}}return this.readyPromise;}}]);return Canvas;}(EventTarget);
8880
+ */;_proto.getClientByPoint=function getClientByPoint(x,y){return this.viewport2Client({x:x,y:y});};_createClass(Canvas,[{key:"ready",get:function get(){var _this7=this;if(!this.readyPromise){this.readyPromise=new Promise(function(resolve){_this7.resolveReadyPromise=function(){resolve(_this7);};});if(this.inited){this.resolveReadyPromise();}}return this.readyPromise;}}]);return Canvas;}(EventTarget);
8881
+
8882
+ var toString$1 = {}.toString;
8883
+ var isType$1 = function (value, type) { return toString$1.call(value) === '[object ' + type + ']'; };
8884
+
8885
+ // isFinite,
8886
+ var isNil$1 = function (value) {
8887
+ /**
8888
+ * isNil(null) => true
8889
+ * isNil() => true
8890
+ */
8891
+ return value === null || value === undefined;
8892
+ };
8893
+
8894
+ var isString$1 = (function (str) {
8895
+ return isType$1(str, 'String');
8896
+ });
8897
+
8898
+ var clamp$1 = function (a, min, max) {
8899
+ if (a < min) {
8900
+ return min;
8901
+ }
8902
+ else if (a > max) {
8903
+ return max;
8904
+ }
8905
+ return a;
8906
+ };
8907
+
8908
+ /**
8909
+ * 判断是否数字
8910
+ * @return {Boolean} 是否数字
8911
+ */
8912
+ var isNumber$1 = function (value) {
8913
+ return isType$1(value, 'Number');
8914
+ };
8886
8915
 
8887
8916
  function _inheritsLoose$1(subClass, superClass) {
8888
8917
  subClass.prototype = Object.create(superClass.prototype);
@@ -9999,12 +10028,12 @@
9999
10028
  options = {};
10000
10029
  }
10001
10030
 
10002
- var landmark = isString(name) ? this.landmarks.find(function (l) {
10031
+ var landmark = isString$1(name) ? this.landmarks.find(function (l) {
10003
10032
  return l.name === name;
10004
10033
  }) : name;
10005
10034
 
10006
10035
  if (landmark) {
10007
- var _ref = isNumber(options) ? {
10036
+ var _ref = isNumber$1(options) ? {
10008
10037
  duration: options
10009
10038
  } : options,
10010
10039
  _ref$easing = _ref.easing,
@@ -10133,94 +10162,6 @@
10133
10162
 
10134
10163
  runtime.CameraContribution = AdvancedCamera;
10135
10164
 
10136
- DisplayObject.prototype.getCount = function () {
10137
- return this.childElementCount;
10138
- }; // @ts-ignore
10139
-
10140
-
10141
- DisplayObject.prototype.getParent = function () {
10142
- return this.parentElement;
10143
- }; // @ts-ignore
10144
-
10145
-
10146
- DisplayObject.prototype.getChildren = function () {
10147
- return this.children;
10148
- }; // @ts-ignore
10149
-
10150
-
10151
- DisplayObject.prototype.getFirst = function () {
10152
- return this.firstElementChild;
10153
- }; // @ts-ignore
10154
-
10155
-
10156
- DisplayObject.prototype.getLast = function () {
10157
- return this.lastElementChild;
10158
- }; // @ts-ignore
10159
-
10160
-
10161
- DisplayObject.prototype.getChildByIndex = function (index) {
10162
- return this.children[index] || null;
10163
- }; // @ts-ignore
10164
-
10165
-
10166
- DisplayObject.prototype.add = function (child, index) {
10167
- return this.appendChild(child, index);
10168
- }; // @ts-ignore
10169
-
10170
-
10171
- DisplayObject.prototype.setClip = function (clipPath) {
10172
- this.style.clipPath = clipPath;
10173
- }; // @ts-ignore
10174
-
10175
-
10176
- DisplayObject.prototype.getClip = function () {
10177
- return this.style.clipPath || null;
10178
- }; // @ts-ignore
10179
-
10180
-
10181
- DisplayObject.prototype.set = function (name, value) {
10182
- this.config[name] = value;
10183
- }; // @ts-ignore
10184
-
10185
-
10186
- DisplayObject.prototype.get = function (name) {
10187
- return this.config[name];
10188
- }; // @ts-ignore
10189
-
10190
-
10191
- DisplayObject.prototype.moveTo = function (position, y, z) {
10192
- if (y === void 0) {
10193
- y = 0;
10194
- }
10195
-
10196
- if (z === void 0) {
10197
- z = 0;
10198
- }
10199
-
10200
- this.setPosition(position, y, z);
10201
- return this;
10202
- }; // @ts-ignore
10203
-
10204
-
10205
- DisplayObject.prototype.move = function (position, y, z) {
10206
- if (y === void 0) {
10207
- y = 0;
10208
- }
10209
-
10210
- if (z === void 0) {
10211
- z = 0;
10212
- }
10213
-
10214
- this.setPosition(position, y, z);
10215
- return this;
10216
- }; // @ts-ignore
10217
-
10218
-
10219
- DisplayObject.prototype.setZIndex = function (zIndex) {
10220
- this.style.zIndex = zIndex;
10221
- return this;
10222
- };
10223
-
10224
10165
  // export const ContextNode = Syringe.defineToken('');
10225
10166
  var FragmentResult = function FragmentResult(_layoutContext, _node, options) {
10226
10167
  this._layoutContext = void 0;
@@ -12801,8 +12742,8 @@
12801
12742
  amplitude = _params$ === void 0 ? 1 : _params$,
12802
12743
  _params$2 = _params[1],
12803
12744
  period = _params$2 === void 0 ? 0.5 : _params$2;
12804
- var a = clamp(Number(amplitude), 1, 10);
12805
- var p = clamp(Number(period), 0.1, 2);
12745
+ var a = clamp$1(Number(amplitude), 1, 10);
12746
+ var p = clamp$1(Number(period), 0.1, 2);
12806
12747
  if (t === 0 || t === 1) return t;
12807
12748
  return -a * Math.pow(2, 10 * (t - 1)) * Math.sin((t - 1 - p / (Math.PI * 2) * Math.asin(1 / a)) * (Math.PI * 2) / p);
12808
12749
  };
@@ -12821,10 +12762,10 @@
12821
12762
  damping = _params2$3 === void 0 ? 10 : _params2$3,
12822
12763
  _params2$4 = _params2[3],
12823
12764
  velocity = _params2$4 === void 0 ? 0 : _params2$4;
12824
- mass = clamp(mass, 0.1, 1000);
12825
- stiffness = clamp(stiffness, 0.1, 1000);
12826
- damping = clamp(damping, 0.1, 1000);
12827
- velocity = clamp(velocity, 0.1, 1000);
12765
+ mass = clamp$1(mass, 0.1, 1000);
12766
+ stiffness = clamp$1(stiffness, 0.1, 1000);
12767
+ damping = clamp$1(damping, 0.1, 1000);
12768
+ velocity = clamp$1(velocity, 0.1, 1000);
12828
12769
  var w0 = Math.sqrt(stiffness / mass);
12829
12770
  var zeta = damping / (2 * Math.sqrt(stiffness * mass));
12830
12771
  var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
@@ -12909,7 +12850,7 @@
12909
12850
  steps = _params3$ === void 0 ? 10 : _params3$,
12910
12851
  type = _params3[1];
12911
12852
  var trunc = type == 'start' ? Math.ceil : Math.floor;
12912
- return trunc(clamp(t, 0, 1) * steps) / steps;
12853
+ return trunc(clamp$1(t, 0, 1) * steps) / steps;
12913
12854
  }; // @ts-ignore
12914
12855
 
12915
12856
 
@@ -13618,7 +13559,7 @@
13618
13559
  for (var i = 0; i < keyframes.length; i++) {
13619
13560
  var offset = keyframes[i].offset;
13620
13561
 
13621
- if (!isNil(offset)) {
13562
+ if (!isNil$1(offset)) {
13622
13563
  if (offset < previousOffset) {
13623
13564
  throw new TypeError('Keyframes are not loosely sorted by offset. Sort or specify offsets.');
13624
13565
  }
@@ -13651,7 +13592,7 @@
13651
13592
  for (var _i = 1; _i < length; _i++) {
13652
13593
  var _offset = keyframes[_i].computedOffset;
13653
13594
 
13654
- if (!isNil(_offset) && !isNil(previousOffset)) {
13595
+ if (!isNil$1(_offset) && !isNil$1(previousOffset)) {
13655
13596
  for (var j = 1; j < _i - previousIndex; j++) {
13656
13597
  keyframes[previousIndex + j].computedOffset = previousOffset + (Number(_offset) - previousOffset) * j / (_i - previousIndex);
13657
13598
  }