@antv/g 5.15.14 → 5.15.15
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 +200 -279
- package/dist/index.umd.min.js +1 -1
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -2794,36 +2794,6 @@
|
|
|
2794
2794
|
out[2] = a[2] * b[2];
|
|
2795
2795
|
return out;
|
|
2796
2796
|
}
|
|
2797
|
-
/**
|
|
2798
|
-
* Returns the minimum of two vec3's
|
|
2799
|
-
*
|
|
2800
|
-
* @param {vec3} out the receiving vector
|
|
2801
|
-
* @param {ReadonlyVec3} a the first operand
|
|
2802
|
-
* @param {ReadonlyVec3} b the second operand
|
|
2803
|
-
* @returns {vec3} out
|
|
2804
|
-
*/
|
|
2805
|
-
|
|
2806
|
-
function min(out, a, b) {
|
|
2807
|
-
out[0] = Math.min(a[0], b[0]);
|
|
2808
|
-
out[1] = Math.min(a[1], b[1]);
|
|
2809
|
-
out[2] = Math.min(a[2], b[2]);
|
|
2810
|
-
return out;
|
|
2811
|
-
}
|
|
2812
|
-
/**
|
|
2813
|
-
* Returns the maximum of two vec3's
|
|
2814
|
-
*
|
|
2815
|
-
* @param {vec3} out the receiving vector
|
|
2816
|
-
* @param {ReadonlyVec3} a the first operand
|
|
2817
|
-
* @param {ReadonlyVec3} b the second operand
|
|
2818
|
-
* @returns {vec3} out
|
|
2819
|
-
*/
|
|
2820
|
-
|
|
2821
|
-
function max(out, a, b) {
|
|
2822
|
-
out[0] = Math.max(a[0], b[0]);
|
|
2823
|
-
out[1] = Math.max(a[1], b[1]);
|
|
2824
|
-
out[2] = Math.max(a[2], b[2]);
|
|
2825
|
-
return out;
|
|
2826
|
-
}
|
|
2827
2797
|
/**
|
|
2828
2798
|
* Scales a vec3 by a scalar number
|
|
2829
2799
|
*
|
|
@@ -3027,12 +2997,6 @@
|
|
|
3027
2997
|
b2 = b[2];
|
|
3028
2998
|
return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));
|
|
3029
2999
|
}
|
|
3030
|
-
/**
|
|
3031
|
-
* Alias for {@link vec3.subtract}
|
|
3032
|
-
* @function
|
|
3033
|
-
*/
|
|
3034
|
-
|
|
3035
|
-
var sub$1 = subtract$1;
|
|
3036
3000
|
/**
|
|
3037
3001
|
* Alias for {@link vec3.distance}
|
|
3038
3002
|
* @function
|
|
@@ -5353,7 +5317,7 @@
|
|
|
5353
5317
|
* // => 1250010
|
|
5354
5318
|
* // Math.max(...data) will encounter "Maximum call stack size exceeded" error
|
|
5355
5319
|
*/
|
|
5356
|
-
var max
|
|
5320
|
+
var max = (function (arr) {
|
|
5357
5321
|
if (!isArray(arr)) {
|
|
5358
5322
|
return undefined;
|
|
5359
5323
|
}
|
|
@@ -5379,7 +5343,7 @@
|
|
|
5379
5343
|
* // => 1250010
|
|
5380
5344
|
* // Math.min(...data) will encounter "Maximum call stack size exceeded" error
|
|
5381
5345
|
*/
|
|
5382
|
-
var min
|
|
5346
|
+
var min = (function (arr) {
|
|
5383
5347
|
if (!isArray(arr)) {
|
|
5384
5348
|
return undefined;
|
|
5385
5349
|
}
|
|
@@ -7071,29 +7035,7 @@
|
|
|
7071
7035
|
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#list-of-ts
|
|
7072
7036
|
*/PropertySyntax["LIST_OF_POINTS"]="<list-of-points>";PropertySyntax["PATH"]="<path>";/**
|
|
7073
7037
|
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/filter#formal_syntax
|
|
7074
|
-
*/PropertySyntax["FILTER"]="<filter>";PropertySyntax["Z_INDEX"]="<z-index>";PropertySyntax["OFFSET_DISTANCE"]="<offset-distance>";PropertySyntax["DEFINED_PATH"]="<defined-path>";PropertySyntax["MARKER"]="<marker>";PropertySyntax["TRANSFORM"]="<transform>";PropertySyntax["TRANSFORM_ORIGIN"]="<transform-origin>";PropertySyntax["TEXT"]="<text>";PropertySyntax["TEXT_TRANSFORM"]="<text-transform>";})(exports.PropertySyntax||(exports.PropertySyntax={}))
|
|
7075
|
-
* Axis-Aligned Bounding Box
|
|
7076
|
-
* 为了便于后续 Frustum Culling,通过查找表定义 p-vertex 和 n-vertex
|
|
7077
|
-
* @see https://github.com/antvis/GWebGPUEngine/issues/3
|
|
7078
|
-
*/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]);}/**
|
|
7079
|
-
* get n-vertex
|
|
7080
|
-
* @param plane plane of CullingVolume
|
|
7081
|
-
*/;_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]);}}/**
|
|
7082
|
-
* get p-vertex
|
|
7083
|
-
* @param plane plane of CullingVolume
|
|
7084
|
-
*/;_proto.getPositiveFarPoint=function getPositiveFarPoint(plane){if(plane.pnVertexFlag===0x111){return copy$1(create$2(),this.max);}else if(plane.pnVertexFlag===0x110){return fromValues$2(this.max[0],this.max[1],this.min[2]);}else if(plane.pnVertexFlag===0x101){return fromValues$2(this.max[0],this.min[1],this.max[2]);}else if(plane.pnVertexFlag===0x100){return fromValues$2(this.max[0],this.min[1],this.min[2]);}else if(plane.pnVertexFlag===0x011){return fromValues$2(this.min[0],this.max[1],this.max[2]);}else if(plane.pnVertexFlag===0x010){return fromValues$2(this.min[0],this.max[1],this.min[2]);}else if(plane.pnVertexFlag===0x001){return fromValues$2(this.min[0],this.min[1],this.max[2]);}else {return fromValues$2(this.min[0],this.min[1],this.min[2]);}};return AABB;}();var Plane=/*#__PURE__*/function(){/**
|
|
7085
|
-
* lookup table for p-vertex & n-vertex when doing frustum culling
|
|
7086
|
-
*/function Plane(distance,normal){this.distance=void 0;this.normal=void 0;this.pnVertexFlag=void 0;this.distance=distance||0;this.normal=normal||fromValues$2(0,1,0);this.updatePNVertexFlag();}var _proto=Plane.prototype;_proto.updatePNVertexFlag=function updatePNVertexFlag(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0);};_proto.distanceToPoint=function distanceToPoint(point){return dot(point,this.normal)-this.distance;};_proto.normalize=function normalize(){var invLen=1/len(this.normal);scale$1(this.normal,this.normal,invLen);this.distance*=invLen;};_proto.intersectsLine=function intersectsLine(start,end,point){var d0=this.distanceToPoint(start);var d1=this.distanceToPoint(end);var t=d0/(d0-d1);var intersects=t>=0&&t<=1;if(intersects&&point){lerp(point,start,end,t);}return intersects;};return Plane;}();(function(Mask){Mask[Mask["OUTSIDE"]=4294967295]="OUTSIDE";Mask[Mask["INSIDE"]=0]="INSIDE";Mask[Mask["INDETERMINATE"]=2147483647]="INDETERMINATE";})(exports.Mask||(exports.Mask={}));var Frustum=/*#__PURE__*/function(){function Frustum(planes){this.planes=[];if(planes){this.planes=planes;}else {for(var i=0;i<6;i++){this.planes.push(new Plane());}}}/**
|
|
7087
|
-
* extract 6 planes from projectionMatrix
|
|
7088
|
-
* @see http://www8.cs.umu.se/kurser/5DV051/HT12/lab/plane_extraction.pdf
|
|
7089
|
-
*/var _proto=Frustum.prototype;_proto.extractFromVPMatrix=function extractFromVPMatrix(projectionMatrix){// @ts-ignore
|
|
7090
|
-
var m0=projectionMatrix[0],m1=projectionMatrix[1],m2=projectionMatrix[2],m3=projectionMatrix[3],m4=projectionMatrix[4],m5=projectionMatrix[5],m6=projectionMatrix[6],m7=projectionMatrix[7],m8=projectionMatrix[8],m9=projectionMatrix[9],m10=projectionMatrix[10],m11=projectionMatrix[11],m12=projectionMatrix[12],m13=projectionMatrix[13],m14=projectionMatrix[14],m15=projectionMatrix[15];// right
|
|
7091
|
-
set$1(this.planes[0].normal,m3-m0,m7-m4,m11-m8);this.planes[0].distance=m15-m12;// left
|
|
7092
|
-
set$1(this.planes[1].normal,m3+m0,m7+m4,m11+m8);this.planes[1].distance=m15+m12;// bottom
|
|
7093
|
-
set$1(this.planes[2].normal,m3+m1,m7+m5,m11+m9);this.planes[2].distance=m15+m13;// top
|
|
7094
|
-
set$1(this.planes[3].normal,m3-m1,m7-m5,m11-m9);this.planes[3].distance=m15-m13;// far
|
|
7095
|
-
set$1(this.planes[4].normal,m3-m2,m7-m6,m11-m10);this.planes[4].distance=m15-m14;// near
|
|
7096
|
-
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={}));function memoize(func,resolver){if(typeof func!=='function'||resolver!=null&&typeof resolver!=='function'){throw new TypeError('Expected a function');}var memoized=function memoized(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var key=resolver?resolver.apply(this,args):args[0];var cache=memoized.cache;if(cache.has(key)){return cache.get(key);}var result=func.apply(this,args);memoized.cache=cache.set(key,result)||cache;return result;};memoized.cache=new(memoize.Cache||Map)();return memoized;}memoize.Cache=Map;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(func){return typeof func==='function';}function isSymbol(value){// @see https://github.com/lodash/lodash/blob/master/isSymbol.js
|
|
7038
|
+
*/PropertySyntax["FILTER"]="<filter>";PropertySyntax["Z_INDEX"]="<z-index>";PropertySyntax["OFFSET_DISTANCE"]="<offset-distance>";PropertySyntax["DEFINED_PATH"]="<defined-path>";PropertySyntax["MARKER"]="<marker>";PropertySyntax["TRANSFORM"]="<transform>";PropertySyntax["TRANSFORM_ORIGIN"]="<transform-origin>";PropertySyntax["TEXT"]="<text>";PropertySyntax["TEXT_TRANSFORM"]="<text-transform>";})(exports.PropertySyntax||(exports.PropertySyntax={}));function memoize(func,resolver){if(typeof func!=='function'||resolver!=null&&typeof resolver!=='function'){throw new TypeError('Expected a function');}var memoized=function memoized(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var key=resolver?resolver.apply(this,args):args[0];var cache=memoized.cache;if(cache.has(key)){return cache.get(key);}var result=func.apply(this,args);memoized.cache=cache.set(key,result)||cache;return result;};memoized.cache=new(memoize.Cache||Map)();return memoized;}memoize.Cache=Map;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 isFunction(func){return typeof func==='function';}function isSymbol(value){// @see https://github.com/lodash/lodash/blob/master/isSymbol.js
|
|
7097
7039
|
return typeof value==='symbol';}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;/**
|
|
7098
7040
|
* destroy existed canvas with the same id
|
|
7099
7041
|
*/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;
|
|
@@ -7483,127 +7425,38 @@
|
|
|
7483
7425
|
* eg. 'initial'
|
|
7484
7426
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSKeywordValue
|
|
7485
7427
|
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_keyword_value.idl
|
|
7486
|
-
*/var CSSKeywordValue=/*#__PURE__*/function(_CSSStyleValue){_inheritsLoose(CSSKeywordValue,_CSSStyleValue);function CSSKeywordValue(value){var _this;_this=_CSSStyleValue.call(this)||this;_this.value=void 0;_this.value=value;return _this;}var _proto=CSSKeywordValue.prototype;_proto.clone=function clone(){return new CSSKeywordValue(this.value);};_proto.getType=function getType(){return CSSStyleValueType.kKeywordType;};_proto.buildCSSText=function buildCSSText(n,p,result){return result+this.value;};return CSSKeywordValue;}(CSSStyleValue)
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
//
|
|
7490
|
-
//
|
|
7491
|
-
//
|
|
7492
|
-
//
|
|
7493
|
-
//
|
|
7494
|
-
//
|
|
7495
|
-
//
|
|
7496
|
-
//
|
|
7497
|
-
//
|
|
7498
|
-
//
|
|
7499
|
-
//
|
|
7500
|
-
//
|
|
7501
|
-
//
|
|
7502
|
-
//
|
|
7503
|
-
//
|
|
7504
|
-
//
|
|
7505
|
-
|
|
7506
|
-
// case UnitType.kSmallViewportMax:
|
|
7507
|
-
// case UnitType.kLargeViewportWidth:
|
|
7508
|
-
// case UnitType.kLargeViewportHeight:
|
|
7509
|
-
// case UnitType.kLargeViewportInlineSize:
|
|
7510
|
-
// case UnitType.kLargeViewportBlockSize:
|
|
7511
|
-
// case UnitType.kLargeViewportMin:
|
|
7512
|
-
// case UnitType.kLargeViewportMax:
|
|
7513
|
-
// case UnitType.kDynamicViewportWidth:
|
|
7514
|
-
// case UnitType.kDynamicViewportHeight:
|
|
7515
|
-
// case UnitType.kDynamicViewportInlineSize:
|
|
7516
|
-
// case UnitType.kDynamicViewportBlockSize:
|
|
7517
|
-
// case UnitType.kDynamicViewportMin:
|
|
7518
|
-
// case UnitType.kDynamicViewportMax:
|
|
7519
|
-
// case UnitType.kContainerWidth:
|
|
7520
|
-
// case UnitType.kContainerHeight:
|
|
7521
|
-
// case UnitType.kContainerInlineSize:
|
|
7522
|
-
// case UnitType.kContainerBlockSize:
|
|
7523
|
-
// case UnitType.kContainerMin:
|
|
7524
|
-
// case UnitType.kContainerMax:
|
|
7525
|
-
case exports.UnitType.kRems:// case UnitType.kChs:
|
|
7526
|
-
return BaseType.kLength;case exports.UnitType.kMilliseconds:case exports.UnitType.kSeconds:return BaseType.kTime;case exports.UnitType.kDegrees:case exports.UnitType.kRadians:case exports.UnitType.kGradians:case exports.UnitType.kTurns:return BaseType.kAngle;// case UnitType.kHertz:
|
|
7527
|
-
// case UnitType.kKilohertz:
|
|
7528
|
-
// return BaseType.kFrequency;
|
|
7529
|
-
// case UnitType.kDotsPerPixel:
|
|
7530
|
-
// case UnitType.kDotsPerInch:
|
|
7531
|
-
// case UnitType.kDotsPerCentimeter:
|
|
7532
|
-
// return BaseType.kResolution;
|
|
7533
|
-
// case UnitType.kFraction:
|
|
7534
|
-
// return BaseType.kFlex;
|
|
7535
|
-
case exports.UnitType.kPercentage:return BaseType.kPercent;default:return BaseType.kLength;}}function baseTypeToString(baseType){switch(baseType){case BaseType.kLength:return 'length';case BaseType.kAngle:return 'angle';case BaseType.kTime:return 'time';case BaseType.kFrequency:return 'frequency';case BaseType.kResolution:return 'resolution';case BaseType.kFlex:return 'flex';case BaseType.kPercent:return 'percent';}return '';}var CSSNumericValueType=/*#__PURE__*/function(){function CSSNumericValueType(unit,exponent){if(unit===void 0){unit=exports.UnitType.kNumber;}if(exponent===void 0){exponent=1;}this.exponents=[];this.numNonZeroEntries=0;this.percentHint=BaseType.kPercent;this.hasPercentHint=false;this.exponents=new Array(BaseType.kNumBaseTypes).fill(0);if(unit!==exports.UnitType.kNumber){this.setExponent(unitTypeToBaseType(unit),exponent);}}var _proto=CSSNumericValueType.prototype;_proto.applyPercentHint=function applyPercentHint(hint){DCHECK_NE(hint,BaseType.kPercent);this.setExponent(hint,this.exponent(hint)+this.exponent(BaseType.kPercent));this.setExponent(BaseType.kPercent,0);this.percentHint=hint;this.hasPercentHint=true;};_proto.hasNonZeroEntries=function hasNonZeroEntries(){return this.numNonZeroEntries>0;};_proto.isOnlyNonZeroEntry=function isOnlyNonZeroEntry(baseType,value){DCHECK_NE(value,0);return this.numNonZeroEntries===1&&this.exponent(baseType)===value;};_proto.exponent=function exponent(type){return this.exponents[type];};_proto.setExponent=function setExponent(type,newValue){var oldValue=this.exponents[type];if(oldValue==0&&newValue!==0){this.numNonZeroEntries++;}else if(oldValue!==0&&newValue==0){this.numNonZeroEntries--;}this.exponents[type]=newValue;};CSSNumericValueType.negateExponents=function negateExponents(type){type.exponents.forEach(function(v){return v*=-1;});return type;};_proto.matchesBaseType=function matchesBaseType(baseType){DCHECK_NE(baseType,BaseType.kPercent);return this.isOnlyNonZeroEntry(baseType,1)&&!this.hasPercentHint;};_proto.matchesPercentage=function matchesPercentage(){return this.isOnlyNonZeroEntry(BaseType.kPercent,1);};_proto.matchesBaseTypePercentage=function matchesBaseTypePercentage(baseType){DCHECK_NE(baseType,BaseType.kPercent);return this.isOnlyNonZeroEntry(baseType,1)||this.isOnlyNonZeroEntry(BaseType.kPercent,1);};_proto.matchesNumber=function matchesNumber(){return !this.hasNonZeroEntries()&&!this.hasPercentHint;};_proto.matchesNumberPercentage=function matchesNumberPercentage(){return !this.hasNonZeroEntries()||this.isOnlyNonZeroEntry(BaseType.kPercent,1);};CSSNumericValueType.add=function add(type1,type2,error){if(type1.hasPercentHint&&type2.hasPercentHint&&type1.percentHint!=type2.percentHint){return type1;}if(type1.hasPercentHint)type2.applyPercentHint(type1.percentHint);else if(type2.hasPercentHint)type1.applyPercentHint(type2.percentHint);DCHECK_EQ(type1.percentHint,type2.percentHint);// Match up base types. Try to use the percent hint to match up any
|
|
7536
|
-
// differences.
|
|
7537
|
-
for(var i=0;i<BaseType.kNumBaseTypes;++i){var base_type=i;if(type1.exponents[i]!==type2.exponents[i]){if(base_type!==BaseType.kPercent){type1.applyPercentHint(base_type);type2.applyPercentHint(base_type);}if(type1.exponents[i]!==type2.exponents[i]){return type1;}}}return type1;};CSSNumericValueType.multiply=function multiply(type1,type2,error){if(type1.hasPercentHint&&type2.hasPercentHint&&type1.percentHint!=type2.percentHint){return type1;}if(type1.hasPercentHint)type2.applyPercentHint(type1.percentHint);else if(type2.hasPercentHint)type1.applyPercentHint(type2.percentHint);for(var i=0;i<BaseType.kNumBaseTypes;++i){var base_type=i;type1.setExponent(base_type,type1.exponent(base_type)+type2.exponent(base_type));}return type1;};return CSSNumericValueType;}();var fromNumberish=function fromNumberish(value){if(typeof value==='number'){return new CSSUnitValue(value,exports.UnitType.kNumber);}return value;};/**
|
|
7428
|
+
*/var CSSKeywordValue=/*#__PURE__*/function(_CSSStyleValue){_inheritsLoose(CSSKeywordValue,_CSSStyleValue);function CSSKeywordValue(value){var _this;_this=_CSSStyleValue.call(this)||this;_this.value=void 0;_this.value=value;return _this;}var _proto=CSSKeywordValue.prototype;_proto.clone=function clone(){return new CSSKeywordValue(this.value);};_proto.getType=function getType(){return CSSStyleValueType.kKeywordType;};_proto.buildCSSText=function buildCSSText(n,p,result){return result+this.value;};return CSSKeywordValue;}(CSSStyleValue);// type CSSNumericBaseType =
|
|
7429
|
+
// | 'length'
|
|
7430
|
+
// | 'angle'
|
|
7431
|
+
// | 'time'
|
|
7432
|
+
// | 'frequency'
|
|
7433
|
+
// | 'resolution'
|
|
7434
|
+
// | 'flex'
|
|
7435
|
+
// | 'percent';
|
|
7436
|
+
// https://drafts.css-houdini.org/css-typed-om/#dictdef-cssnumerictype
|
|
7437
|
+
// interface CSSNumericType {
|
|
7438
|
+
// length: number;
|
|
7439
|
+
// angle: number;
|
|
7440
|
+
// time: number;
|
|
7441
|
+
// frequency: number;
|
|
7442
|
+
// resolution: number;
|
|
7443
|
+
// flex: number;
|
|
7444
|
+
// percent: number;
|
|
7445
|
+
// percentHint: CSSNumericBaseType;
|
|
7446
|
+
// }
|
|
7447
|
+
var formatInfinityOrNaN=function formatInfinityOrNaN(number,suffix){if(suffix===void 0){suffix='';}var result='';if(!Number.isFinite(number)){if(number>0)result='infinity';else result='-infinity';}else {DCHECK(Number.isNaN(number));result='NaN';}return result+=suffix;};var toCanonicalUnit=function toCanonicalUnit(unit){return canonicalUnitTypeForCategory(unitTypeToUnitCategory(unit));};/**
|
|
7538
7448
|
* CSSNumericValue is the base class for numeric and length typed CSS Values.
|
|
7539
7449
|
* @see https://drafts.css-houdini.org/css-typed-om/#numeric-objects
|
|
7540
7450
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue
|
|
7541
7451
|
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_numeric_value.idl
|
|
7542
|
-
*/
|
|
7543
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_numeric_value.cc#296
|
|
7544
|
-
*/ // static fromPercentish(value: CSSNumberish): CSSNumericValue {
|
|
7545
|
-
// if (typeof value === 'number') {
|
|
7546
|
-
// return new CSSUnitValue(value * 100, UnitType.kPercentage);
|
|
7547
|
-
// }
|
|
7548
|
-
// return value;
|
|
7549
|
-
// }
|
|
7550
|
-
function CSSNumericValue(type_){var _this;_this=_CSSStyleValue.call(this)||this;_this.type_=void 0;_this.type_=type_;return _this;}var _proto2=CSSNumericValue.prototype;_proto2.getType=function getType(){return CSSStyleValueType.kUnknownType;}// toCSSValue() {
|
|
7551
|
-
// return null;
|
|
7552
|
-
// }
|
|
7553
|
-
/**
|
|
7554
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue/equals
|
|
7555
|
-
*/;_proto2.equals=function equals(){var _this2=this;for(var _len=arguments.length,numberishes=new Array(_len),_key=0;_key<_len;_key++){numberishes[_key]=arguments[_key];}var values=cssNumberishesToNumericValues(numberishes);return values.every(function(value){return _this2.equals(value);});}/**
|
|
7556
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_numeric_value.cc#439
|
|
7557
|
-
*/;_proto2.add=function add(){for(var _len2=arguments.length,numberishes=new Array(_len2),_key2=0;_key2<_len2;_key2++){numberishes[_key2]=arguments[_key2];}var values=cssNumberishesToNumericValues(numberishes);prependValueForArithmetic(CSSStyleValueType.kSumType,values,this);// eg. 1px + 2px = 3px
|
|
7558
|
-
var unitValue=maybeSimplifyAsUnitValue(values,CSSMathOperator.kAdd);if(unitValue){return unitValue;}return CSSMathSum.create(values);}/**
|
|
7559
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_numeric_value.cc#452
|
|
7560
|
-
*/;_proto2.sub=function sub(){for(var _len3=arguments.length,numberishes=new Array(_len3),_key3=0;_key3<_len3;_key3++){numberishes[_key3]=arguments[_key3];}var values=cssNumberishesToNumericValues(numberishes);values=values.map(function(value){return value.negate();});prependValueForArithmetic(CSSStyleValueType.kSumType,values,this);// eg. 3px - 2px = 1px
|
|
7561
|
-
var unitValue=maybeSimplifyAsUnitValue(values,CSSMathOperator.kAdd);if(unitValue){return unitValue;}return CSSMathSum.create(values);}/**
|
|
7562
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue/mul
|
|
7563
|
-
*/;_proto2.mul=function mul(){for(var _len4=arguments.length,numberishes=new Array(_len4),_key4=0;_key4<_len4;_key4++){numberishes[_key4]=arguments[_key4];}var values=cssNumberishesToNumericValues(numberishes);prependValueForArithmetic(CSSStyleValueType.kProductType,values,this);var unitValue=maybeMultiplyAsUnitValue(values);if(unitValue){return unitValue;}return CSSMathProduct.create(values);}/**
|
|
7564
|
-
* eg. calc(24px / 4%)
|
|
7565
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue/div
|
|
7566
|
-
*/;_proto2.div=function div(){for(var _len5=arguments.length,numberishes=new Array(_len5),_key5=0;_key5<_len5;_key5++){numberishes[_key5]=arguments[_key5];}var values=cssNumberishesToNumericValues(numberishes);values=values.map(function(value){return value.invert();});prependValueForArithmetic(CSSStyleValueType.kProductType,values,this);var unitValue=maybeMultiplyAsUnitValue(values);if(unitValue){return unitValue;}return CSSMathProduct.create(values);};_proto2.min=function min(){for(var _len6=arguments.length,numberishes=new Array(_len6),_key6=0;_key6<_len6;_key6++){numberishes[_key6]=arguments[_key6];}var values=cssNumberishesToNumericValues(numberishes);prependValueForArithmetic(CSSStyleValueType.kMinType,values,this);var unitValue=maybeSimplifyAsUnitValue(values,CSSMathOperator.kMin);if(unitValue){return unitValue;}return CSSMathMin.create(values);};_proto2.max=function max(){for(var _len7=arguments.length,numberishes=new Array(_len7),_key7=0;_key7<_len7;_key7++){numberishes[_key7]=arguments[_key7];}var values=cssNumberishesToNumericValues(numberishes);prependValueForArithmetic(CSSStyleValueType.kMaxType,values,this);var unitValue=maybeSimplifyAsUnitValue(values,CSSMathOperator.kMax);if(unitValue){return unitValue;}return CSSMathMax.create(values);}/**
|
|
7567
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue/to
|
|
7568
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_numeric_value.cc#331
|
|
7569
|
-
*/;_proto2.to=function to(unitOrName){var sum=this.sumValue();if(sum.length===0||sum.length!==1)return null;var value=cssNumericSumValueEntryToUnitValue(sum[0]);if(!value)return null;var unit;if(typeof unitOrName==='string'){unit=unitFromName(unitOrName);}else {unit=unitOrName;}return value.convertTo(unit);}/**
|
|
7570
|
-
* converts the object's value to a CSSMathSum object to values of the specified unit.
|
|
7571
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue/toSum
|
|
7572
|
-
*/;_proto2.toSum=function toSum(){for(var _len8=arguments.length,unit_strings=new Array(_len8),_key8=0;_key8<_len8;_key8++){unit_strings[_key8]=arguments[_key8];}for(var _i=0,_unit_strings=unit_strings;_i<_unit_strings.length;_i++){var unit_string=_unit_strings[_i];if(!CSSNumericValue.isValidUnit(unitFromName(unit_string))){return null;}}var sum=this.sumValue();if(!sum.length){return null;}var values=[];for(var _iterator=_createForOfIteratorHelperLoose(sum),_step;!(_step=_iterator()).done;){var term=_step.value;var value=cssNumericSumValueEntryToUnitValue(term);if(!value){return null;}values.push(value);}if(unit_strings.length===0){values.sort(function(a,b){return a.unit-b.unit;});// We got 'values' from a sum value, so it must be a valid CSSMathSum.
|
|
7573
|
-
var _result=CSSMathSum.create(values);DCHECK(!!_result);return _result;}var result=[];var _loop=function _loop(){var unit_string=_unit_strings2[_i2];var target_unit=unitFromName(unit_string);DCHECK(CSSNumericValue.isValidUnit(target_unit));// Collect all the terms that are compatible with this unit.
|
|
7574
|
-
// We mark used terms as null so we don't use them again.
|
|
7575
|
-
var total_value=values.reduce(function(cur_sum,value,i){if(value){var unit_value=value;var converted_value=unit_value.convertTo(target_unit);if(converted_value){cur_sum+=converted_value.value;values[i]=null;}}return cur_sum;},0);result.push(new CSSUnitValue(total_value,target_unit));};for(var _i2=0,_unit_strings2=unit_strings;_i2<_unit_strings2.length;_i2++){_loop();}if(values.some(function(v){return !!v;})){throw new Error('There were leftover terms that were not converted');}return CSSMathSum.create(result);}/**
|
|
7576
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSNumericValue/type
|
|
7577
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_numeric_value.cc#414
|
|
7578
|
-
*/;_proto2.type=function type(){var type={length:0,angle:0,time:0,frequency:0,resolution:0,flex:0,percent:0,percentHint:'length'};var exponent=this.type_.exponent(BaseType.kLength);if(exponent){type.length=exponent;}exponent=this.type_.exponent(BaseType.kAngle);if(exponent){type.angle=exponent;}exponent=this.type_.exponent(BaseType.kTime);if(exponent){type.time=exponent;}exponent=this.type_.exponent(BaseType.kFrequency);if(exponent){type.frequency=exponent;}exponent=this.type_.exponent(BaseType.kResolution);if(exponent){type.resolution=exponent;}exponent=this.type_.exponent(BaseType.kFlex);if(exponent){type.flex=exponent;}exponent=this.type_.exponent(BaseType.kPercent);if(exponent){type.percent=exponent;}if(this.type_.hasPercentHint){type.percentHint=baseTypeToString(this.type_.percentHint);}return type;};CSSNumericValue.isValidUnit=function isValidUnit(unit){// if (unit === UnitType.kUserUnits) return false;
|
|
7579
|
-
if(unit===exports.UnitType.kNumber||unit==exports.UnitType.kPercentage||this.isLength(unit)||this.isAngle(unit)||this.isTime(unit)// this.isFrequency(unit) ||
|
|
7580
|
-
// this.isResolution(unit) ||
|
|
7581
|
-
// this.isFlex(unit)
|
|
7582
|
-
)return true;return false;};_proto2.negate=function negate(){return CSSMathNegate.create(this);};_proto2.invert=function invert(){return CSSMathInvert.create(this);};return CSSNumericValue;}(CSSStyleValue);function cssNumberishesToNumericValues(values){return values.map(fromNumberish);}function prependValueForArithmetic(type,values,value){DCHECK(!!value);if(value.getType()===type){values.unshift.apply(values,value.numericValues());}else {values.unshift(value);}}function cssNumericSumValueEntryToUnitValue(term){if(Object.keys(term.units).length===0){return new CSSUnitValue(term.value);}if(Object.keys(term.units).length===1&&term.units[Object.keys(term.units)[0]]===1){return new CSSUnitValue(term.value,Number(Object.keys(term.units)[0]));}return null;}function maybeSimplifyAsUnitValue(values,operator){DCHECK(!!values.length);var first_unit_value=values[0]instanceof CSSUnitValue?values[0]:null;if(!first_unit_value)return null;var final_value=first_unit_value.value;for(var i=1;i<values.length;i++){var unit_value=values[i]instanceof CSSUnitValue?values[i]:null;if(!unit_value||unit_value.unit!==first_unit_value.unit)return null;if(operator===CSSMathOperator.kAdd){final_value+=unit_value.value;}else if(operator===CSSMathOperator.kMax){final_value=Math.max(final_value,unit_value.value);}else if(operator===CSSMathOperator.kMin){final_value=Math.min(final_value,unit_value.value);}}return new CSSUnitValue(final_value,first_unit_value.unit);}function maybeMultiplyAsUnitValue(values){DCHECK(!!values.length);// We are allowed one unit value with type other than kNumber.
|
|
7583
|
-
var unit_other_than_number=exports.UnitType.kNumber;var final_value=1.0;for(var i=0;i<values.length;i++){var unit_value=values[i]instanceof CSSUnitValue?values[i]:null;if(!unit_value)return null;if(unit_value.unit!==exports.UnitType.kNumber){if(unit_other_than_number!==exports.UnitType.kNumber)return null;unit_other_than_number=unit_value.unit;}final_value*=unit_value.value;}return new CSSUnitValue(final_value,unit_other_than_number);}var toCanonicalUnit=function toCanonicalUnit(unit){return canonicalUnitTypeForCategory(unitTypeToUnitCategory(unit));};var formatInfinityOrNaN=function formatInfinityOrNaN(number,suffix){if(suffix===void 0){suffix='';}var result='';if(!Number.isFinite(number)){if(number>0)result='infinity';else result='-infinity';}else {DCHECK(Number.isNaN(number));result='NaN';}return result+=suffix;};var toCanonicalUnitIfPossible=function toCanonicalUnitIfPossible(unit){var canonical_unit=toCanonicalUnit(unit);if(canonical_unit===exports.UnitType.kUnknown)return unit;return canonical_unit;};/**
|
|
7452
|
+
*/ /**
|
|
7584
7453
|
* Represents numeric values that can be expressed as a single number plus a
|
|
7585
7454
|
* unit (or a naked number or percentage).
|
|
7586
7455
|
* @see https://drafts.css-houdini.org/css-typed-om/#cssunitvalue
|
|
7587
|
-
*/var CSSUnitValue=/*#__PURE__*/function(
|
|
7588
|
-
// let unit = value.type;
|
|
7589
|
-
// if (unit === UnitType.kInteger) unit = UnitType.kNumber;
|
|
7590
|
-
// if (!this.isValidUnit(unit)) return null;
|
|
7591
|
-
// return new CSSUnitValue(value.getDoubleValue(), unit);
|
|
7592
|
-
// }
|
|
7593
|
-
function CSSUnitValue(value,unitOrName){var _this3;if(unitOrName===void 0){unitOrName=exports.UnitType.kNumber;}var unit;if(typeof unitOrName==='string'){unit=unitFromName(unitOrName);}else {unit=unitOrName;}// DCHECK(CSSUnitValue.isValidUnit(unit));
|
|
7594
|
-
_this3=_CSSNumericValue.call(this,new CSSNumericValueType(unit))||this;_this3.unit=void 0;_this3.value=void 0;_this3.unit=unit;_this3.value=value;return _this3;}var _proto3=CSSUnitValue.prototype;_proto3.clone=function clone(){return new CSSUnitValue(this.value,this.unit);};_proto3.convertTo=function convertTo(target_unit){if(this.unit===target_unit){return new CSSUnitValue(this.value,this.unit);}// Instead of defining the scale factors for every unit to every other unit,
|
|
7456
|
+
*/var CSSUnitValue=/*#__PURE__*/function(_CSSStyleValue){_inheritsLoose(CSSUnitValue,_CSSStyleValue);function CSSUnitValue(value,unitOrName){var _this;if(unitOrName===void 0){unitOrName=exports.UnitType.kNumber;}_this=_CSSStyleValue.call(this)||this;_this.unit=void 0;_this.value=void 0;var unit;if(typeof unitOrName==='string'){unit=unitFromName(unitOrName);}else {unit=unitOrName;}_this.unit=unit;_this.value=value;return _this;}var _proto=CSSUnitValue.prototype;_proto.clone=function clone(){return new CSSUnitValue(this.value,this.unit);};_proto.equals=function equals(other){var other_unit_value=other;return this.value===other_unit_value.value&&this.unit===other_unit_value.unit;};_proto.getType=function getType(){return CSSStyleValueType.kUnitType;};_proto.convertTo=function convertTo(target_unit){if(this.unit===target_unit){return new CSSUnitValue(this.value,this.unit);}// Instead of defining the scale factors for every unit to every other unit,
|
|
7595
7457
|
// we simply convert to the canonical unit and back since we already have
|
|
7596
7458
|
// the scale factors for canonical units.
|
|
7597
|
-
var canonical_unit=toCanonicalUnit(this.unit);if(canonical_unit!==toCanonicalUnit(target_unit)||canonical_unit===exports.UnitType.kUnknown){return null;}var scale_factor=conversionToCanonicalUnitsScaleFactor(this.unit)/conversionToCanonicalUnitsScaleFactor(target_unit);return new CSSUnitValue(this.value*scale_factor,target_unit);};
|
|
7598
|
-
// return new CSSNumericLiteralValue(this.value, this.unit);
|
|
7599
|
-
// }
|
|
7600
|
-
// // const CSSPrimitiveValue* ToCSSValueWithProperty(CSSPropertyID) const final;
|
|
7601
|
-
// toCalcExpressionNode() {
|
|
7602
|
-
// return CSSMathExpressionNumericLiteral.create(
|
|
7603
|
-
// new CSSNumericLiteralValue(this.value, this.unit),
|
|
7604
|
-
// );
|
|
7605
|
-
// }
|
|
7606
|
-
;_proto3.sumValue=function sumValue(){var sum=[];var unit_map={};if(this.unit!==exports.UnitType.kNumber){unit_map[toCanonicalUnitIfPossible(this.unit)]=1;}sum.push({value:this.value*conversionToCanonicalUnitsScaleFactor(this.unit),units:unit_map});return sum;};_proto3.negate=function negate(){return new CSSUnitValue(-this.value,this.unit);};_proto3.invert=function invert(){if(this.unit===exports.UnitType.kNumber){if(this.value===0)return null;return new CSSUnitValue(1.0/this.value,this.unit);}return CSSMathInvert.create(this);};_proto3.buildCSSText=function buildCSSText(n,p,result){var text;switch(this.unit){case exports.UnitType.kUnknown:// FIXME
|
|
7459
|
+
var canonical_unit=toCanonicalUnit(this.unit);if(canonical_unit!==toCanonicalUnit(target_unit)||canonical_unit===exports.UnitType.kUnknown){return null;}var scale_factor=conversionToCanonicalUnitsScaleFactor(this.unit)/conversionToCanonicalUnitsScaleFactor(target_unit);return new CSSUnitValue(this.value*scale_factor,target_unit);};_proto.buildCSSText=function buildCSSText(n,p,result){var text;switch(this.unit){case exports.UnitType.kUnknown:// FIXME
|
|
7607
7460
|
break;case exports.UnitType.kInteger:text=Number(this.value).toFixed(0);break;case exports.UnitType.kNumber:case exports.UnitType.kPercentage:case exports.UnitType.kEms:// case UnitType.kQuirkyEms:
|
|
7608
7461
|
// case UnitType.kExs:
|
|
7609
7462
|
case exports.UnitType.kRems:// case UnitType.kChs:
|
|
@@ -7619,81 +7472,9 @@
|
|
|
7619
7472
|
// case UnitType.kUserUnits:
|
|
7620
7473
|
case exports.UnitType.kDegrees:case exports.UnitType.kRadians:case exports.UnitType.kGradians:case exports.UnitType.kMilliseconds:case exports.UnitType.kSeconds:// case UnitType.kHertz:
|
|
7621
7474
|
// case UnitType.kKilohertz:
|
|
7622
|
-
case exports.UnitType.kTurns:// case UnitType.kDynamicViewportMax: // case UnitType.kDynamicViewportMin: // case UnitType.kDynamicViewportBlockSize: // case UnitType.kDynamicViewportInlineSize: // case UnitType.kDynamicViewportHeight: // case UnitType.kDynamicViewportWidth: // case UnitType.kLargeViewportMax: // case UnitType.kLargeViewportMin: // case UnitType.kLargeViewportBlockSize: // case UnitType.kLargeViewportInlineSize: // case UnitType.kLargeViewportHeight: // case UnitType.kLargeViewportWidth: // case UnitType.kSmallViewportMax: // case UnitType.kSmallViewportMin: // case UnitType.kSmallViewportBlockSize: // case UnitType.kSmallViewportInlineSize: // case UnitType.kSmallViewportHeight: // case UnitType.kSmallViewportWidth: // case UnitType.kViewportMax: // case UnitType.kViewportMin: // case UnitType.kViewportBlockSize: // case UnitType.kViewportInlineSize: // case UnitType.kViewportHeight: // case UnitType.kViewportWidth: // case UnitType.kFraction:
|
|
7623
|
-
// case UnitType.kContainerWidth:
|
|
7624
|
-
// case UnitType.kContainerHeight:
|
|
7625
|
-
// case UnitType.kContainerInlineSize:
|
|
7626
|
-
// case UnitType.kContainerBlockSize:
|
|
7627
|
-
// case UnitType.kContainerMin:
|
|
7475
|
+
case exports.UnitType.kTurns:// case UnitType.kContainerMin: // case UnitType.kContainerBlockSize: // case UnitType.kContainerInlineSize: // case UnitType.kContainerHeight: // case UnitType.kContainerWidth: // case UnitType.kDynamicViewportMax: // case UnitType.kDynamicViewportMin: // case UnitType.kDynamicViewportBlockSize: // case UnitType.kDynamicViewportInlineSize: // case UnitType.kDynamicViewportHeight: // case UnitType.kDynamicViewportWidth: // case UnitType.kLargeViewportMax: // case UnitType.kLargeViewportMin: // case UnitType.kLargeViewportBlockSize: // case UnitType.kLargeViewportInlineSize: // case UnitType.kLargeViewportHeight: // case UnitType.kLargeViewportWidth: // case UnitType.kSmallViewportMax: // case UnitType.kSmallViewportMin: // case UnitType.kSmallViewportBlockSize: // case UnitType.kSmallViewportInlineSize: // case UnitType.kSmallViewportHeight: // case UnitType.kSmallViewportWidth: // case UnitType.kViewportMax: // case UnitType.kViewportMin: // case UnitType.kViewportBlockSize: // case UnitType.kViewportInlineSize: // case UnitType.kViewportHeight: // case UnitType.kViewportWidth: // case UnitType.kFraction:
|
|
7628
7476
|
// case UnitType.kContainerMax: {
|
|
7629
|
-
{var kMinInteger=-999999;var kMaxInteger=999999;var value=this.value;var unit=unitTypeToString(this.unit);if(value<kMinInteger||value>kMaxInteger){var _unit=unitTypeToString(this.unit);if(!Number.isFinite(value)||Number.isNaN(value)){text=formatInfinityOrNaN(value,_unit);}else {text=value+(_unit||'');}}else {text=""+value+unit;}}}result+=text;return result;};return CSSUnitValue;}(
|
|
7630
|
-
* The CSSMathValue interface of the CSS_Object_Model a base class for classes representing complex numeric values.
|
|
7631
|
-
*
|
|
7632
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSMathValue
|
|
7633
|
-
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_value.idl
|
|
7634
|
-
*/var CSSMathValue=/*#__PURE__*/function(_CSSNumericValue2){_inheritsLoose(CSSMathValue,_CSSNumericValue2);function CSSMathValue(){return _CSSNumericValue2.apply(this,arguments)||this;}var _proto4=CSSMathValue.prototype;// From CSSNumericValue
|
|
7635
|
-
_proto4.isUnitValue=function isUnitValue(){return false;};return CSSMathValue;}(CSSNumericValue);var CSSMathInvert=/*#__PURE__*/function(_CSSMathValue){_inheritsLoose(CSSMathInvert,_CSSMathValue);CSSMathInvert.create=function create(value){var type=CSSNumericValueType.negateExponents(value.type_);return new CSSMathInvert(value,type);};function CSSMathInvert(value,type){var _this4;_this4=_CSSMathValue.call(this,type)||this;_this4.value=void 0;_this4.operator='invert';_this4.value=value;return _this4;}var _proto5=CSSMathInvert.prototype;_proto5.clone=function clone(){return new CSSMathInvert(this.value,this.type_);};_proto5.getType=function getType(){return CSSStyleValueType.kInvertType;};_proto5.equals=function equals(other){if(other.getType()!==CSSStyleValueType.kInvertType){return false;}// We can safely cast here as we know 'other' has the same type as us.
|
|
7636
|
-
var other_invert=other;return this.value.equals(other_invert.value);};_proto5.sumValue=function sumValue(){var sum=this.value.sumValue();if(sum.length===0||sum.length!==1||sum[0].value===0){return null;}Object.keys(sum[0].units).forEach(function(key){sum[0].units[key]*=-1;});sum[0].value=1.0/sum[0].value;return sum;}// toCalcExpressionNode(): CSSMathExpressionNode {
|
|
7637
|
-
// const right_side = this.value.toCalcExpressionNode();
|
|
7638
|
-
// if (!right_side) {
|
|
7639
|
-
// return null;
|
|
7640
|
-
// }
|
|
7641
|
-
// // return CSSMathExpressionOperation::CreateArithmeticOperation(
|
|
7642
|
-
// // CSSMathExpressionNumericLiteral::Create(
|
|
7643
|
-
// // 1, UnitType.kNumber),
|
|
7644
|
-
// // right_side, CSSMathOperator.kDivide);
|
|
7645
|
-
// return null;
|
|
7646
|
-
// }
|
|
7647
|
-
;_proto5.buildCSSText=function buildCSSText(nested,paren_less,result){if(paren_less==ParenLess.kNo){result+=nested===Nested.kYes?'(':'calc(';}result+='1 / ';result=this.value.buildCSSText(Nested.kYes,ParenLess.kNo,result);if(paren_less===ParenLess.kNo){result+=')';}return result;};return CSSMathInvert;}(CSSMathValue);var CSSMathNegate=/*#__PURE__*/function(_CSSMathValue2){_inheritsLoose(CSSMathNegate,_CSSMathValue2);CSSMathNegate.create=function create(value){return new CSSMathNegate(value,value.type_);};function CSSMathNegate(value,type){var _this5;_this5=_CSSMathValue2.call(this,type)||this;_this5.value=void 0;_this5.operator='negate';_this5.value=value;return _this5;}var _proto6=CSSMathNegate.prototype;_proto6.clone=function clone(){return new CSSMathNegate(this.value,this.type_);};_proto6.getType=function getType(){return CSSStyleValueType.kNegateType;};_proto6.equals=function equals(other){if(other.getType()!==CSSStyleValueType.kNegateType){return false;}var other_invert=other;return this.value.equals(other_invert.value);};_proto6.sumValue=function sumValue(){var sum=this.value.sumValue();if(sum.length===0){return null;}sum.forEach(function(term){term.value*=-1;});return sum;}// toCalcExpressionNode(): CSSMathExpressionNode {
|
|
7648
|
-
// const right_side = this.value.toCalcExpressionNode();
|
|
7649
|
-
// if (!right_side) {
|
|
7650
|
-
// return null;
|
|
7651
|
-
// }
|
|
7652
|
-
// // return CSSMathExpressionOperation::CreateArithmeticOperationSimplified(
|
|
7653
|
-
// // CSSMathExpressionNumericLiteral::Create(
|
|
7654
|
-
// // -1, CSSPrimitiveValue::UnitType::kNumber),
|
|
7655
|
-
// // right_side, CSSMathOperator::kMultiply);
|
|
7656
|
-
// }
|
|
7657
|
-
;_proto6.buildCSSText=function buildCSSText(nested,paren_less,result){if(paren_less==ParenLess.kNo){result+=nested===Nested.kYes?'(':'calc(';}result+='-';result=this.value.buildCSSText(Nested.kYes,ParenLess.kNo,result);if(paren_less===ParenLess.kNo){result+=')';}return result;};return CSSMathNegate;}(CSSMathValue);function typeCheck(values,op,error){error=false;var final_type=values[0].type_;for(var i=1;i<values.length;i++){final_type=op(final_type,values[i].type_,error);if(error)return final_type;}return final_type;}// Represents an arithmetic operation with one or more CSSNumericValues.
|
|
7658
|
-
var CSSMathVariadic=/*#__PURE__*/function(_CSSMathValue3){_inheritsLoose(CSSMathVariadic,_CSSMathValue3);function CSSMathVariadic(values,type){var _this6;_this6=_CSSMathValue3.call(this,type)||this;_this6.values=void 0;_this6.values=values;return _this6;}var _proto7=CSSMathVariadic.prototype;_proto7.numericValues=function numericValues(){return this.values;};_proto7.equals=function equals(other){if(this.getType()!==other.getType()){return false;}return this.values.every(function(value,i){return value.equals(other.values[i]);});};return CSSMathVariadic;}(CSSMathValue);// Represents the minimum of one or more CSSNumericValues.
|
|
7659
|
-
// @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
|
|
7660
|
-
var CSSMathMin=/*#__PURE__*/function(_CSSMathVariadic){_inheritsLoose(CSSMathMin,_CSSMathVariadic);function CSSMathMin(){var _this7;for(var _len9=arguments.length,args=new Array(_len9),_key9=0;_key9<_len9;_key9++){args[_key9]=arguments[_key9];}_this7=_CSSMathVariadic.call.apply(_CSSMathVariadic,[this].concat(args))||this;_this7.operator='min';return _this7;}CSSMathMin.create=function create(values){var error=false;var final_type=typeCheck(values,CSSNumericValueType.add,error);return new CSSMathMin(values,final_type);};var _proto8=CSSMathMin.prototype;_proto8.clone=function clone(){return new CSSMathMin(this.values,this.type_);};_proto8.getType=function getType(){return CSSStyleValueType.kMinType;};_proto8.sumValue=function sumValue(){var cur_min=this.numericValues()[0].sumValue();if(!cur_min.length){return null;}for(var _iterator2=_createForOfIteratorHelperLoose(this.numericValues()),_step2;!(_step2=_iterator2()).done;){var value=_step2.value;var child_sum=value.sumValue();if(!child_sum.length||JSON.stringify(child_sum[0].units)!==JSON.stringify(cur_min[0].units)){return null;}if(child_sum[0].value<cur_min[0].value){cur_min=child_sum;}}return cur_min;}// toCalcExpressionNode() {
|
|
7661
|
-
// const operands: CSSMathExpressionOperation[] = [];
|
|
7662
|
-
// for (const value of this.numericValues()) {
|
|
7663
|
-
// const operand = value.toCalcExpressionNode();
|
|
7664
|
-
// if (!operand) {
|
|
7665
|
-
// continue;
|
|
7666
|
-
// }
|
|
7667
|
-
// operands.push(operand as CSSMathExpressionOperation);
|
|
7668
|
-
// }
|
|
7669
|
-
// return CSSMathExpressionOperation.createComparisonFunction(operands, CSSMathOperator.kMin);
|
|
7670
|
-
// }
|
|
7671
|
-
;_proto8.buildCSSText=function buildCSSText(nested,paren_less,result){result+='min(';var first_iteration=true;for(var _iterator3=_createForOfIteratorHelperLoose(this.numericValues()),_step3;!(_step3=_iterator3()).done;){var value=_step3.value;if(!first_iteration)result+=', ';first_iteration=false;result=value.buildCSSText(Nested.kYes,ParenLess.kYes,result);}result+=')';return result;};return CSSMathMin;}(CSSMathVariadic);// Represents the maximum of one or more CSSNumericValues.
|
|
7672
|
-
// @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
|
|
7673
|
-
var CSSMathMax=/*#__PURE__*/function(_CSSMathVariadic2){_inheritsLoose(CSSMathMax,_CSSMathVariadic2);function CSSMathMax(){var _this8;for(var _len10=arguments.length,args=new Array(_len10),_key10=0;_key10<_len10;_key10++){args[_key10]=arguments[_key10];}_this8=_CSSMathVariadic2.call.apply(_CSSMathVariadic2,[this].concat(args))||this;_this8.operator='max';return _this8;}CSSMathMax.create=function create(values){var error=false;var final_type=typeCheck(values,CSSNumericValueType.add,error);return new CSSMathMax(values,final_type);};var _proto9=CSSMathMax.prototype;_proto9.clone=function clone(){return new CSSMathMax(this.values,this.type_);};_proto9.getType=function getType(){return CSSStyleValueType.kMaxType;};_proto9.sumValue=function sumValue(){var cur_max=this.numericValues()[0].sumValue();if(!cur_max.length){return null;}for(var _iterator4=_createForOfIteratorHelperLoose(this.numericValues()),_step4;!(_step4=_iterator4()).done;){var value=_step4.value;var child_sum=value.sumValue();if(!child_sum.length||JSON.stringify(child_sum[0].units)!==JSON.stringify(cur_max[0].units)){return null;}if(child_sum[0].value<cur_max[0].value){cur_max=child_sum;}}return cur_max;}// toCalcExpressionNode() {
|
|
7674
|
-
// const operands: CSSMathExpressionOperation[] = [];
|
|
7675
|
-
// for (const value of this.numericValues()) {
|
|
7676
|
-
// const operand = value.toCalcExpressionNode();
|
|
7677
|
-
// if (!operand) {
|
|
7678
|
-
// continue;
|
|
7679
|
-
// }
|
|
7680
|
-
// operands.push(operand as CSSMathExpressionOperation);
|
|
7681
|
-
// }
|
|
7682
|
-
// return CSSMathExpressionOperation.createComparisonFunction(operands, CSSMathOperator.kMax);
|
|
7683
|
-
// }
|
|
7684
|
-
;_proto9.buildCSSText=function buildCSSText(nested,paren_less,result){result+='max(';var first_iteration=true;for(var _iterator5=_createForOfIteratorHelperLoose(this.numericValues()),_step5;!(_step5=_iterator5()).done;){var value=_step5.value;if(!first_iteration)result+=', ';first_iteration=false;result=value.buildCSSText(Nested.kYes,ParenLess.kYes,result);}result+=')';return result;};return CSSMathMax;}(CSSMathVariadic);/**
|
|
7685
|
-
* Represents the sum of one or more CSSNumericValues.
|
|
7686
|
-
* @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
|
|
7687
|
-
*/var CSSMathSum=/*#__PURE__*/function(_CSSMathVariadic3){_inheritsLoose(CSSMathSum,_CSSMathVariadic3);function CSSMathSum(){var _this9;for(var _len11=arguments.length,args=new Array(_len11),_key11=0;_key11<_len11;_key11++){args[_key11]=arguments[_key11];}_this9=_CSSMathVariadic3.call.apply(_CSSMathVariadic3,[this].concat(args))||this;_this9.operator='sum';return _this9;}CSSMathSum.create=function create(values){var error=false;var finalType=typeCheck(values,CSSNumericValueType.add,error);return new CSSMathSum(values,finalType);};CSSMathSum.numericTypeFromUnitMap=function numericTypeFromUnitMap(units){var type=new CSSNumericValueType();Object.keys(units).forEach(function(key){var exp=units[key];var error=false;type=CSSNumericValueType.multiply(type,new CSSNumericValueType(Number(key),exp),error);DCHECK(!error);});return type;};CSSMathSum.canCreateNumericTypeFromSumValue=function canCreateNumericTypeFromSumValue(sum){var _this10=this;DCHECK(!!sum.length);var first_type=this.numericTypeFromUnitMap(sum[0].units);return sum.every(function(term){var error=false;CSSNumericValueType.add(first_type,_this10.numericTypeFromUnitMap(term.units),error);return !error;});};var _proto10=CSSMathSum.prototype;_proto10.clone=function clone(){return new CSSMathSum(this.values,this.type_);};_proto10.getType=function getType(){return CSSStyleValueType.kSumType;}// toCalcExpressionNode() {
|
|
7688
|
-
// return this.toCalcExporessionNodeForVariadic(CSSMathOperator.kAdd);
|
|
7689
|
-
// }
|
|
7690
|
-
;_proto10.sumValue=function sumValue(){var sum=[];this.numericValues().forEach(function(value){var child_sum=value.sumValue();if(!child_sum.length){return null;}child_sum.forEach(function(term){var index=sum.findIndex(function(s){return JSON.stringify(s.units)===JSON.stringify(term.units);});if(index===-1){sum.push(_extends({},term));}else {sum[index].value+=term.value;}});});if(!CSSMathSum.canCreateNumericTypeFromSumValue(sum))return null;return sum;};_proto10.buildCSSText=function buildCSSText(nested,paren_less,result){if(paren_less==ParenLess.kNo){result+=nested===Nested.kYes?'(':'calc(';}var values=this.numericValues();result=values[0].buildCSSText(Nested.kYes,ParenLess.kNo,result);for(var i=1;i<values.length;i++){var arg=values[i];if(arg.getType()===CSSStyleValueType.kNegateType){result+=' - ';result=arg.value.buildCSSText(Nested.kYes,ParenLess.kNo,result);}else {result+=' + ';result=arg.buildCSSText(Nested.kYes,ParenLess.kNo,result);}}if(paren_less===ParenLess.kNo){result+=')';}return result;};return CSSMathSum;}(CSSMathVariadic);/**
|
|
7691
|
-
* Represents the product of one or more CSSNumericValues.
|
|
7692
|
-
* @see https://drafts.css-houdini.org/css-typed-om/#cssmathproduct
|
|
7693
|
-
*/var CSSMathProduct=/*#__PURE__*/function(_CSSMathVariadic4){_inheritsLoose(CSSMathProduct,_CSSMathVariadic4);function CSSMathProduct(){var _this11;for(var _len12=arguments.length,args=new Array(_len12),_key12=0;_key12<_len12;_key12++){args[_key12]=arguments[_key12];}_this11=_CSSMathVariadic4.call.apply(_CSSMathVariadic4,[this].concat(args))||this;_this11.operator='product';return _this11;}CSSMathProduct.create=function create(values){var error=false;var finalType=typeCheck(values,CSSNumericValueType.multiply,error);return new CSSMathProduct(values,finalType);};CSSMathProduct.multiplyUnitMaps=function multiplyUnitMaps(a,b){Object.keys(b).forEach(function(key){DCHECK_NE(b[key].value,0);var old_value=key in a?a[key].value:0;if(old_value+b[key].value===0){delete a[key];}else {a[key]=old_value+b[key].value;}});return a;};var _proto11=CSSMathProduct.prototype;_proto11.clone=function clone(){return new CSSMathProduct(this.values,this.type_);};_proto11.getType=function getType(){return CSSStyleValueType.kProductType;}// toCalcExpressionNode() {
|
|
7694
|
-
// return this.toCalcExporessionNodeForVariadic(CSSMathOperator.kMultiply);
|
|
7695
|
-
// }
|
|
7696
|
-
;_proto11.sumValue=function sumValue(){var sum=[{value:1,units:{}}];this.numericValues().forEach(function(value){var child_sum=value.sumValue();if(!child_sum.length){return null;}var new_sum=[];sum.forEach(function(a){child_sum.forEach(function(b){new_sum.push({value:a.value*b.value,units:CSSMathProduct.multiplyUnitMaps(a.units,b.units)});});});sum=new_sum;});return sum;};_proto11.buildCSSText=function buildCSSText(nested,paren_less,result){if(paren_less==ParenLess.kNo){result+=nested===Nested.kYes?'(':'calc(';}var values=this.numericValues();result=values[0].buildCSSText(Nested.kYes,ParenLess.kNo,result);for(var i=1;i<values.length;i++){var arg=values[i];if(arg.getType()===CSSStyleValueType.kInvertType){result+=' / ';result=arg.value.buildCSSText(Nested.kYes,ParenLess.kNo,result);}else {result+=' * ';result=arg.buildCSSText(Nested.kYes,ParenLess.kNo,result);}}if(paren_less===ParenLess.kNo){result+=')';}return result;};return CSSMathProduct;}(CSSMathVariadic);var Opx=new CSSUnitValue(0,'px');var Lpx=new CSSUnitValue(1,'px');var Odeg=new CSSUnitValue(0,'deg');/**
|
|
7477
|
+
{var kMinInteger=-999999;var kMaxInteger=999999;var value=this.value;var unit=unitTypeToString(this.unit);if(value<kMinInteger||value>kMaxInteger){var _unit=unitTypeToString(this.unit);if(!Number.isFinite(value)||Number.isNaN(value)){text=formatInfinityOrNaN(value,_unit);}else {text=value+(_unit||'');}}else {text=""+value+unit;}}}result+=text;return result;};return CSSUnitValue;}(CSSStyleValue);var Opx=new CSSUnitValue(0,'px');var Lpx=new CSSUnitValue(1,'px');var Odeg=new CSSUnitValue(0,'deg');/**
|
|
7697
7478
|
* The CSSRGB class represents the CSS rgb()/rgba() functions.
|
|
7698
7479
|
*
|
|
7699
7480
|
* @see https://drafts.css-houdini.org/css-typed-om-1/#cssrgb
|
|
@@ -7744,11 +7525,19 @@
|
|
|
7744
7525
|
* CSSKeywordValue
|
|
7745
7526
|
*/var unsetKeywordValue=new CSSKeywordValue('unset');var initialKeywordValue=new CSSKeywordValue('initial');var inheritKeywordValue=new CSSKeywordValue('inherit');var keywordCache={'':unsetKeywordValue,unset:unsetKeywordValue,initial:initialKeywordValue,inherit:inheritKeywordValue};var getOrCreateKeyword=function getOrCreateKeyword(name){if(!keywordCache[name]){keywordCache[name]=new CSSKeywordValue(name);}return keywordCache[name];};/**
|
|
7746
7527
|
* CSSColor
|
|
7747
|
-
*/var noneColor=new CSSRGB(0,0,0,0,true);var transparentColor=new CSSRGB(0,0,0,0);var getOrCreateRGBA=memoize(function(r,g,b,a){return new CSSRGB(r,g,b,a);},function(r,g,b,a){return "rgba("+r+","+g+","+b+","+a+")";})
|
|
7528
|
+
*/var noneColor=new CSSRGB(0,0,0,0,true);var transparentColor=new CSSRGB(0,0,0,0);var getOrCreateRGBA=memoize(function(r,g,b,a){return new CSSRGB(r,g,b,a);},function(r,g,b,a){return "rgba("+r+","+g+","+b+","+a+")";});// export const getOrCreateUnitValue = memoize(
|
|
7529
|
+
// (value: number, unitOrName: UnitType | string = UnitType.kNumber) => {
|
|
7530
|
+
// return new CSSUnitValue(value, unitOrName);
|
|
7531
|
+
// },
|
|
7532
|
+
// (value: number, unitOrName: UnitType | string = UnitType.kNumber) => {
|
|
7533
|
+
// return `${value}${unitOrName}`;
|
|
7534
|
+
// },
|
|
7535
|
+
// );
|
|
7536
|
+
var getOrCreateUnitValue=function getOrCreateUnitValue(value,unitOrName){if(unitOrName===void 0){unitOrName=exports.UnitType.kNumber;}return new CSSUnitValue(value,unitOrName);};var regexLG=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;var regexRG=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;var regexPR=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;var regexColorStop=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function spaceColorStops(colorStops){var _colorStops$length;var length=colorStops.length;colorStops[length-1].length=(_colorStops$length=colorStops[length-1].length)!==null&&_colorStops$length!==void 0?_colorStops$length:{type:'%',value:'100'};if(length>1){var _colorStops$0$length;colorStops[0].length=(_colorStops$0$length=colorStops[0].length)!==null&&_colorStops$0$length!==void 0?_colorStops$0$length:{type:'%',value:'0'};}var previousIndex=0;var previousOffset=Number(colorStops[0].length.value);for(var i=1;i<length;i++){var _colorStops$i$length;// support '%' & 'px'
|
|
7748
7537
|
var offset=(_colorStops$i$length=colorStops[i].length)===null||_colorStops$i$length===void 0?void 0:_colorStops$i$length.value;if(!isNil(offset)&&!isNil(previousOffset)){for(var j=1;j<i-previousIndex;j++){colorStops[previousIndex+j].length={type:'%',value:""+(previousOffset+(Number(offset)-previousOffset)*j/(i-previousIndex))};}previousIndex=i;previousOffset=Number(offset);}}}// The position of the gradient line's starting point.
|
|
7749
7538
|
// different from CSS side(to top) @see https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient#values
|
|
7750
7539
|
var SideOrCornerToDegMap={left:270-90,top:0-90,bottom:180-90,right:90-90,'left top':315-90,'top left':315-90,'left bottom':225-90,'bottom left':225-90,'right top':45-90,'top right':45-90,'right bottom':135-90,'bottom right':135-90};var angleToDeg=memoize(function(orientation){var angle;if(orientation.type==='angular'){angle=Number(orientation.value);}else {angle=SideOrCornerToDegMap[orientation.value]||0;}return getOrCreateUnitValue(angle,'deg');});var positonToCSSUnitValue=memoize(function(position){var cx=50;var cy=50;var unitX='%';var unitY='%';if((position===null||position===void 0?void 0:position.type)==='position'){var _position$value=position.value,x=_position$value.x,y=_position$value.y;if((x===null||x===void 0?void 0:x.type)==='position-keyword'){if(x.value==='left'){cx=0;}else if(x.value==='center'){cx=50;}else if(x.value==='right'){cx=100;}else if(x.value==='top'){cy=0;}else if(x.value==='bottom'){cy=100;}}if((y===null||y===void 0?void 0:y.type)==='position-keyword'){if(y.value==='left'){cx=0;}else if(y.value==='center'){cy=50;}else if(y.value==='right'){cx=100;}else if(y.value==='top'){cy=0;}else if(y.value==='bottom'){cy=100;}}if((x===null||x===void 0?void 0:x.type)==='px'||(x===null||x===void 0?void 0:x.type)==='%'||(x===null||x===void 0?void 0:x.type)==='em'){unitX=x===null||x===void 0?void 0:x.type;cx=Number(x.value);}if((y===null||y===void 0?void 0:y.type)==='px'||(y===null||y===void 0?void 0:y.type)==='%'||(y===null||y===void 0?void 0:y.type)==='em'){unitY=y===null||y===void 0?void 0:y.type;cy=Number(y.value);}}return {cx:getOrCreateUnitValue(cx,unitX),cy:getOrCreateUnitValue(cy,unitY)};});var parseGradient=memoize(function(colorStr){if(colorStr.indexOf('linear')>-1||colorStr.indexOf('radial')>-1){var ast=parseGradient$1(colorStr);return ast.map(function(_ref){var type=_ref.type,orientation=_ref.orientation,colorStops=_ref.colorStops;spaceColorStops(colorStops);var steps=colorStops.map(function(colorStop){// TODO: only support % for now, should calc percentage of axis length when using px/em
|
|
7751
|
-
return {offset:getOrCreateUnitValue(colorStop.length.value,'%'),color:colorStopToString(colorStop)};});if(type==='linear-gradient'){return new CSSGradientValue(exports.GradientType.LinearGradient,{angle:orientation?angleToDeg(orientation):Odeg,steps:steps});}else if(type==='radial-gradient'){if(!orientation){orientation=[{type:'shape',value:'circle'}];}if(orientation[0].type==='shape'&&orientation[0].value==='circle'){var _positonToCSSUnitValu=positonToCSSUnitValue(orientation[0].at),cx=_positonToCSSUnitValu.cx,cy=_positonToCSSUnitValu.cy;var size;if(orientation[0].style){var _orientation$0$style=orientation[0].style,_type=_orientation$0$style.type,value=_orientation$0$style.value;if(_type==='extent-keyword'){size=getOrCreateKeyword(value);}else {size=getOrCreateUnitValue(value,_type);}}return new CSSGradientValue(exports.GradientType.RadialGradient,{cx:cx,cy:cy,size:size,steps:steps});}// TODO: support ellipse shape
|
|
7540
|
+
return {offset:getOrCreateUnitValue(Number(colorStop.length.value),'%'),color:colorStopToString(colorStop)};});if(type==='linear-gradient'){return new CSSGradientValue(exports.GradientType.LinearGradient,{angle:orientation?angleToDeg(orientation):Odeg,steps:steps});}else if(type==='radial-gradient'){if(!orientation){orientation=[{type:'shape',value:'circle'}];}if(orientation[0].type==='shape'&&orientation[0].value==='circle'){var _positonToCSSUnitValu=positonToCSSUnitValue(orientation[0].at),cx=_positonToCSSUnitValu.cx,cy=_positonToCSSUnitValu.cy;var size;if(orientation[0].style){var _orientation$0$style=orientation[0].style,_type=_orientation$0$style.type,value=_orientation$0$style.value;if(_type==='extent-keyword'){size=getOrCreateKeyword(value);}else {size=getOrCreateUnitValue(value,_type);}}return new CSSGradientValue(exports.GradientType.RadialGradient,{cx:cx,cy:cy,size:size,steps:steps});}// TODO: support ellipse shape
|
|
7752
7541
|
// TODO: repeating-linear-gradient & repeating-radial-gradient
|
|
7753
7542
|
// } else if (type === 'repeating-linear-gradient') {
|
|
7754
7543
|
// } else if (type === 'repeating-radial-gradient') {
|
|
@@ -7762,7 +7551,7 @@
|
|
|
7762
7551
|
var g=parseGradient(colorStr);if(g){return g;}// constants
|
|
7763
7552
|
var color$1=color(colorStr);var rgba=[0,0,0,0];if(color$1!==null){rgba[0]=color$1.r||0;rgba[1]=color$1.g||0;rgba[2]=color$1.b||0;rgba[3]=color$1.opacity;}// return new CSSRGB(...rgba);
|
|
7764
7553
|
return getOrCreateRGBA.apply(void 0,rgba);});function mergeColors(left,right){// only support constant value, exclude gradient & pattern
|
|
7765
|
-
if(!isCSSRGB(left)||!isCSSRGB(right)){return;}return [[Number(left.r),Number(left.g),Number(left.b),Number(left.alpha)],[Number(right.r),Number(right.g),Number(right.b),Number(right.alpha)],function(color){var rgba=color.slice();if(rgba[3]){for(var i=0;i<3;i++){rgba[i]=Math.round(clamp(rgba[i],0,255));}}rgba[3]=clamp(rgba[3],0,1);return "rgba("+rgba.join(',')+")";}];}function parseDimension(unitRegExp,string){if(isNil(string)){return getOrCreateUnitValue(0,'px');}string=(""+string).trim().toLowerCase();if(isFinite(Number(string))){if('px'.search(unitRegExp)>=0){return getOrCreateUnitValue(Number(string),'px');}else if('deg'.search(unitRegExp)>=0){return getOrCreateUnitValue(Number(string),'deg');}}var matchedUnits=[];string=string.replace(unitRegExp,function(match){matchedUnits.push(match);return 'U'+match;});var taggedUnitRegExp='U('+unitRegExp.source+')';return matchedUnits.map(function(unit){return getOrCreateUnitValue(Number(string.replace(new RegExp('U'+unit,'g'),'').replace(new RegExp(taggedUnitRegExp,'g'),'*0')),unit);})[0];}/**
|
|
7554
|
+
if(!isCSSRGB(left)||!isCSSRGB(right)){return;}return [[Number(left.r),Number(left.g),Number(left.b),Number(left.alpha)],[Number(right.r),Number(right.g),Number(right.b),Number(right.alpha)],function(color){var rgba=color.slice();if(rgba[3]){for(var i=0;i<3;i++){rgba[i]=Math.round(clamp(rgba[i],0,255));}}rgba[3]=clamp(rgba[3],0,1);return "rgba("+rgba.join(',')+")";}];}(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={}));function parseDimension(unitRegExp,string){if(isNil(string)){return getOrCreateUnitValue(0,'px');}string=(""+string).trim().toLowerCase();if(isFinite(Number(string))){if('px'.search(unitRegExp)>=0){return getOrCreateUnitValue(Number(string),'px');}else if('deg'.search(unitRegExp)>=0){return getOrCreateUnitValue(Number(string),'deg');}}var matchedUnits=[];string=string.replace(unitRegExp,function(match){matchedUnits.push(match);return 'U'+match;});var taggedUnitRegExp='U('+unitRegExp.source+')';return matchedUnits.map(function(unit){return getOrCreateUnitValue(Number(string.replace(new RegExp('U'+unit,'g'),'').replace(new RegExp(taggedUnitRegExp,'g'),'*0')),unit);})[0];}/**
|
|
7766
7555
|
* <length>
|
|
7767
7556
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
|
|
7768
7557
|
* length with only absolute unit, eg. 1px
|
|
@@ -7774,7 +7563,14 @@
|
|
|
7774
7563
|
* eg. 1px, 0.7em, 50%, calc(100% - 200px);
|
|
7775
7564
|
*
|
|
7776
7565
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
|
|
7777
|
-
*/
|
|
7566
|
+
*/ // export const parseLengthOrPercentage = memoize((css: string): CSSUnitValue => {
|
|
7567
|
+
// if (isNumber(css) || isFinite(Number(css))) {
|
|
7568
|
+
// return getOrCreateUnitValue(Number(css), 'px');
|
|
7569
|
+
// }
|
|
7570
|
+
// return parseDimension(new RegExp('px|%|em|rem', 'g'), css) as CSSUnitValue;
|
|
7571
|
+
// });
|
|
7572
|
+
var parseLengthOrPercentage=function parseLengthOrPercentage(css){if(isNumber(css)||isFinite(Number(css))){return getOrCreateUnitValue(Number(css),'px');// return Number(css);
|
|
7573
|
+
}return parseDimension(new RegExp('px|%|em|rem','g'),css);};var parseAngle=memoize(function(css){return parseDimension(new RegExp('deg|rad|grad|turn','g'),css);});/**
|
|
7778
7574
|
* merge CSSUnitValue
|
|
7779
7575
|
*
|
|
7780
7576
|
* @example
|
|
@@ -7900,7 +7696,7 @@
|
|
|
7900
7696
|
*
|
|
7901
7697
|
* @example
|
|
7902
7698
|
* CSS.percent(50) -> CSS.px(0.5 * parent.width)
|
|
7903
|
-
*/_proto.calculator=function calculator(name,oldParsed,computed,object,registry){if(CSSUnitValue.isRelativeUnit(computed.unit)){if(computed.unit===exports.UnitType.kPercentage){// TODO: merge dimensions
|
|
7699
|
+
*/_proto.calculator=function calculator(name,oldParsed,computed,object,registry){if(isNumber(computed)){return computed;}if(CSSUnitValue.isRelativeUnit(computed.unit)){if(computed.unit===exports.UnitType.kPercentage){// TODO: merge dimensions
|
|
7904
7700
|
return 0;}else if(computed.unit===exports.UnitType.kEms){if(object.parentNode){var fontSize=getFontSize(object.parentNode);if(fontSize){fontSize*=computed.value;return fontSize;}else {registry.addUnresolveProperty(object,name);}}else {registry.addUnresolveProperty(object,name);}return 0;}else if(computed.unit===exports.UnitType.kRems){var _object$ownerDocument;if(object===null||object===void 0?void 0:(_object$ownerDocument=object.ownerDocument)===null||_object$ownerDocument===void 0?void 0:_object$ownerDocument.documentElement){var _fontSize=getFontSize(object.ownerDocument.documentElement);if(_fontSize){_fontSize*=computed.value;return _fontSize;}else {registry.addUnresolveProperty(object,name);}}else {registry.addUnresolveProperty(object,name);}return 0;}}else {// remove listener if exists
|
|
7905
7701
|
// registry.unregisterParentGeometryBoundsChangedHandler(object, name);
|
|
7906
7702
|
// return absolute value
|
|
@@ -7980,7 +7776,7 @@
|
|
|
7980
7776
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry
|
|
7981
7777
|
*/var CustomElementRegistry=/*#__PURE__*/function(){function CustomElementRegistry(){this.registry={};this.define(exports.Shape.CIRCLE,Circle);this.define(exports.Shape.ELLIPSE,Ellipse);this.define(exports.Shape.RECT,Rect);this.define(exports.Shape.IMAGE,Image);this.define(exports.Shape.LINE,Line);this.define(exports.Shape.GROUP,Group);this.define(exports.Shape.PATH,Path);this.define(exports.Shape.POLYGON,Polygon);this.define(exports.Shape.POLYLINE,Polyline);this.define(exports.Shape.TEXT,Text);this.define(exports.Shape.HTML,HTML);}var _proto=CustomElementRegistry.prototype;_proto.define=function define(name,constructor){this.registry[name]=constructor;}/**
|
|
7982
7778
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/get
|
|
7983
|
-
*/;_proto.get=function get(name){return this.registry[name];};return CustomElementRegistry;}();function isFederatedEvent(value){return !!value.type;}/**
|
|
7779
|
+
*/;_proto.get=function get(name){return this.registry[name];};return CustomElementRegistry;}();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;}();function isFederatedEvent(value){return !!value.type;}/**
|
|
7984
7780
|
* An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
|
|
7985
7781
|
* FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
|
|
7986
7782
|
*/var FederatedEvent=/*#__PURE__*/function(){/**
|
|
@@ -8174,7 +7970,17 @@
|
|
|
8174
7970
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
8175
7971
|
* * Query eg. querySelector getElementById...
|
|
8176
7972
|
* * Animation
|
|
8177
|
-
*/var Element=/*#__PURE__*/function(_Node){_inheritsLoose(Element,_Node);function Element(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_Node.call.apply(_Node,[this].concat(args))||this;_this.entity=entityCounter++;_this.renderable={bounds:undefined,boundsDirty:true,renderBounds:undefined,renderBoundsDirty:true,dirtyRenderBounds:undefined,dirty:false,proxyNodeName:undefined};_this.cullable={strategy:exports.Strategy.Standard,visibilityPlaneMask:-1,visible:true,enable:true};_this.transformable={dirtyFlag:false,localDirtyFlag:false,frozen:false
|
|
7973
|
+
*/var Element=/*#__PURE__*/function(_Node){_inheritsLoose(Element,_Node);function Element(){var _this;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_Node.call.apply(_Node,[this].concat(args))||this;_this.entity=entityCounter++;_this.renderable={bounds:undefined,boundsDirty:true,renderBounds:undefined,renderBoundsDirty:true,dirtyRenderBounds:undefined,dirty:false,proxyNodeName:undefined};_this.cullable={strategy:exports.Strategy.Standard,visibilityPlaneMask:-1,visible:true,enable:true};_this.transformable={dirtyFlag:false,localDirtyFlag:false,frozen:false,// localPosition: vec3.fromValues(0, 0, 0),
|
|
7974
|
+
// localRotation: quat.fromValues(0, 0, 0, 1),
|
|
7975
|
+
// localScale: vec3.fromValues(1, 1, 1),
|
|
7976
|
+
// localTransform: mat4.create(),
|
|
7977
|
+
// localSkew: vec2.fromValues(0, 0),
|
|
7978
|
+
// position: vec3.fromValues(0, 0, 0),
|
|
7979
|
+
// rotation: quat.fromValues(0, 0, 0, 1),
|
|
7980
|
+
// scaling: vec3.fromValues(1, 1, 1),
|
|
7981
|
+
// worldTransform: mat4.create(),
|
|
7982
|
+
// origin: vec3.fromValues(0, 0, 0),
|
|
7983
|
+
localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:create$1(),localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:create$1(),origin:[0,0,0]};_this.sortable={dirty:false,sorted:undefined,lastSortedIndex:undefined,renderOrder:0};_this.geometry={contentBounds:undefined,renderBounds:undefined};_this.rBushNode={aabb:undefined};_this.id=void 0;_this.name=void 0;_this.namespaceURI='g';_this.scrollLeft=0;_this.scrollTop=0;_this.clientTop=0;_this.clientLeft=0;_this.destroyed=false;_this.style={};_this.computedStyle={anchor:unsetKeywordValue,opacity:unsetKeywordValue,fillOpacity:unsetKeywordValue,strokeOpacity:unsetKeywordValue,fill:unsetKeywordValue,stroke:unsetKeywordValue,transform:unsetKeywordValue,transformOrigin:unsetKeywordValue,visibility:unsetKeywordValue,pointerEvents:unsetKeywordValue,lineWidth:unsetKeywordValue,lineCap:unsetKeywordValue,lineJoin:unsetKeywordValue,increasedLineWidthForHitTesting:unsetKeywordValue,fontSize:unsetKeywordValue,fontFamily:unsetKeywordValue,fontStyle:unsetKeywordValue,fontWeight:unsetKeywordValue,fontVariant:unsetKeywordValue,textAlign:unsetKeywordValue,textBaseline:unsetKeywordValue,textTransform:unsetKeywordValue,zIndex:unsetKeywordValue,filter:unsetKeywordValue,shadowType:unsetKeywordValue};_this.parsedStyle={// opacity: '',
|
|
8178
7984
|
// fillOpacity: '',
|
|
8179
7985
|
// strokeOpacity: '',
|
|
8180
7986
|
// transformOrigin: '',
|
|
@@ -8293,7 +8099,8 @@
|
|
|
8293
8099
|
* which can lead to unintended consequences if an attempt is made to cache the entire event object.
|
|
8294
8100
|
*
|
|
8295
8101
|
* 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.
|
|
8296
|
-
*/;_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);function isDisplayObject(value){return !!(value===null||value===void 0?void 0:value.nodeName);}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
|
|
8102
|
+
*/;_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);function isDisplayObject(value){return !!(value===null||value===void 0?void 0:value.nodeName);}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 DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED=_extends({},DEFAULT_PARSED_STYLE_PROPS,{opacity:1,fillOpacity:1,strokeOpacity:1,visibility:'visible',pointerEvents:'auto',lineWidth:1,lineCap:'butt',lineJoin:'miter',increasedLineWidthForHitTesting:0,fillRule:'nonzero'// TODO: transformOrigin
|
|
8103
|
+
});var INHERITABLE_BASE_STYLE_PROPS=['opacity','fillOpacity','strokeOpacity','transformOrigin','visibility','pointerEvents','lineWidth','lineCap','lineJoin','increasedLineWidthForHitTesting'];var INHERITABLE_STYLE_PROPS=[].concat(INHERITABLE_BASE_STYLE_PROPS,['fontSize','fontFamily','fontStyle','fontWeight','fontVariant','textAlign','textBaseline','textTransform']);/**
|
|
8297
8104
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
8298
8105
|
*
|
|
8299
8106
|
* mixins: Animatable, Transformable, Visible
|
|
@@ -8319,8 +8126,13 @@
|
|
|
8319
8126
|
_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
|
|
8320
8127
|
_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
|
|
8321
8128
|
_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
|
|
8322
|
-
_this.config.style=
|
|
8323
|
-
|
|
8129
|
+
_this.config.style=_this.config.style||_this.config.attrs||{};Object.assign(_this.config.style,_this.config.attrs);// this.config.style = {
|
|
8130
|
+
// // ...DEFAULT_STYLE_PROPS,
|
|
8131
|
+
// ...this.config.style,
|
|
8132
|
+
// ...this.config.attrs,
|
|
8133
|
+
// };
|
|
8134
|
+
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
|
|
8135
|
+
Object.assign(_this.parsedStyle,runtime.enableCSSParsing?DEFAULT_PARSED_STYLE_PROPS:DEFAULT_PARSED_STYLE_PROPS_CSS_DISABLED,_this.config.initialParsedStyle);if(runtime.enableCSSParsing){Object.assign(_this.attributes,DEFAULT_STYLE_PROPS);}// start to process attributes
|
|
8324
8136
|
_this.initAttributes(_this.config.style);_this.style=new Proxy(// @ts-ignore
|
|
8325
8137
|
{// ...this.attributes,
|
|
8326
8138
|
setProperty:function setProperty(propertyName,value){_this.setAttribute(propertyName,value);},getPropertyValue:function getPropertyValue(propertyName){return _this.getAttribute(propertyName);},removeProperty:function removeProperty(propertyName){_this.removeAttribute(propertyName);},item:function item(){return '';}},{get:function get(target,name){if(target[name]!==undefined){// if (name in target) {
|
|
@@ -8341,13 +8153,14 @@
|
|
|
8341
8153
|
// @see https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode#notes
|
|
8342
8154
|
id:this.id,name:this.name,className:this.name,interactive:this.interactive,style:clonedStyle});// apply transform
|
|
8343
8155
|
cloned.setLocalTransform(this.getLocalTransform());if(deep){this.children.forEach(function(child){// skip marker
|
|
8344
|
-
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
|
|
8345
|
-
runtime.styleValueRegistry.processProperties(this,attributes,{forceUpdateGeometry:true,usedAttributes:INHERITABLE_STYLE_PROPS// usedAttributes:
|
|
8156
|
+
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;var options={forceUpdateGeometry:true// usedAttributes:
|
|
8346
8157
|
// // only Group / Text should account for text relative props
|
|
8347
8158
|
// this.tagName === Shape.GROUP || this.tagName === Shape.TEXT
|
|
8348
8159
|
// ? INHERITABLE_STYLE_PROPS
|
|
8349
8160
|
// : INHERITABLE_BASE_STYLE_PROPS,
|
|
8350
|
-
})
|
|
8161
|
+
};if(runtime.enableCSSParsing){// @ts-ignore
|
|
8162
|
+
options.usedAttributes=INHERITABLE_STYLE_PROPS;}// account for FCP, process properties as less as possible
|
|
8163
|
+
runtime.styleValueRegistry.processProperties(this,attributes,options);// redraw at next frame
|
|
8351
8164
|
renderable.dirty=true;};_proto.setAttribute=function setAttribute(name,value,force){if(force===void 0){force=false;}var attributeName=formatAttributeName(name);// ignore undefined value
|
|
8352
8165
|
if(isUndefined(value)){return;}if(force||value!==this.attributes[attributeName]){this.internalSetAttribute(attributeName,value);_Element.prototype.setAttribute.call(this,attributeName,value);}}/**
|
|
8353
8166
|
* called when attributes get changed or initialized
|
|
@@ -8498,7 +8311,11 @@
|
|
|
8498
8311
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getBoundingClientRect
|
|
8499
8312
|
*/;_proto.getBoundingClientRect=function getBoundingClientRect(){return this.parsedStyle.$el.getBoundingClientRect();};_proto.getClientRects=function getClientRects(){return [this.getBoundingClientRect()];};_proto.getBounds=function getBounds(){var _this$ownerDocument,_this$ownerDocument$d;var clientRect=this.getBoundingClientRect();// calc context's offset
|
|
8500
8313
|
// @ts-ignore
|
|
8501
|
-
var canvasRect=(_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:(_this$ownerDocument$d=_this$ownerDocument.defaultView)===null||_this$ownerDocument$d===void 0?void 0:_this$ownerDocument$d.getContextService().getBoundingClientRect();if(canvasRect){var minX=clientRect.left-canvasRect.left;var minY=clientRect.top-canvasRect.top;var aabb=new AABB()
|
|
8314
|
+
var canvasRect=(_this$ownerDocument=this.ownerDocument)===null||_this$ownerDocument===void 0?void 0:(_this$ownerDocument$d=_this$ownerDocument.defaultView)===null||_this$ownerDocument$d===void 0?void 0:_this$ownerDocument$d.getContextService().getBoundingClientRect();if(canvasRect){var minX=clientRect.left-canvasRect.left;var minY=clientRect.top-canvasRect.top;var aabb=new AABB();// aabb.setMinMax(
|
|
8315
|
+
// vec3.fromValues(minX, minY, 0),
|
|
8316
|
+
// vec3.fromValues(minX + clientRect.width, minY + clientRect.height, 0),
|
|
8317
|
+
// );
|
|
8318
|
+
aabb.setMinMax([minX,minY,0],[minX+clientRect.width,minY+clientRect.height,0]);return aabb;}return null;};_proto.getLocalBounds=function getLocalBounds(){if(this.parentNode){var parentInvert=invert(create$1(),this.parentNode.getWorldTransform());var bounds=this.getBounds();if(!AABB.isEmpty(bounds)){var localBounds=new AABB();localBounds.setFromTransformedAABB(bounds,parentInvert);return localBounds;}}return this.getBounds();};return HTML;}(DisplayObject);var _excluded$5=["style"];var Image=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Image,_DisplayObject);function Image(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$5);return _DisplayObject.call(this,_extends({type:exports.Shape.IMAGE,style:_extends({x:'',y:'',img:'',width:'',height:''},style)},rest))||this;}return Image;}(DisplayObject);var _excluded$6=["style"];/**
|
|
8502
8319
|
* Create a line connecting two points.
|
|
8503
8320
|
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/line
|
|
8504
8321
|
*
|
|
@@ -8574,7 +8391,7 @@
|
|
|
8574
8391
|
// selectSubString(charnum: number, nchars: number): void {
|
|
8575
8392
|
// throw new Error('Method not implemented.');
|
|
8576
8393
|
// }
|
|
8577
|
-
;_proto.getLineBoundingRects=function getLineBoundingRects(){var _this$parsedStyle$met2;return ((_this$parsedStyle$met2=this.parsedStyle.metrics)===null||_this$parsedStyle$met2===void 0?void 0:_this$parsedStyle$met2.lineMetrics)||[];};_proto.isOverflowing=function isOverflowing(){return !!this.parsedStyle.isOverflowing;};return Text;}(DisplayObject);function getAngle$1(angle){if(angle===undefined){return 0;}else if(angle>360||angle<-360){return angle%360;}return angle;}function createVec3(x,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(isNumber(x)){return fromValues$2(x,y,z);}if(Array.isArray(x)&&x.length===3){return clone$1(x);}return fromValues$2(x[0],x[1]||y,x[2]||z);}function deg2rad(deg){return deg*(Math.PI/180);}function rad2deg(rad){return rad*(180/Math.PI);}function grad2deg(grads){grads=grads%400;if(grads<0){grads+=400;}return grads/400*360;}function deg2turn(deg){return deg/360;}function turn2deg(turn){return 360*turn;}function getEulerFromQuat(out,quat){var x=quat[0];var y=quat[1];var z=quat[2];var w=quat[3];var x2=x*x;var y2=y*y;var z2=z*z;var w2=w*w;var unit=x2+y2+z2+w2;var test=x*w-y*z;if(test>0.499995*unit){// TODO: Use glmatrix.EPSILON
|
|
8394
|
+
;_proto.getLineBoundingRects=function getLineBoundingRects(){var _this$parsedStyle$met2;return ((_this$parsedStyle$met2=this.parsedStyle.metrics)===null||_this$parsedStyle$met2===void 0?void 0:_this$parsedStyle$met2.lineMetrics)||[];};_proto.isOverflowing=function isOverflowing(){return !!this.parsedStyle.isOverflowing;};return Text;}(DisplayObject);function copyVec3(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a;}function subVec3(o,a,b){o[0]=a[0]-b[0];o[1]=a[1]-b[1];o[2]=a[2]-b[2];return o;}function addVec3(o,a,b){o[0]=a[0]+b[0];o[1]=a[1]+b[1];o[2]=a[2]+b[2];return o;}function scaleVec3(o,a,b){o[0]=a[0]*b;o[1]=a[1]*b;o[2]=a[2]*b;return o;}function maxVec3(o,a,b){o[0]=Math.max(a[0],b[0]);o[1]=Math.max(a[1],b[1]);o[2]=Math.max(a[2],b[2]);return o;}function minVec3(o,a,b){o[0]=Math.min(a[0],b[0]);o[1]=Math.min(a[1],b[1]);o[2]=Math.min(a[2],b[2]);return o;}function getAngle$1(angle){if(angle===undefined){return 0;}else if(angle>360||angle<-360){return angle%360;}return angle;}function createVec3(x,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}if(isNumber(x)){return fromValues$2(x,y,z);}if(Array.isArray(x)&&x.length===3){return clone$1(x);}return fromValues$2(x[0],x[1]||y,x[2]||z);}function deg2rad(deg){return deg*(Math.PI/180);}function rad2deg(rad){return rad*(180/Math.PI);}function grad2deg(grads){grads=grads%400;if(grads<0){grads+=400;}return grads/400*360;}function deg2turn(deg){return deg/360;}function turn2deg(turn){return 360*turn;}function getEulerFromQuat(out,quat){var x=quat[0];var y=quat[1];var z=quat[2];var w=quat[3];var x2=x*x;var y2=y*y;var z2=z*z;var w2=w*w;var unit=x2+y2+z2+w2;var test=x*w-y*z;if(test>0.499995*unit){// TODO: Use glmatrix.EPSILON
|
|
8578
8395
|
// singularity at the north pole
|
|
8579
8396
|
out[0]=Math.PI/2;out[1]=2*Math.atan2(y,x);out[2]=0;}else if(test<-0.499995*unit){//TODO: Use glmatrix.EPSILON
|
|
8580
8397
|
// singularity at the south pole
|
|
@@ -8630,7 +8447,7 @@
|
|
|
8630
8447
|
if(m44===0)return false;var scale=1/m44;for(var i=0;i<16;i++){out[i]=mat[i]*scale;}return true;}//gets upper-left of a 4x4 matrix into a 3x3 of vectors
|
|
8631
8448
|
function mat3from4(out,mat4x4){out[0][0]=mat4x4[0];out[0][1]=mat4x4[1];out[0][2]=mat4x4[2];out[1][0]=mat4x4[4];out[1][1]=mat4x4[5];out[1][2]=mat4x4[6];out[2][0]=mat4x4[8];out[2][1]=mat4x4[9];out[2][2]=mat4x4[10];}function combine(out,a,b,scale1,scale2){out[0]=a[0]*scale1+b[0]*scale2;out[1]=a[1]*scale1+b[1]*scale2;out[2]=a[2]*scale1+b[2]*scale2;}var tmpMat4=create$1();function parsedTransformToMat4(transform,object){if(transform&&transform.length){var defX=0;var defY=0;if(object){defX=object.parsedStyle.defX||0;defY=object.parsedStyle.defY||0;// reset transform
|
|
8632
8449
|
object.resetLocalTransform();object.setLocalPosition(defX,defY);}else {object=new DisplayObject({});}transform.forEach(function(parsed){var t=parsed.t,d=parsed.d;if(t==='scale'){// scale(1) scale(1, 1)
|
|
8633
|
-
var newScale=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1,1];object.scaleLocal(newScale[0],newScale[1],1);}else if(t==='scalex'){var _newScale=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1];object.scaleLocal(_newScale[0],1,1);}else if(t==='scaley'){var _newScale2=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1];object.scaleLocal(1,_newScale2[0],1);}else if(t==='scalez'){var _newScale3=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1];object.scaleLocal(1,1,_newScale3[0]);}else if(t==='scale3d'){var _newScale4=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1,1,1];object.scaleLocal(_newScale4[0],_newScale4[1],_newScale4[2]);}else if(t==='translate'){var newTranslation=d||[Opx,Opx];object.translateLocal(newTranslation[0].value,newTranslation[1].value,0);}else if(t==='translatex'){var _newTranslation=d||[Opx];object.translateLocal(_newTranslation[0].value,0,0);}else if(t==='translatey'){var _newTranslation2=d||[Opx];object.translateLocal(0,_newTranslation2[0].value,0);}else if(t==='translatez'){var _newTranslation3=d||[Opx];object.translateLocal(0,0,_newTranslation3[0].value);}else if(t==='translate3d'){var _newTranslation4=d||[Opx,Opx,Opx];object.translateLocal(_newTranslation4[0].value,_newTranslation4[1].value,_newTranslation4[2].value);}else if(t==='rotate'){var newAngles=d||[Odeg];object.rotateLocal(0,0,newAngles[0]
|
|
8450
|
+
var newScale=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1,1];object.scaleLocal(newScale[0],newScale[1],1);}else if(t==='scalex'){var _newScale=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1];object.scaleLocal(_newScale[0],1,1);}else if(t==='scaley'){var _newScale2=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1];object.scaleLocal(1,_newScale2[0],1);}else if(t==='scalez'){var _newScale3=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1];object.scaleLocal(1,1,_newScale3[0]);}else if(t==='scale3d'){var _newScale4=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[1,1,1];object.scaleLocal(_newScale4[0],_newScale4[1],_newScale4[2]);}else if(t==='translate'){var newTranslation=d||[Opx,Opx];object.translateLocal(newTranslation[0].value,newTranslation[1].value,0);}else if(t==='translatex'){var _newTranslation=d||[Opx];object.translateLocal(_newTranslation[0].value,0,0);}else if(t==='translatey'){var _newTranslation2=d||[Opx];object.translateLocal(0,_newTranslation2[0].value,0);}else if(t==='translatez'){var _newTranslation3=d||[Opx];object.translateLocal(0,0,_newTranslation3[0].value);}else if(t==='translate3d'){var _newTranslation4=d||[Opx,Opx,Opx];object.translateLocal(_newTranslation4[0].value,_newTranslation4[1].value,_newTranslation4[2].value);}else if(t==='rotate'){var newAngles=d||[Odeg];object.rotateLocal(0,0,convertAngleUnit(newAngles[0]));}else if(t==='rotatex'){var _newAngles=d||[Odeg];object.rotateLocal(convertAngleUnit(_newAngles[0]),0,0);}else if(t==='rotatey'){var _newAngles2=d||[Odeg];object.rotateLocal(0,convertAngleUnit(_newAngles2[0]),0);}else if(t==='rotatez'){var _newAngles3=d||[Odeg];object.rotateLocal(0,0,convertAngleUnit(_newAngles3[0]));}else if(t==='rotate3d');else if(t==='skew'){var newSkew=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[0,0];object.setLocalSkew(deg2rad(newSkew[0]),deg2rad(newSkew[1]));}else if(t==='skewx'){var _newSkew=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[0];object.setLocalSkew(deg2rad(_newSkew[0]),object.getLocalSkew()[1]);}else if(t==='skewy'){var _newSkew2=(d===null||d===void 0?void 0:d.map(function(s){return s.value;}))||[0];object.setLocalSkew(object.getLocalSkew()[0],deg2rad(_newSkew2[0]));}else if(t==='matrix'){var _d$map=d.map(function(s){return s.value;}),a=_d$map[0],b=_d$map[1],c=_d$map[2],dd=_d$map[3],tx=_d$map[4],ty=_d$map[5];object.setLocalTransform(set(tmpMat4,a,b,0,0,c,dd,0,0,0,0,1,0,tx+defX,ty+defY,0,1));}else if(t==='matrix3d'){// @ts-ignore
|
|
8634
8451
|
set.apply(mat4,[tmpMat4].concat(d.map(function(s){return s.value;})));tmpMat4[12]+=defX;tmpMat4[13]+=defY;object.setLocalTransform(tmpMat4);}});}return object.getLocalTransform();}/**
|
|
8635
8452
|
* borrow from gradient-parser, but we delete some browser compatible prefix such as `-webkit-`
|
|
8636
8453
|
* @see https://github.com/rafaelcaricio/gradient-parser
|
|
@@ -8660,7 +8477,7 @@
|
|
|
8660
8477
|
if(points.length>0){polylines.push(points);}return {polygons:polygons,polylines:polylines};}function isSamePoint(point1,point2){return point1[0]===point2[0]&&point1[1]===point2[1];}function getPathBBox(segments,lineWidth){var xArr=[];var yArr=[];var segmentsWithAngle=[];for(var i=0;i<segments.length;i++){var segment=segments[i];var currentPoint=segment.currentPoint,params=segment.params,prePoint=segment.prePoint;var box=void 0;switch(segment.command){case'Q':box=quadratic.box(prePoint[0],prePoint[1],params[1],params[2],params[3],params[4]);break;case'C':box=cubic.box(prePoint[0],prePoint[1],params[1],params[2],params[3],params[4],params[5],params[6]);break;case'A':var arcParams=segment.arcParams;box=arc.box(arcParams.cx,arcParams.cy,arcParams.rx,arcParams.ry,arcParams.xRotation,arcParams.startAngle,arcParams.endAngle);break;default:xArr.push(currentPoint[0]);yArr.push(currentPoint[1]);break;}if(box){segment.box=box;xArr.push(box.x,box.x+box.width);yArr.push(box.y,box.y+box.height);}if(lineWidth&&(segment.command==='L'||segment.command==='M')&&segment.prePoint&&segment.nextPoint){segmentsWithAngle.push(segment);}}// bbox calculation should ignore NaN for path attribute
|
|
8661
8478
|
// ref: https://github.com/antvis/g/issues/210
|
|
8662
8479
|
// ref: https://github.com/antvis/G2/issues/3109
|
|
8663
|
-
xArr=xArr.filter(function(item){return !Number.isNaN(item)&&item!==Infinity&&item!==-Infinity;});yArr=yArr.filter(function(item){return !Number.isNaN(item)&&item!==Infinity&&item!==-Infinity;});var minX=min
|
|
8480
|
+
xArr=xArr.filter(function(item){return !Number.isNaN(item)&&item!==Infinity&&item!==-Infinity;});yArr=yArr.filter(function(item){return !Number.isNaN(item)&&item!==Infinity&&item!==-Infinity;});var minX=min(xArr);var minY=min(yArr);var maxX=max(xArr);var maxY=max(yArr);if(segmentsWithAngle.length===0){return {x:minX,y:minY,width:maxX-minX,height:maxY-minY};}for(var _i=0;_i<segmentsWithAngle.length;_i++){var _segment=segmentsWithAngle[_i];var _currentPoint=_segment.currentPoint;var extra=void 0;if(_currentPoint[0]===minX){extra=getExtraFromSegmentWithAngle(_segment,lineWidth);minX=minX-extra.xExtra;}else if(_currentPoint[0]===maxX){extra=getExtraFromSegmentWithAngle(_segment,lineWidth);maxX=maxX+extra.xExtra;}if(_currentPoint[1]===minY){extra=getExtraFromSegmentWithAngle(_segment,lineWidth);minY=minY-extra.yExtra;}else if(_currentPoint[1]===maxY){extra=getExtraFromSegmentWithAngle(_segment,lineWidth);maxY=maxY+extra.yExtra;}}return {x:minX,y:minY,width:maxX-minX,height:maxY-minY};}function getExtraFromSegmentWithAngle(segment,lineWidth){var prePoint=segment.prePoint,currentPoint=segment.currentPoint,nextPoint=segment.nextPoint;var currentAndPre=Math.pow(currentPoint[0]-prePoint[0],2)+Math.pow(currentPoint[1]-prePoint[1],2);var currentAndNext=Math.pow(currentPoint[0]-nextPoint[0],2)+Math.pow(currentPoint[1]-nextPoint[1],2);var preAndNext=Math.pow(prePoint[0]-nextPoint[0],2)+Math.pow(prePoint[1]-nextPoint[1],2);// 以 currentPoint 为顶点的夹角
|
|
8664
8481
|
var currentAngle=Math.acos((currentAndPre+currentAndNext-preAndNext)/(2*Math.sqrt(currentAndPre)*Math.sqrt(currentAndNext)));// 夹角为空、 0 或 PI 时,不需要计算夹角处的额外宽度
|
|
8665
8482
|
// 注意: 由于计算精度问题,夹角为 0 的情况计算出来的角度可能是一个很小的值,还需要判断其与 0 是否近似相等
|
|
8666
8483
|
if(!currentAngle||Math.sin(currentAngle)===0||isNumberEqual(currentAngle,0)){return {xExtra:0,yExtra:0};}var xAngle=Math.abs(Math.atan2(nextPoint[1]-currentPoint[1],nextPoint[0]-currentPoint[0]));var yAngle=Math.abs(Math.atan2(nextPoint[0]-currentPoint[0],nextPoint[1]-currentPoint[1]));// 将夹角转为锐角
|
|
@@ -8841,6 +8658,86 @@
|
|
|
8841
8658
|
return Date.now()-nowOffset;};var reservedCBs={};var lastTime=Date.now();var polyfillRaf=function polyfillRaf(callback){if(typeof callback!=='function'){throw new TypeError(callback+' is not a function');}var currentTime=Date.now();var gap=currentTime-lastTime;var delay=gap>16?0:16-gap;var id=uniqueId();reservedCBs[id]=callback;// keys(reservedCBs).length > 1 의미는 이미 setTimeout 이 걸려있는 경우.
|
|
8842
8659
|
// 함께 callback 이 실행될 수 있게 reservedCBs 에만 추가해주고 return
|
|
8843
8660
|
if(Object.keys(reservedCBs).length>1)return id;setTimeout(function(){lastTime=currentTime;var copied=reservedCBs;reservedCBs={};Object.keys(copied).forEach(function(key){return copied[key](pnow());});},delay);return id;};var polyfillCaf=function polyfillCaf(id){delete reservedCBs[id];};var vendorPrefixes=['','webkit','moz','ms','o'];var getRequestAnimationFrame=function getRequestAnimationFrame(vp){if(typeof vp!=='string')return polyfillRaf;if(vp==='')return root['requestAnimationFrame'];return root[vp+'RequestAnimationFrame'];};var getCancelAnimationFrame=function getCancelAnimationFrame(vp){if(typeof vp!=='string')return polyfillCaf;if(vp==='')return root['cancelAnimationFrame'];return root[vp+'CancelAnimationFrame']||root[vp+'CancelRequestAnimationFrame'];};var find=function find(arr,predicate){var i=0;while(arr[i]!==void 0){if(predicate(arr[i]))return arr[i];i=i+1;}};var vp=find(vendorPrefixes,function(vp){return !!getRequestAnimationFrame(vp);});var raf=getRequestAnimationFrame(vp);var caf=getCancelAnimationFrame(vp);root.requestAnimationFrame=raf;root.cancelAnimationFrame=caf;/**
|
|
8661
|
+
* Axis-Aligned Bounding Box
|
|
8662
|
+
* 为了便于后续 Frustum Culling,通过查找表定义 p-vertex 和 n-vertex
|
|
8663
|
+
* @see https://github.com/antvis/GWebGPUEngine/issues/3
|
|
8664
|
+
*/var AABB=/*#__PURE__*/function(){AABB.isEmpty=function isEmpty(aabb){return !aabb||aabb.halfExtents[0]===0&&aabb.halfExtents[1]===0&&aabb.halfExtents[2]===0;};// center: vec3 = vec3.create();
|
|
8665
|
+
// halfExtents: vec3 = vec3.create();
|
|
8666
|
+
// min: vec3 = vec3.create();
|
|
8667
|
+
// max: vec3 = vec3.create();
|
|
8668
|
+
function AABB(center,halfExtents){if(center===void 0){center=[0,0,0];}if(halfExtents===void 0){halfExtents=[0,0,0];}this.center=[0,0,0];this.halfExtents=[0,0,0];this.min=[0,0,0];this.max=[0,0,0];this.update(center,halfExtents);}var _proto=AABB.prototype;_proto.update=function update(center,halfExtents){copyVec3(this.center,center);copyVec3(this.halfExtents,halfExtents);subVec3(this.min,this.center,this.halfExtents);addVec3(this.max,this.center,this.halfExtents);// vec3.copy(this.center, center);
|
|
8669
|
+
// vec3.copy(this.halfExtents, halfExtents);
|
|
8670
|
+
// vec3.sub(this.min, this.center, this.halfExtents);
|
|
8671
|
+
// vec3.add(this.max, this.center, this.halfExtents);
|
|
8672
|
+
};_proto.setMinMax=function setMinMax(min,max){// vec3.add(this.center, max, min);
|
|
8673
|
+
// vec3.scale(this.center, this.center, 0.5);
|
|
8674
|
+
// vec3.sub(this.halfExtents, max, min);
|
|
8675
|
+
// vec3.scale(this.halfExtents, this.halfExtents, 0.5);
|
|
8676
|
+
// vec3.copy(this.min, min);
|
|
8677
|
+
// vec3.copy(this.max, max);
|
|
8678
|
+
addVec3(this.center,max,min);scaleVec3(this.center,this.center,0.5);subVec3(this.halfExtents,max,min);scaleVec3(this.halfExtents,this.halfExtents,0.5);copyVec3(this.min,min);copyVec3(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);bc[0]=m[12]+mx0*ac[0]+mx1*ac[1]+mx2*ac[2];bc[1]=m[13]+my0*ac[0]+my1*ac[1]+my2*ac[2];bc[2]=m[14]+mz0*ac[0]+mz1*ac[1]+mz2*ac[2];// vec3.set(
|
|
8679
|
+
// bc,
|
|
8680
|
+
// m[12] + mx0 * ac[0] + mx1 * ac[1] + mx2 * ac[2],
|
|
8681
|
+
// m[13] + my0 * ac[0] + my1 * ac[1] + my2 * ac[2],
|
|
8682
|
+
// m[14] + mz0 * ac[0] + mz1 * ac[1] + mz2 * ac[2],
|
|
8683
|
+
// );
|
|
8684
|
+
br[0]=mx0a*ar[0]+mx1a*ar[1]+mx2a*ar[2];br[1]=my0a*ar[0]+my1a*ar[1]+my2a*ar[2];br[2]=mz0a*ar[0]+mz1a*ar[1]+mz2a*ar[2];// vec3.set(
|
|
8685
|
+
// br,
|
|
8686
|
+
// mx0a * ar[0] + mx1a * ar[1] + mx2a * ar[2],
|
|
8687
|
+
// my0a * ar[0] + my1a * ar[1] + my2a * ar[2],
|
|
8688
|
+
// mz0a * ar[0] + mz1a * ar[1] + mz2a * ar[2],
|
|
8689
|
+
// );
|
|
8690
|
+
// this.min = vec3.sub(this.min, bc, br);
|
|
8691
|
+
// this.max = vec3.add(this.max, bc, br);
|
|
8692
|
+
subVec3(this.min,bc,br);addVec3(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();// const min = vec3.max(vec3.create(), this.getMin(), aabb.getMin());
|
|
8693
|
+
// const max = vec3.min(vec3.create(), this.getMax(), aabb.getMax());
|
|
8694
|
+
var min=maxVec3([0,0,0],this.getMin(),aabb.getMin());var max=minVec3([0,0,0],this.getMax(),aabb.getMax());intersection.setMinMax(min,max);return intersection;}// containsPoint(point: vec3) {
|
|
8695
|
+
// const min = this.getMin();
|
|
8696
|
+
// const max = this.getMax();
|
|
8697
|
+
// return !(
|
|
8698
|
+
// point[0] < min[0] ||
|
|
8699
|
+
// point[0] > max[0] ||
|
|
8700
|
+
// point[1] < min[1] ||
|
|
8701
|
+
// point[1] > max[1] ||
|
|
8702
|
+
// point[2] < min[2] ||
|
|
8703
|
+
// point[2] > max[2]
|
|
8704
|
+
// );
|
|
8705
|
+
// }
|
|
8706
|
+
/**
|
|
8707
|
+
* get n-vertex
|
|
8708
|
+
* @param plane plane of CullingVolume
|
|
8709
|
+
*/;_proto.getNegativeFarPoint=function getNegativeFarPoint(plane){if(plane.pnVertexFlag===0x111){return copyVec3([0,0,0],this.min);// return vec3.copy(vec3.create(), this.min);
|
|
8710
|
+
}else if(plane.pnVertexFlag===0x110){return [this.min[0],this.min[1],this.max[2]];// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
8711
|
+
}else if(plane.pnVertexFlag===0x101){return [this.min[0],this.max[1],this.min[2]];// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
8712
|
+
}else if(plane.pnVertexFlag===0x100){return [this.min[0],this.max[1],this.max[2]];// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
8713
|
+
}else if(plane.pnVertexFlag===0x011){return [this.max[0],this.min[1],this.min[2]];// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
8714
|
+
}else if(plane.pnVertexFlag===0x010){return [this.max[0],this.min[1],this.max[2]];// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
8715
|
+
}else if(plane.pnVertexFlag===0x001){return [this.max[0],this.max[1],this.min[2]];// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
8716
|
+
}else {return [this.max[0],this.max[1],this.max[2]];// return vec3.fromValues(this.max[0], this.max[1], this.max[2]);
|
|
8717
|
+
}}/**
|
|
8718
|
+
* get p-vertex
|
|
8719
|
+
* @param plane plane of CullingVolume
|
|
8720
|
+
*/;_proto.getPositiveFarPoint=function getPositiveFarPoint(plane){if(plane.pnVertexFlag===0x111){return copyVec3([0,0,0],this.max);// return vec3.copy(vec3.create(), this.max);
|
|
8721
|
+
}else if(plane.pnVertexFlag===0x110){return [this.max[0],this.max[1],this.min[2]];// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
8722
|
+
}else if(plane.pnVertexFlag===0x101){return [this.max[0],this.min[1],this.max[2]];// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
8723
|
+
}else if(plane.pnVertexFlag===0x100){return [this.max[0],this.min[1],this.min[2]];// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
8724
|
+
}else if(plane.pnVertexFlag===0x011){return [this.min[0],this.max[1],this.max[2]];// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
8725
|
+
}else if(plane.pnVertexFlag===0x010){return [this.min[0],this.max[1],this.min[2]];// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
8726
|
+
}else if(plane.pnVertexFlag===0x001){return [this.min[0],this.min[1],this.max[2]];// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
8727
|
+
}else {return [this.min[0],this.min[1],this.min[2]];// return vec3.fromValues(this.min[0], this.min[1], this.min[2]);
|
|
8728
|
+
}};return AABB;}();var Plane=/*#__PURE__*/function(){/**
|
|
8729
|
+
* lookup table for p-vertex & n-vertex when doing frustum culling
|
|
8730
|
+
*/function Plane(distance,normal){this.distance=void 0;this.normal=void 0;this.pnVertexFlag=void 0;this.distance=distance||0;this.normal=normal||fromValues$2(0,1,0);this.updatePNVertexFlag();}var _proto=Plane.prototype;_proto.updatePNVertexFlag=function updatePNVertexFlag(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0);};_proto.distanceToPoint=function distanceToPoint(point){return dot(point,this.normal)-this.distance;};_proto.normalize=function normalize(){var invLen=1/len(this.normal);scale$1(this.normal,this.normal,invLen);this.distance*=invLen;};_proto.intersectsLine=function intersectsLine(start,end,point){var d0=this.distanceToPoint(start);var d1=this.distanceToPoint(end);var t=d0/(d0-d1);var intersects=t>=0&&t<=1;if(intersects&&point){lerp(point,start,end,t);}return intersects;};return Plane;}();(function(Mask){Mask[Mask["OUTSIDE"]=4294967295]="OUTSIDE";Mask[Mask["INSIDE"]=0]="INSIDE";Mask[Mask["INDETERMINATE"]=2147483647]="INDETERMINATE";})(exports.Mask||(exports.Mask={}));var Frustum=/*#__PURE__*/function(){function Frustum(planes){this.planes=[];if(planes){this.planes=planes;}else {for(var i=0;i<6;i++){this.planes.push(new Plane());}}}/**
|
|
8731
|
+
* extract 6 planes from projectionMatrix
|
|
8732
|
+
* @see http://www8.cs.umu.se/kurser/5DV051/HT12/lab/plane_extraction.pdf
|
|
8733
|
+
*/var _proto=Frustum.prototype;_proto.extractFromVPMatrix=function extractFromVPMatrix(projectionMatrix){// @ts-ignore
|
|
8734
|
+
var m0=projectionMatrix[0],m1=projectionMatrix[1],m2=projectionMatrix[2],m3=projectionMatrix[3],m4=projectionMatrix[4],m5=projectionMatrix[5],m6=projectionMatrix[6],m7=projectionMatrix[7],m8=projectionMatrix[8],m9=projectionMatrix[9],m10=projectionMatrix[10],m11=projectionMatrix[11],m12=projectionMatrix[12],m13=projectionMatrix[13],m14=projectionMatrix[14],m15=projectionMatrix[15];// right
|
|
8735
|
+
set$1(this.planes[0].normal,m3-m0,m7-m4,m11-m8);this.planes[0].distance=m15-m12;// left
|
|
8736
|
+
set$1(this.planes[1].normal,m3+m0,m7+m4,m11+m8);this.planes[1].distance=m15+m12;// bottom
|
|
8737
|
+
set$1(this.planes[2].normal,m3+m1,m7+m5,m11+m9);this.planes[2].distance=m15+m13;// top
|
|
8738
|
+
set$1(this.planes[3].normal,m3-m1,m7-m5,m11-m9);this.planes[3].distance=m15-m13;// far
|
|
8739
|
+
set$1(this.planes[4].normal,m3-m2,m7-m6,m11-m10);this.planes[4].distance=m15-m14;// near
|
|
8740
|
+
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 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;}();/**
|
|
8844
8741
|
* Blink used them in code generation(css_properties.json5)
|
|
8845
8742
|
*/var BUILT_IN_PROPERTIES=[{/**
|
|
8846
8743
|
* used in CSS Layout API
|
|
@@ -8890,7 +8787,10 @@
|
|
|
8890
8787
|
// l: true,
|
|
8891
8788
|
// },
|
|
8892
8789
|
{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();// const uniqueAttributeSet = new Set<string>();
|
|
8893
|
-
|
|
8790
|
+
// const tmpVec3a = vec3.create();
|
|
8791
|
+
// const tmpVec3b = vec3.create();
|
|
8792
|
+
// const tmpVec3c = vec3.create();
|
|
8793
|
+
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(){/**
|
|
8894
8794
|
* need recalc later
|
|
8895
8795
|
*/ // dirty = false;
|
|
8896
8796
|
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;});};_proto.unregisterMetadata=function unregisterMetadata(name){delete propertyMetadataCache[name];};_proto.getPropertySyntax=function getPropertySyntax(syntax){return runtime.CSSPropertySyntaxFactory[syntax];}/**
|
|
@@ -8901,7 +8801,11 @@
|
|
|
8901
8801
|
*
|
|
8902
8802
|
* * calculate used value
|
|
8903
8803
|
* * post process
|
|
8904
|
-
*/;_proto.processProperties=function processProperties(object,attributes,options){var _this2=this;if(options===void 0){options={skipUpdateAttribute:false,skipParse:false,forceUpdateGeometry:false,usedAttributes:[]};}
|
|
8804
|
+
*/;_proto.processProperties=function processProperties(object,attributes,options){var _this2=this;if(options===void 0){options={skipUpdateAttribute:false,skipParse:false,forceUpdateGeometry:false,usedAttributes:[]};}if(!runtime.enableCSSParsing){Object.assign(object.attributes,attributes);object.parsedStyle=Object.assign(object.parsedStyle,attributes);if(attributes.fill){object.parsedStyle.fill=parseColor(attributes.fill);}if(attributes.stroke){object.parsedStyle.stroke=parseColor(attributes.stroke);}// @ts-ignore
|
|
8805
|
+
if(attributes.cx||attributes.cy){// @ts-ignore
|
|
8806
|
+
runtime.CSSPropertySyntaxFactory['<coordinate>'].postProcessor(object);}// console.log(object.parsedStyle);
|
|
8807
|
+
// console.log(attributes);
|
|
8808
|
+
this.updateGeometry(object);return;}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;
|
|
8905
8809
|
// parse according to priority
|
|
8906
8810
|
// path 50
|
|
8907
8811
|
// points 50
|
|
@@ -8917,7 +8821,7 @@
|
|
|
8917
8821
|
// return;
|
|
8918
8822
|
// }
|
|
8919
8823
|
// update geometry
|
|
8920
|
-
if(needUpdateGeometry){this.updateGeometry(object);}attributeNames.forEach(function(name){if(name in object.parsedStyle){_this2.postProcessProperty(name,object,attributeNames);}});if(object.children.length){attributeNames.forEach(function(name){if(name in object.parsedStyle&&_this2.isPropertyInheritable(name)){// update children's inheritable
|
|
8824
|
+
if(needUpdateGeometry){this.updateGeometry(object);}attributeNames.forEach(function(name){if(name in object.parsedStyle){_this2.postProcessProperty(name,object,attributeNames);}});if(runtime.enableCSSParsing&&object.children.length){attributeNames.forEach(function(name){if(name in object.parsedStyle&&_this2.isPropertyInheritable(name)){// update children's inheritable
|
|
8921
8825
|
object.children.forEach(function(child){child.internalSetAttribute(name,null,{skipUpdateAttribute:true,skipParse:true});});}});}}/**
|
|
8922
8826
|
* string -> parsed value
|
|
8923
8827
|
*/;_proto.parseProperty=function parseProperty(name,value,object){var metadata=propertyMetadataCache[name];var computed=value;if(value===''||isNil(value)){value='unset';}if(value==='unset'||value==='initial'||value==='inherit'){// computed = new CSSKeywordValue(value);
|
|
@@ -8953,9 +8857,21 @@
|
|
|
8953
8857
|
*/;_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
|
|
8954
8858
|
// @see https://github.com/antvis/g/issues/957
|
|
8955
8859
|
var flipY=width<0;var flipX=height<0;// init with content box
|
|
8956
|
-
var halfExtents=
|
|
8860
|
+
var halfExtents=[Math.abs(width)/2,Math.abs(height)/2,depth/2];// const halfExtents = vec3.set(
|
|
8861
|
+
// tmpVec3a,
|
|
8862
|
+
// Math.abs(width) / 2,
|
|
8863
|
+
// Math.abs(height) / 2,
|
|
8864
|
+
// depth / 2,
|
|
8865
|
+
// );
|
|
8866
|
+
// anchor is center by default, don't account for lineWidth here
|
|
8957
8867
|
var stroke=parsedStyle.stroke,lineWidth=parsedStyle.lineWidth,increasedLineWidthForHitTesting=parsedStyle.increasedLineWidthForHitTesting,shadowType=parsedStyle.shadowType,shadowColor=parsedStyle.shadowColor,_parsedStyle$filter=parsedStyle.filter,filter=_parsedStyle$filter===void 0?[]:_parsedStyle$filter,transformOrigin=parsedStyle.transformOrigin;var anchor=parsedStyle.anchor;// <Text> use textAlign & textBaseline instead of anchor
|
|
8958
|
-
if(object.nodeName===exports.Shape.TEXT){delete parsedStyle.anchor;}var center=
|
|
8868
|
+
if(object.nodeName===exports.Shape.TEXT){delete parsedStyle.anchor;}var center=[(1-(anchor&&anchor[0]||0)*2)*width/2+offsetX,(1-(anchor&&anchor[1]||0)*2)*height/2+offsetY,(1-(anchor&&anchor[2]||0)*2)*halfExtents[2]+offsetZ];// const center = vec3.set(
|
|
8869
|
+
// tmpVec3b,
|
|
8870
|
+
// ((1 - ((anchor && anchor[0]) || 0) * 2) * width) / 2 + offsetX,
|
|
8871
|
+
// ((1 - ((anchor && anchor[1]) || 0) * 2) * height) / 2 + offsetY,
|
|
8872
|
+
// (1 - ((anchor && anchor[2]) || 0) * 2) * halfExtents[2] + offsetZ,
|
|
8873
|
+
// );
|
|
8874
|
+
// update geometry's AABB
|
|
8959
8875
|
geometry.contentBounds.update(center,halfExtents);// @see https://github.molgen.mpg.de/git-mirror/cairo/blob/master/src/cairo-stroke-style.c#L97..L128
|
|
8960
8876
|
var expansion=object.nodeName===exports.Shape.POLYLINE||object.nodeName===exports.Shape.POLYGON||object.nodeName===exports.Shape.PATH?Math.SQRT2:0.5;// if (lineCap?.value === 'square') {
|
|
8961
8877
|
// expansion = Math.SQRT1_2;
|
|
@@ -8966,10 +8882,15 @@
|
|
|
8966
8882
|
// append border only if stroke existed
|
|
8967
8883
|
var hasStroke=stroke&&!stroke.isNone;if(hasStroke){var halfLineWidth=((lineWidth||0)+(increasedLineWidthForHitTesting||0))*expansion;// halfExtents[0] += halfLineWidth[0];
|
|
8968
8884
|
// halfExtents[1] += halfLineWidth[1];
|
|
8969
|
-
|
|
8885
|
+
halfExtents[0]+=halfLineWidth;halfExtents[1]+=halfLineWidth;// vec3.add(
|
|
8886
|
+
// halfExtents,
|
|
8887
|
+
// halfExtents,
|
|
8888
|
+
// vec3.set(tmpVec3c, halfLineWidth, halfLineWidth, 0),
|
|
8889
|
+
// );
|
|
8890
|
+
}geometry.renderBounds.update(center,halfExtents);// account for shadow, only support constant value now
|
|
8970
8891
|
if(shadowColor&&shadowType&&shadowType!=='inner'){var _geometry$renderBound=geometry.renderBounds,min=_geometry$renderBound.min,max=_geometry$renderBound.max;var shadowBlur=parsedStyle.shadowBlur,shadowOffsetX=parsedStyle.shadowOffsetX,shadowOffsetY=parsedStyle.shadowOffsetY;var shadowBlurInPixels=shadowBlur||0;var shadowOffsetXInPixels=shadowOffsetX||0;var shadowOffsetYInPixels=shadowOffsetY||0;var shadowLeft=min[0]-shadowBlurInPixels+shadowOffsetXInPixels;var shadowRight=max[0]+shadowBlurInPixels+shadowOffsetXInPixels;var shadowTop=min[1]-shadowBlurInPixels+shadowOffsetYInPixels;var shadowBottom=max[1]+shadowBlurInPixels+shadowOffsetYInPixels;min[0]=Math.min(min[0],shadowLeft);max[0]=Math.max(max[0],shadowRight);min[1]=Math.min(min[1],shadowTop);max[1]=Math.max(max[1],shadowBottom);geometry.renderBounds.setMinMax(min,max);}// account for filter, eg. blur(5px), drop-shadow()
|
|
8971
|
-
filter.forEach(function(_ref){var name=_ref.name,params=_ref.params;if(name==='blur'){var blurRadius=params[0].value;geometry.renderBounds.update(geometry.renderBounds.center,
|
|
8972
|
-
var usedOriginXValue=(flipY?-1:1)*convertPercentUnit(transformOrigin[0],0,object);var usedOriginYValue=(flipX?-1:1)*convertPercentUnit(transformOrigin[1],1,object);usedOriginXValue=usedOriginXValue-(flipY?-1:1)*(anchor&&anchor[0]||0)*geometry.contentBounds.halfExtents[0]*2;usedOriginYValue=usedOriginYValue-(flipX?-1:1)*(anchor&&anchor[1]||0)*geometry.contentBounds.halfExtents[1]*2;object.setOrigin(usedOriginXValue,usedOriginYValue);runtime.sceneGraphService.dirtifyToRoot(object);}};_proto.isPropertyInheritable=function isPropertyInheritable(name){var metadata=propertyMetadataCache[name];if(!metadata){return false;}return metadata.inh;};return DefaultStyleValueRegistry;}();/**
|
|
8892
|
+
filter.forEach(function(_ref){var name=_ref.name,params=_ref.params;if(name==='blur'){var blurRadius=params[0].value;geometry.renderBounds.update(geometry.renderBounds.center,addVec3(geometry.renderBounds.halfExtents,geometry.renderBounds.halfExtents,[blurRadius,blurRadius,0]));}else if(name==='drop-shadow'){var _shadowOffsetX=params[0].value;var _shadowOffsetY=params[1].value;var _shadowBlur=params[2].value;var _geometry$renderBound2=geometry.renderBounds,_min=_geometry$renderBound2.min,_max=_geometry$renderBound2.max;var _shadowLeft=_min[0]-_shadowBlur+_shadowOffsetX;var _shadowRight=_max[0]+_shadowBlur+_shadowOffsetX;var _shadowTop=_min[1]-_shadowBlur+_shadowOffsetY;var _shadowBottom=_max[1]+_shadowBlur+_shadowOffsetY;_min[0]=Math.min(_min[0],_shadowLeft);_max[0]=Math.max(_max[0],_shadowRight);_min[1]=Math.min(_min[1],_shadowTop);_max[1]=Math.max(_max[1],_shadowBottom);geometry.renderBounds.setMinMax(_min,_max);}});anchor=parsedStyle.anchor;// set transform origin
|
|
8893
|
+
var usedOriginXValue=(flipY?-1:1)*(transformOrigin?convertPercentUnit(transformOrigin[0],0,object):0);var usedOriginYValue=(flipX?-1:1)*(transformOrigin?convertPercentUnit(transformOrigin[1],1,object):0);usedOriginXValue=usedOriginXValue-(flipY?-1:1)*(anchor&&anchor[0]||0)*geometry.contentBounds.halfExtents[0]*2;usedOriginYValue=usedOriginYValue-(flipX?-1:1)*(anchor&&anchor[1]||0)*geometry.contentBounds.halfExtents[1]*2;object.setOrigin(usedOriginXValue,usedOriginYValue);runtime.sceneGraphService.dirtifyToRoot(object);}};_proto.isPropertyInheritable=function isPropertyInheritable(name){var metadata=propertyMetadataCache[name];if(!metadata){return false;}return metadata.inh;};return DefaultStyleValueRegistry;}();/**
|
|
8973
8894
|
* Different type of cameras, eg. simple camera used in 2D scene or
|
|
8974
8895
|
* advanced camera which can do actions & switch between landmarks.
|
|
8975
8896
|
*/(function(CameraType){/**
|
|
@@ -9170,9 +9091,9 @@
|
|
|
9170
9091
|
* - g-plugin-device-renderer `ctx.createLinearGradient` and generate texture
|
|
9171
9092
|
*
|
|
9172
9093
|
* @see https://blog.scottlogic.com/2020/03/19/offscreen-canvas.html
|
|
9173
|
-
*/var OffscreenCanvasCreator=/*#__PURE__*/function(){function OffscreenCanvasCreator(){this.canvas=void 0;this.context=void 0;}var _proto=OffscreenCanvasCreator.prototype;_proto.getOrCreateCanvas=function getOrCreateCanvas(offscreenCanvas){if(this.canvas){return this.canvas;}// user-defined offscreen canvas
|
|
9174
|
-
if(offscreenCanvas){this.canvas=offscreenCanvas;this.context=this.canvas.getContext('2d');}else {try{// OffscreenCanvas2D measureText can be up to 40% faster.
|
|
9175
|
-
this.canvas=new window.OffscreenCanvas(0,0);this.context=this.canvas.getContext('2d');if(!this.context||!this.context.measureText){this.canvas=document.createElement('canvas');this.context=this.canvas.getContext('2d');}}catch(ex){this.canvas=document.createElement('canvas');this.context=this.canvas.getContext('2d');}}this.canvas.width=10;this.canvas.height=10;return this.canvas;};_proto.getOrCreateContext=function getOrCreateContext(offscreenCanvas){if(this.context){return this.context;}this.getOrCreateCanvas(offscreenCanvas);return this.context;};return OffscreenCanvasCreator;}();/**
|
|
9094
|
+
*/var OffscreenCanvasCreator=/*#__PURE__*/function(){function OffscreenCanvasCreator(){this.canvas=void 0;this.context=void 0;}var _proto=OffscreenCanvasCreator.prototype;_proto.getOrCreateCanvas=function getOrCreateCanvas(offscreenCanvas,contextAttributes){if(this.canvas){return this.canvas;}// user-defined offscreen canvas
|
|
9095
|
+
if(offscreenCanvas){this.canvas=offscreenCanvas;this.context=this.canvas.getContext('2d',contextAttributes);}else {try{// OffscreenCanvas2D measureText can be up to 40% faster.
|
|
9096
|
+
this.canvas=new window.OffscreenCanvas(0,0);this.context=this.canvas.getContext('2d',contextAttributes);if(!this.context||!this.context.measureText){this.canvas=document.createElement('canvas');this.context=this.canvas.getContext('2d');}}catch(ex){this.canvas=document.createElement('canvas');this.context=this.canvas.getContext('2d',contextAttributes);}}this.canvas.width=10;this.canvas.height=10;return this.canvas;};_proto.getOrCreateContext=function getOrCreateContext(offscreenCanvas,contextAttributes){if(this.context){return this.context;}this.getOrCreateCanvas(offscreenCanvas,contextAttributes);return this.context;};return OffscreenCanvasCreator;}();/**
|
|
9176
9097
|
* why we need re-render
|
|
9177
9098
|
*/(function(RenderReason){RenderReason[RenderReason["CAMERA_CHANGED"]=0]="CAMERA_CHANGED";RenderReason[RenderReason["DISPLAY_OBJECT_CHANGED"]=1]="DISPLAY_OBJECT_CHANGED";RenderReason[RenderReason["NONE"]=2]="NONE";})(exports.RenderReason||(exports.RenderReason={}));/**
|
|
9178
9099
|
* Use frame renderer implemented by `g-canvas/svg/webgl`, in every frame we do followings:
|
|
@@ -9214,7 +9135,7 @@
|
|
|
9214
9135
|
* * camera changed
|
|
9215
9136
|
*/;_proto.disableDirtyRectangleRendering=function disableDirtyRectangleRendering(){var renderer=this.context.config.renderer;var _renderer$getConfig=renderer.getConfig(),enableDirtyRectangleRendering=_renderer$getConfig.enableDirtyRectangleRendering;return !enableDirtyRectangleRendering||this.context.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);};_proto.render=function render(canvasConfig,rerenderCallback){var _this=this;this.stats.total=0;this.stats.rendered=0;this.zIndexCounter=0;var renderingContext=this.context.renderingContext;this.globalRuntime.sceneGraphService.syncHierarchy(renderingContext.root);this.globalRuntime.sceneGraphService.triggerPendingEvents();if(renderingContext.renderReasons.size&&this.inited){this.renderDisplayObject(renderingContext.root,canvasConfig,renderingContext);this.hooks.beginFrame.call();renderingContext.renderListCurrentFrame.forEach(function(object){_this.hooks.beforeRender.call(object);_this.hooks.render.call(object);_this.hooks.afterRender.call(object);});this.hooks.endFrame.call();renderingContext.renderListCurrentFrame=[];renderingContext.renderReasons.clear();rerenderCallback();}// console.log('stats', this.stats);
|
|
9216
9137
|
};_proto.renderDisplayObject=function renderDisplayObject(displayObject,canvasConfig,renderingContext){var _this2=this;var _canvasConfig$rendere=canvasConfig.renderer.getConfig(),enableDirtyCheck=_canvasConfig$rendere.enableDirtyCheck,enableCulling=_canvasConfig$rendere.enableCulling;// recalc style values
|
|
9217
|
-
this.globalRuntime.styleValueRegistry.recalc(displayObject)
|
|
9138
|
+
if(this.globalRuntime.enableCSSParsing){this.globalRuntime.styleValueRegistry.recalc(displayObject);}// TODO: relayout
|
|
9218
9139
|
// dirtycheck first
|
|
9219
9140
|
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
|
|
9220
9141
|
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
|
|
@@ -9372,7 +9293,7 @@
|
|
|
9372
9293
|
* `g-camera-api` will provide an advanced implementation
|
|
9373
9294
|
*/runtime.CameraContribution=Camera;/**
|
|
9374
9295
|
* `g-web-animations-api` will provide an AnimationTimeline
|
|
9375
|
-
*/runtime.AnimationTimeline=null;runtime.EasingFunction=null;runtime.offscreenCanvas=new OffscreenCanvasCreator();runtime.displayObjectPool=new DisplayObjectPool();runtime.sceneGraphSelector=new DefaultSceneGraphSelector();runtime.sceneGraphService=new DefaultSceneGraphService(runtime);runtime.textService=new TextService(runtime);runtime.geometryUpdaterFactory=geometryUpdaterFactory;runtime.CSSPropertySyntaxFactory=CSSPropertySyntaxFactory;runtime.styleValueRegistry=new DefaultStyleValueRegistry();runtime.layoutRegistry=null;runtime.globalThis=getGlobalThis();var AbstractRendererPlugin=/*#__PURE__*/function(){function AbstractRendererPlugin(){this.context=void 0;this.plugins=[];}var _proto=AbstractRendererPlugin.prototype;_proto.addRenderingPlugin=function addRenderingPlugin(plugin){this.plugins.push(plugin);this.context.renderingPlugins.push(plugin);};_proto.removeAllRenderingPlugins=function removeAllRenderingPlugins(){var _this=this;this.plugins.forEach(function(plugin){var index=_this.context.renderingPlugins.indexOf(plugin);if(index>=0){_this.context.renderingPlugins.splice(index,1);}});};return AbstractRendererPlugin;}();var AbstractRenderer=/*#__PURE__*/function(){function AbstractRenderer(config){this.plugins=[];this.config=void 0;this.config=_extends({/**
|
|
9296
|
+
*/runtime.AnimationTimeline=null;runtime.EasingFunction=null;runtime.offscreenCanvas=new OffscreenCanvasCreator();runtime.displayObjectPool=new DisplayObjectPool();runtime.sceneGraphSelector=new DefaultSceneGraphSelector();runtime.sceneGraphService=new DefaultSceneGraphService(runtime);runtime.textService=new TextService(runtime);runtime.geometryUpdaterFactory=geometryUpdaterFactory;runtime.CSSPropertySyntaxFactory=CSSPropertySyntaxFactory;runtime.styleValueRegistry=new DefaultStyleValueRegistry();runtime.layoutRegistry=null;runtime.globalThis=getGlobalThis();runtime.enableCSSParsing=true;var AbstractRendererPlugin=/*#__PURE__*/function(){function AbstractRendererPlugin(){this.context=void 0;this.plugins=[];}var _proto=AbstractRendererPlugin.prototype;_proto.addRenderingPlugin=function addRenderingPlugin(plugin){this.plugins.push(plugin);this.context.renderingPlugins.push(plugin);};_proto.removeAllRenderingPlugins=function removeAllRenderingPlugins(){var _this=this;this.plugins.forEach(function(plugin){var index=_this.context.renderingPlugins.indexOf(plugin);if(index>=0){_this.context.renderingPlugins.splice(index,1);}});};return AbstractRendererPlugin;}();var AbstractRenderer=/*#__PURE__*/function(){function AbstractRenderer(config){this.plugins=[];this.config=void 0;this.config=_extends({/**
|
|
9376
9297
|
* only dirty object will cause re-render
|
|
9377
9298
|
*/enableDirtyCheck:true,enableCulling:false,/**
|
|
9378
9299
|
* enable auto rendering by default
|
|
@@ -9444,8 +9365,8 @@
|
|
|
9444
9365
|
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,继续检测下一个面
|
|
9445
9366
|
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;
|
|
9446
9367
|
_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[]);
|
|
9447
|
-
renderingService.dirtify();};var handleMounted=function handleMounted(e){var object=e.target
|
|
9448
|
-
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) {
|
|
9368
|
+
renderingService.dirtify();};var handleMounted=function handleMounted(e){var object=e.target;if(runtime.enableCSSParsing){// recalc style values
|
|
9369
|
+
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);_this.toSync.clear();});renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag,function(){// if (this.isFirstTimeRendering) {
|
|
9449
9370
|
// // @see https://github.com/antvis/G/issues/1117
|
|
9450
9371
|
// setTimeout(() => this.syncRTree());
|
|
9451
9372
|
// this.isFirstTimeRendering = false;
|