@antv/g 5.15.17 → 5.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.umd.js +56 -65
- package/dist/index.umd.min.js +1 -1
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -7420,7 +7420,7 @@
|
|
|
7420
7420
|
* eg. 'initial'
|
|
7421
7421
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSKeywordValue
|
|
7422
7422
|
* @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_keyword_value.idl
|
|
7423
|
-
*/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);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
|
|
7423
|
+
*/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);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();});});var kebabize=function kebabize(str){return str.split('').map(function(letter,idx){return letter.toUpperCase()===letter?""+(idx!==0?'-':'')+letter.toLowerCase():letter;}).join('');};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
|
|
7424
7424
|
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;});// type CSSNumericBaseType =
|
|
7425
7425
|
// | 'length'
|
|
7426
7426
|
// | 'angle'
|
|
@@ -8029,15 +8029,15 @@
|
|
|
8029
8029
|
*/var parseTransformOrigin=memoize(function(value){if(isString(value)){if(value==='text-anchor'){return [getOrCreateUnitValue(0,'px'),getOrCreateUnitValue(0,'px')];}var values=value.split(' ');if(values.length===1){if(values[0]==='top'||values[0]==='bottom'){// 'top' -> 'center top'
|
|
8030
8030
|
values[1]=values[0];values[0]='center';}else {// '50px' -> '50px center'
|
|
8031
8031
|
values[1]='center';}}if(values.length!==2){return null;}// eg. center bottom
|
|
8032
|
-
return [parseLengthOrPercentage(convertKeyword2Percent(values[0])),parseLengthOrPercentage(convertKeyword2Percent(values[1]))];}else {return [getOrCreateUnitValue(value[0]||0,'px'),getOrCreateUnitValue(value[1]||0,'px')];}});function convertKeyword2Percent(keyword){if(keyword==='center'){return '50%';}else if(keyword==='left'||keyword==='top'){return '0';}else if(keyword==='right'||keyword==='bottom'){return '100%';}return keyword;}var CSSPropertyAngle=/*#__PURE__*/function(){function CSSPropertyAngle(){this.parser=parseAngle;this.mixer=mergeNumbers;}var _proto=CSSPropertyAngle.prototype;_proto.calculator=function calculator(name,oldParsed,parsed,object){return convertAngleUnit(parsed);};return CSSPropertyAngle;}();/**
|
|
8032
|
+
return [parseLengthOrPercentage(convertKeyword2Percent(values[0])),parseLengthOrPercentage(convertKeyword2Percent(values[1]))];}else {return [getOrCreateUnitValue(value[0]||0,'px'),getOrCreateUnitValue(value[1]||0,'px')];}});function convertKeyword2Percent(keyword){if(keyword==='center'){return '50%';}else if(keyword==='left'||keyword==='top'){return '0';}else if(keyword==='right'||keyword==='bottom'){return '100%';}return keyword;}var CSSPropertyAngle=/*#__PURE__*/function(){function CSSPropertyAngle(){this.parser=parseAngle;this.parserWithCSSDisabled=null;this.mixer=mergeNumbers;}var _proto=CSSPropertyAngle.prototype;_proto.calculator=function calculator(name,oldParsed,parsed,object){return convertAngleUnit(parsed);};return CSSPropertyAngle;}();/**
|
|
8033
8033
|
* clipPath / textPath / offsetPath
|
|
8034
8034
|
*/var CSSPropertyClipPath=/*#__PURE__*/function(){function CSSPropertyClipPath(){}var _proto=CSSPropertyClipPath.prototype;_proto.calculator=function calculator(name,oldPath,newPath,object){// unset
|
|
8035
8035
|
if(newPath instanceof CSSKeywordValue){newPath=null;}runtime.sceneGraphService.updateDisplayObjectDependency(name,oldPath,newPath,object);if(name==='clipPath'){// should affect children
|
|
8036
|
-
object.forEach(function(leaf){if(leaf.childNodes.length===0){runtime.sceneGraphService.dirtifyToRoot(leaf);}});}return newPath;};return CSSPropertyClipPath;}();var CSSPropertyColor=/*#__PURE__*/function(){function CSSPropertyColor(){this.parser=parseColor;this.mixer=mergeColors;}var _proto=CSSPropertyColor.prototype;_proto.calculator=function calculator(name,oldParsed,parsed,object){if(parsed instanceof CSSKeywordValue){// 'unset' 'none'
|
|
8036
|
+
object.forEach(function(leaf){if(leaf.childNodes.length===0){runtime.sceneGraphService.dirtifyToRoot(leaf);}});}return newPath;};return CSSPropertyClipPath;}();var CSSPropertyColor=/*#__PURE__*/function(){function CSSPropertyColor(){this.parser=parseColor;this.parserWithCSSDisabled=parseColor;this.mixer=mergeColors;}var _proto=CSSPropertyColor.prototype;_proto.calculator=function calculator(name,oldParsed,parsed,object){if(parsed instanceof CSSKeywordValue){// 'unset' 'none'
|
|
8037
8037
|
return parsed.value==='none'?noneColor:transparentColor;}return parsed;};return CSSPropertyColor;}();var CSSPropertyFilter=/*#__PURE__*/function(){function CSSPropertyFilter(){this.parser=parseFilter;}var _proto=CSSPropertyFilter.prototype;_proto.calculator=function calculator(name,oldParsed,parsed){// unset or none
|
|
8038
8038
|
if(parsed instanceof CSSKeywordValue){return [];}return parsed;};return CSSPropertyFilter;}();function getFontSize(object){var fontSize=object.parsedStyle.fontSize;return isNil(fontSize)?null:fontSize;}/**
|
|
8039
8039
|
* <length> & <percentage>
|
|
8040
|
-
*/var CSSPropertyLengthOrPercentage=/*#__PURE__*/function(){function CSSPropertyLengthOrPercentage(){this.parser=parseLengthOrPercentage;this.mixer=mergeNumbers;}var _proto=CSSPropertyLengthOrPercentage.prototype;/**
|
|
8040
|
+
*/var CSSPropertyLengthOrPercentage=/*#__PURE__*/function(){function CSSPropertyLengthOrPercentage(){this.parser=parseLengthOrPercentage;this.parserWithCSSDisabled=null;this.mixer=mergeNumbers;}var _proto=CSSPropertyLengthOrPercentage.prototype;/**
|
|
8041
8041
|
* according to parent's bounds
|
|
8042
8042
|
*
|
|
8043
8043
|
* @example
|
|
@@ -8069,10 +8069,10 @@
|
|
|
8069
8069
|
if(needResetLocalPosition&&attributes.indexOf('transform')===-1){// account for current transform if needed
|
|
8070
8070
|
var transform=object.parsedStyle.transform;if(transform&&transform.length){parsedTransformToMat4(transform,object);}else {var _object$getLocalPosit=object.getLocalPosition(),ox=_object$getLocalPosit[0],oy=_object$getLocalPosit[1],oz=_object$getLocalPosit[2];object.setLocalPosition(isNil(x)?ox:x,isNil(y)?oy:y,isNil(z)?oz:z);}}};return CSSPropertyLocalPosition;}(CSSPropertyLengthOrPercentage);var CSSPropertyMarker=/*#__PURE__*/function(){function CSSPropertyMarker(){}var _proto=CSSPropertyMarker.prototype;_proto.calculator=function calculator(name,oldMarker,newMarker,object){var _newMarker;// unset
|
|
8071
8071
|
if(newMarker instanceof CSSKeywordValue){newMarker=null;}var cloned=(_newMarker=newMarker)===null||_newMarker===void 0?void 0:_newMarker.cloneNode(true);if(cloned){// FIXME: SVG should not inherit parent's style, add a flag here
|
|
8072
|
-
cloned.style.isMarker=true;}return cloned;};return CSSPropertyMarker;}();var CSSPropertyNumber=/*#__PURE__*/function(){function CSSPropertyNumber(){this.mixer=mergeNumbers;this.parser=parseNumber;}var _proto=CSSPropertyNumber.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};return CSSPropertyNumber;}();var CSSPropertyOffsetDistance=/*#__PURE__*/function(){function CSSPropertyOffsetDistance(){this.parser=parseNumber;this.mixer=clampedMergeNumbers(0,1);}var _proto=CSSPropertyOffsetDistance.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};_proto.postProcessor=function postProcessor(object){var _object$parsedStyle=object.parsedStyle,offsetPath=_object$parsedStyle.offsetPath,offsetDistance=_object$parsedStyle.offsetDistance;if(!offsetPath){return;}var nodeName=offsetPath.nodeName;if(nodeName===exports.Shape.LINE||nodeName===exports.Shape.PATH||nodeName===exports.Shape.POLYLINE){// set position in world space
|
|
8072
|
+
cloned.style.isMarker=true;}return cloned;};return CSSPropertyMarker;}();var CSSPropertyNumber=/*#__PURE__*/function(){function CSSPropertyNumber(){this.mixer=mergeNumbers;this.parser=parseNumber;this.parserWithCSSDisabled=null;}var _proto=CSSPropertyNumber.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};return CSSPropertyNumber;}();var CSSPropertyOffsetDistance=/*#__PURE__*/function(){function CSSPropertyOffsetDistance(){this.parser=parseNumber;this.parserWithCSSDisabled=null;this.mixer=clampedMergeNumbers(0,1);}var _proto=CSSPropertyOffsetDistance.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};_proto.postProcessor=function postProcessor(object){var _object$parsedStyle=object.parsedStyle,offsetPath=_object$parsedStyle.offsetPath,offsetDistance=_object$parsedStyle.offsetDistance;if(!offsetPath){return;}var nodeName=offsetPath.nodeName;if(nodeName===exports.Shape.LINE||nodeName===exports.Shape.PATH||nodeName===exports.Shape.POLYLINE){// set position in world space
|
|
8073
8073
|
var point=offsetPath.getPoint(offsetDistance);if(point){object.parsedStyle.defX=point.x;object.parsedStyle.defY=point.y;object.setLocalPosition(point.x,point.y);}}};return CSSPropertyOffsetDistance;}();/**
|
|
8074
8074
|
* opacity
|
|
8075
|
-
*/var CSSPropertyOpacity=/*#__PURE__*/function(){function CSSPropertyOpacity(){this.parser=parseNumber;this.mixer=clampedMergeNumbers(0,1);}var _proto=CSSPropertyOpacity.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};return CSSPropertyOpacity;}();var CSSPropertyPath=/*#__PURE__*/function(){function CSSPropertyPath(){this.parser=parsePath;this.mixer=mergePaths;}var _proto=CSSPropertyPath.prototype;_proto.calculator=function calculator(name,oldParsed,parsed){// unset
|
|
8075
|
+
*/var CSSPropertyOpacity=/*#__PURE__*/function(){function CSSPropertyOpacity(){this.parser=parseNumber;this.parserWithCSSDisabled=null;this.mixer=clampedMergeNumbers(0,1);}var _proto=CSSPropertyOpacity.prototype;_proto.calculator=function calculator(name,oldParsed,computed){return computed.value;};return CSSPropertyOpacity;}();var CSSPropertyPath=/*#__PURE__*/function(){function CSSPropertyPath(){this.parser=parsePath;this.parserWithCSSDisabled=parsePath;this.mixer=mergePaths;}var _proto=CSSPropertyPath.prototype;_proto.calculator=function calculator(name,oldParsed,parsed){// unset
|
|
8076
8076
|
if(parsed instanceof CSSKeywordValue&&parsed.value==='unset'){return {absolutePath:[],hasArc:false,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Rectangle(0,0,0,0)};}return parsed;};/**
|
|
8077
8077
|
* update local position
|
|
8078
8078
|
*/_proto.postProcessor=function postProcessor(object,attributes){if(object.nodeName===exports.Shape.PATH&&attributes.indexOf('transform')===-1){var _object$parsedStyle=object.parsedStyle,_object$parsedStyle$d=_object$parsedStyle.defX,defX=_object$parsedStyle$d===void 0?0:_object$parsedStyle$d,_object$parsedStyle$d2=_object$parsedStyle.defY,defY=_object$parsedStyle$d2===void 0?0:_object$parsedStyle$d2;object.setLocalPosition(defX,defY);}};return CSSPropertyPath;}();var CSSPropertyPoints=/*#__PURE__*/function(){function CSSPropertyPoints(){this.parser=parsePoints;}var _proto=CSSPropertyPoints.prototype;/**
|
|
@@ -8110,7 +8110,7 @@
|
|
|
8110
8110
|
* * matrix/matrix3d()
|
|
8111
8111
|
* * skew/skewX/skewY
|
|
8112
8112
|
* * perspective
|
|
8113
|
-
*/var CSSPropertyTransform=/*#__PURE__*/function(){function CSSPropertyTransform(){this.parser=parseTransform;this.mixer=mergeTransforms;}var _proto=CSSPropertyTransform.prototype;_proto.calculator=function calculator(name,oldParsed,parsed,object){// 'none'
|
|
8113
|
+
*/var CSSPropertyTransform=/*#__PURE__*/function(){function CSSPropertyTransform(){this.parser=parseTransform;this.parserWithCSSDisabled=parseTransform;this.mixer=mergeTransforms;}var _proto=CSSPropertyTransform.prototype;_proto.calculator=function calculator(name,oldParsed,parsed,object){// 'none'
|
|
8114
8114
|
if(parsed instanceof CSSKeywordValue){return [];}return parsed;};_proto.postProcessor=function postProcessor(object){var transform=object.parsedStyle.transform;parsedTransformToMat4(transform,object);};return CSSPropertyTransform;}();/**
|
|
8115
8115
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
|
|
8116
8116
|
* @example
|
|
@@ -8445,8 +8445,8 @@
|
|
|
8445
8445
|
* which can lead to unintended consequences if an attempt is made to cache the entire event object.
|
|
8446
8446
|
*
|
|
8447
8447
|
* 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.
|
|
8448
|
-
*/;_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
|
|
8449
|
-
});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']);/**
|
|
8448
|
+
*/;_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',miterLimit:10};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
|
|
8449
|
+
});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']);var DATASET_PREFIX='data-';/**
|
|
8450
8450
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
8451
8451
|
*
|
|
8452
8452
|
* mixins: Animatable, Transformable, Visible
|
|
@@ -8467,9 +8467,15 @@
|
|
|
8467
8467
|
* contains style props in constructor's params, eg. fill, stroke...
|
|
8468
8468
|
*/ /**
|
|
8469
8469
|
* push to active animations after calling `animate()`
|
|
8470
|
+
*/ /**
|
|
8471
|
+
* Use data-* attribute.
|
|
8472
|
+
* @see https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
|
|
8473
|
+
* @example
|
|
8474
|
+
* group.dataset.prop1 = 1;
|
|
8475
|
+
* group.getAttribute('data-prop1'); // 1
|
|
8470
8476
|
*/function DisplayObject(config){var _this$config$capture;var _this;_this=_Element.call(this)||this;// assign name, id to config
|
|
8471
8477
|
// eg. group.get('name')
|
|
8472
|
-
_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
|
|
8478
|
+
_this.config=void 0;_this.isCustomElement=false;_this.isMutationObserved=false;_this.activeAnimations=[];_this.dataset=void 0;_this.getClip=function(){return this.style.clipPath||null;};_this.config=config;// compatible with G 3.0
|
|
8473
8479
|
_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
|
|
8474
8480
|
_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
|
|
8475
8481
|
_this.config.style=_this.config.style||_this.config.attrs||{};Object.assign(_this.config.style,_this.config.attrs);// this.config.style = {
|
|
@@ -8479,7 +8485,7 @@
|
|
|
8479
8485
|
// };
|
|
8480
8486
|
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
|
|
8481
8487
|
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
|
|
8482
|
-
_this.initAttributes(_this.config.style);_this.style=new Proxy(// @ts-ignore
|
|
8488
|
+
_this.initAttributes(_this.config.style);_this.dataset=new Proxy({},{get:function get(target,name){var formattedName=""+DATASET_PREFIX+kebabize(name);if(target[formattedName]!==undefined){return target[formattedName];}return _this.getAttribute(formattedName);},set:function set(_,prop,value){_this.setAttribute(""+DATASET_PREFIX+kebabize(prop),value);return true;}});_this.style=new Proxy(// @ts-ignore
|
|
8483
8489
|
{// ...this.attributes,
|
|
8484
8490
|
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) {
|
|
8485
8491
|
return target[name];}return _this.getAttribute(name);},set:function set(_,prop,value){_this.setAttribute(prop,value);return true;}});// insert this group into pool
|
|
@@ -8629,14 +8635,14 @@
|
|
|
8629
8635
|
*/;_proto.move=function move(position,y,z){if(y===void 0){y=0;}if(z===void 0){z=0;}this.setPosition(position,y,z);return this;}/**
|
|
8630
8636
|
* Use `this.style.zIndex` instead.
|
|
8631
8637
|
* @deprecated
|
|
8632
|
-
*/;_proto.setZIndex=function setZIndex(zIndex){this.style.zIndex=zIndex;return this;};_createClass(DisplayObject,[{key:"interactive",get:function get(){return this.isInteractive();},set:function set(b){this.style.pointerEvents=b?'auto':'none';}}]);return DisplayObject;}(Element);var _excluded=["style"];var Circle=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Circle,_DisplayObject);function Circle(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded);return _DisplayObject.call(this,_extends({type:exports.Shape.CIRCLE,style:_extends({cx:'',cy:'',r:''},style),initialParsedStyle:{anchor:[0.5,0.5],transformOrigin:runtime.enableCSSParsing?null:[getOrCreateUnitValue(50,'%'),getOrCreateUnitValue(50,'%')]}},rest))||this;}return Circle;}(DisplayObject);var _excluded$1=["style"];/**
|
|
8638
|
+
*/;_proto.setZIndex=function setZIndex(zIndex){this.style.zIndex=zIndex;return this;};_createClass(DisplayObject,[{key:"interactive",get:function get(){return this.isInteractive();},set:function set(b){this.style.pointerEvents=b?'auto':'none';}}]);return DisplayObject;}(Element);var _excluded=["style"];var Circle=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Circle,_DisplayObject);function Circle(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded);return _DisplayObject.call(this,_extends({type:exports.Shape.CIRCLE,style:runtime.enableCSSParsing?_extends({cx:'',cy:'',r:''},style):_extends({},style),initialParsedStyle:{anchor:[0.5,0.5],transformOrigin:runtime.enableCSSParsing?null:[getOrCreateUnitValue(50,'%'),getOrCreateUnitValue(50,'%')]}},rest))||this;}return Circle;}(DisplayObject);var _excluded$1=["style"];/**
|
|
8633
8639
|
* shadow root
|
|
8634
8640
|
* @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
|
|
8635
8641
|
*/var CustomElement=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(CustomElement,_DisplayObject);// static get observedAttributes(): string[] {
|
|
8636
8642
|
// return [];
|
|
8637
8643
|
// }
|
|
8638
8644
|
// private shadowNodes: DisplayObject[] = [];
|
|
8639
|
-
function CustomElement(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$1);_this=_DisplayObject.call(this,_extends({style:_extends({x:'',y:''},style)},rest))||this;_this.isCustomElement=true;return _this;}return CustomElement;}(DisplayObject);var pool={};var htmlPool=[];var DisplayObjectPool=/*#__PURE__*/function(){function DisplayObjectPool(){}var _proto=DisplayObjectPool.prototype;_proto.getByEntity=function getByEntity(entity){return pool[entity];};_proto.getAll=function getAll(){return Object.keys(pool).map(function(entity){return pool[entity];});};_proto.add=function add(entity,groupOrShape){pool[entity]=groupOrShape;if(groupOrShape.nodeName===exports.Shape.HTML){htmlPool.push(groupOrShape);}};_proto.remove=function remove(entity){var existed=pool[entity];if(existed){delete pool[entity];if(existed.nodeName===exports.Shape.HTML){var index=htmlPool.indexOf(existed);htmlPool.splice(index,1);}}};_proto.getHTMLs=function getHTMLs(){return htmlPool;};return DisplayObjectPool;}();var _excluded$2=["style"];var Ellipse=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Ellipse,_DisplayObject);function Ellipse(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$2);return _DisplayObject.call(this,_extends({type:exports.Shape.ELLIPSE,style:_extends({cx:'',cy:'',rx:'',ry:''},style),initialParsedStyle:{anchor:[0.5,0.5],transformOrigin:runtime.enableCSSParsing?null:[getOrCreateUnitValue(50,'%'),getOrCreateUnitValue(50,'%')]}},rest))||this;}return Ellipse;}(DisplayObject);var _excluded$3=["style"];/**
|
|
8645
|
+
function CustomElement(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$1);_this=_DisplayObject.call(this,runtime.enableCSSParsing?_extends({style:_extends({x:'',y:''},style)},rest):_extends({},style))||this;_this.isCustomElement=true;return _this;}return CustomElement;}(DisplayObject);var pool={};var htmlPool=[];var DisplayObjectPool=/*#__PURE__*/function(){function DisplayObjectPool(){}var _proto=DisplayObjectPool.prototype;_proto.getByEntity=function getByEntity(entity){return pool[entity];};_proto.getAll=function getAll(){return Object.keys(pool).map(function(entity){return pool[entity];});};_proto.add=function add(entity,groupOrShape){pool[entity]=groupOrShape;if(groupOrShape.nodeName===exports.Shape.HTML){htmlPool.push(groupOrShape);}};_proto.remove=function remove(entity){var existed=pool[entity];if(existed){delete pool[entity];if(existed.nodeName===exports.Shape.HTML){var index=htmlPool.indexOf(existed);htmlPool.splice(index,1);}}};_proto.getHTMLs=function getHTMLs(){return htmlPool;};return DisplayObjectPool;}();var _excluded$2=["style"];var Ellipse=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Ellipse,_DisplayObject);function Ellipse(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$2);return _DisplayObject.call(this,_extends({type:exports.Shape.ELLIPSE,style:runtime.enableCSSParsing?_extends({cx:'',cy:'',rx:'',ry:''},style):_extends({},style),initialParsedStyle:{anchor:[0.5,0.5],transformOrigin:runtime.enableCSSParsing?null:[getOrCreateUnitValue(50,'%'),getOrCreateUnitValue(50,'%')]}},rest))||this;}return Ellipse;}(DisplayObject);var _excluded$3=["style"];/**
|
|
8640
8646
|
* its attributes are inherited by its children.
|
|
8641
8647
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/g
|
|
8642
8648
|
*
|
|
@@ -8645,10 +8651,10 @@
|
|
|
8645
8651
|
<circle cx="40" cy="40" r="25" />
|
|
8646
8652
|
<circle cx="60" cy="60" r="25" />
|
|
8647
8653
|
</g>
|
|
8648
|
-
*/var Group=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Group,_DisplayObject);function Group(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$3);return _DisplayObject.call(this,_extends({type:exports.Shape.GROUP,style:_extends({x:'',y:'',width:'',height:''},style)},rest))||this;}return Group;}(DisplayObject);var _excluded$4=["style"];/**
|
|
8654
|
+
*/var Group=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Group,_DisplayObject);function Group(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$3);return _DisplayObject.call(this,_extends({type:exports.Shape.GROUP,style:runtime.enableCSSParsing?_extends({x:'',y:'',width:'',height:''},style):_extends({},style)},rest))||this;}return Group;}(DisplayObject);var _excluded$4=["style"];/**
|
|
8649
8655
|
* HTML container
|
|
8650
8656
|
* @see https://github.com/pmndrs/drei#html
|
|
8651
|
-
*/var HTML=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(HTML,_DisplayObject);function HTML(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$4);_this=_DisplayObject.call(this,_extends({type:exports.Shape.HTML,style:_extends({x:'',y:'',width:'auto',height:'auto',innerHTML:''},style)},rest))||this;_this.cullable.enable=false;return _this;}/**
|
|
8657
|
+
*/var HTML=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(HTML,_DisplayObject);function HTML(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$4);_this=_DisplayObject.call(this,_extends({type:exports.Shape.HTML,style:runtime.enableCSSParsing?_extends({x:'',y:'',width:'auto',height:'auto',innerHTML:''},style):_extends({},style)},rest))||this;_this.cullable.enable=false;return _this;}/**
|
|
8652
8658
|
* return wrapper HTMLElement
|
|
8653
8659
|
* * <div> in g-webgl/canvas
|
|
8654
8660
|
* * <foreignObject> in g-svg
|
|
@@ -8673,7 +8679,7 @@
|
|
|
8673
8679
|
return new Point(transformed[0],transformed[1]);};_proto.getPointAtLength=function getPointAtLength(distance,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}return this.getPoint(distance/this.getTotalLength(),inWorldSpace);};_proto.getTotalLength=function getTotalLength(){// TODO: account for z1/z2 in 3D line
|
|
8674
8680
|
var _this$parsedStyle4=this.parsedStyle,x1=_this$parsedStyle4.x1,y1=_this$parsedStyle4.y1,x2=_this$parsedStyle4.x2,y2=_this$parsedStyle4.y2;return line.length(x1,y1,x2,y2);};return Line;}(DisplayObject);var _excluded$7=["style"];var EMPTY_PARSED_PATH={absolutePath:[],hasArc:false,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Rectangle(0,0,0,0)};var Path=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Path,_DisplayObject);/**
|
|
8675
8681
|
* markers placed at the mid
|
|
8676
|
-
*/function Path(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$7);_this=_DisplayObject.call(this,_extends({type:exports.Shape.PATH,style:_extends({path:'',miterLimit:''},style),initialParsedStyle:runtime.enableCSSParsing?null:{path:_extends({},EMPTY_PARSED_PATH)}},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;_this.markerMidList=[];var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd,markerMid=_this$parsedStyle.markerMid;if(markerStart&&isDisplayObject(markerStart)){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerMid&&isDisplayObject(markerMid)){_this.placeMarkerMid(markerMid);}if(markerEnd&&isDisplayObject(markerEnd)){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Path.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='path'){// recalc markers
|
|
8682
|
+
*/function Path(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$7);_this=_DisplayObject.call(this,_extends({type:exports.Shape.PATH,style:_extends({path:'',miterLimit:''},style),initialParsedStyle:runtime.enableCSSParsing?null:{miterLimit:4,path:_extends({},EMPTY_PARSED_PATH)}},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;_this.markerMidList=[];var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd,markerMid=_this$parsedStyle.markerMid;if(markerStart&&isDisplayObject(markerStart)){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerMid&&isDisplayObject(markerMid)){_this.placeMarkerMid(markerMid);}if(markerEnd&&isDisplayObject(markerEnd)){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Path.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='path'){// recalc markers
|
|
8677
8683
|
this.transformMarker(true);this.transformMarker(false);this.placeMarkerMid(this.parsedStyle.markerMid);}else if(attrName==='markerStartOffset'||attrName==='markerEndOffset'){this.transformMarker(true);this.transformMarker(false);}else if(attrName==='markerStart'){if(prevParsedValue&&isDisplayObject(prevParsedValue)){this.markerStartAngle=0;prevParsedValue.remove();}// CSSKeyword 'unset'
|
|
8678
8684
|
if(newParsedValue&&isDisplayObject(newParsedValue)){this.markerStartAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(true);}}else if(attrName==='markerEnd'){if(prevParsedValue&&isDisplayObject(prevParsedValue)){this.markerEndAngle=0;prevParsedValue.remove();}if(newParsedValue&&isDisplayObject(newParsedValue)){this.markerEndAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(false);}}else if(attrName==='markerMid'){this.placeMarkerMid(newParsedValue);}};_proto.transformMarker=function transformMarker(isStart){var _this$parsedStyle2=this.parsedStyle,markerStart=_this$parsedStyle2.markerStart,markerEnd=_this$parsedStyle2.markerEnd,markerStartOffset=_this$parsedStyle2.markerStartOffset,markerEndOffset=_this$parsedStyle2.markerEndOffset,defX=_this$parsedStyle2.defX,defY=_this$parsedStyle2.defY;var marker=isStart?markerStart:markerEnd;if(!marker||!isDisplayObject(marker)){return;}var rad=0;var x;var y;var ox;var oy;var offset;var originalAngle;if(isStart){var _this$getStartTangent=this.getStartTangent(),p1=_this$getStartTangent[0],p2=_this$getStartTangent[1];ox=p2[0]-defX;oy=p2[1]-defY;x=p1[0]-p2[0];y=p1[1]-p2[1];offset=markerStartOffset||0;originalAngle=this.markerStartAngle;}else {var _this$getEndTangent=this.getEndTangent(),_p=_this$getEndTangent[0],_p2=_this$getEndTangent[1];ox=_p2[0]-defX;oy=_p2[1]-defY;x=_p[0]-_p2[0];y=_p[1]-_p2[1];offset=markerEndOffset||0;originalAngle=this.markerEndAngle;}rad=Math.atan2(y,x);// account for markerOffset
|
|
8679
8685
|
marker.setLocalEulerAngles(rad*180/Math.PI+originalAngle);marker.setLocalPosition(ox+Math.cos(rad)*offset,oy+Math.sin(rad)*offset);};_proto.placeMarkerMid=function placeMarkerMid(marker){var _this$parsedStyle3=this.parsedStyle,segments=_this$parsedStyle3.path.segments,defX=_this$parsedStyle3.defX,defY=_this$parsedStyle3.defY;// clear all existed markers
|
|
@@ -8693,14 +8699,14 @@
|
|
|
8693
8699
|
* Get end tangent vector
|
|
8694
8700
|
*/;_proto.getEndTangent=function getEndTangent(){var segments=this.parsedStyle.path.segments;var length=segments.length;var result=[];if(length>1){var startPoint=segments[length-2].currentPoint;var endPoint=segments[length-1].currentPoint;var tangent=segments[length-1].endTangent;result=[];if(tangent){result.push([endPoint[0]-tangent[0],endPoint[1]-tangent[1]]);result.push([endPoint[0],endPoint[1]]);}else {result.push([startPoint[0],startPoint[1]]);result.push([endPoint[0],endPoint[1]]);}}return result;};return Path;}(DisplayObject);var _excluded$8=["style"];var Polygon=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Polygon,_DisplayObject);/**
|
|
8695
8701
|
* markers placed at the mid
|
|
8696
|
-
*/function Polygon(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$8);_this=_DisplayObject.call(this,_extends({type:exports.Shape.POLYGON,style:_extends({points:'',miterLimit:'',isClosed:true},style)},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;_this.markerMidList=[];var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd,markerMid=_this$parsedStyle.markerMid;if(markerStart&&isDisplayObject(markerStart)){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerMid&&isDisplayObject(markerMid)){_this.placeMarkerMid(markerMid);}if(markerEnd&&isDisplayObject(markerEnd)){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Polygon.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='points'){// recalc markers
|
|
8702
|
+
*/function Polygon(_temp){var _this;var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$8);_this=_DisplayObject.call(this,_extends({type:exports.Shape.POLYGON,style:_extends({points:'',miterLimit:'',isClosed:true},style),initialParsedStyle:runtime.enableCSSParsing?null:{miterLimit:4}},rest))||this;_this.markerStartAngle=0;_this.markerEndAngle=0;_this.markerMidList=[];var _this$parsedStyle=_this.parsedStyle,markerStart=_this$parsedStyle.markerStart,markerEnd=_this$parsedStyle.markerEnd,markerMid=_this$parsedStyle.markerMid;if(markerStart&&isDisplayObject(markerStart)){_this.markerStartAngle=markerStart.getLocalEulerAngles();_this.appendChild(markerStart);}if(markerMid&&isDisplayObject(markerMid)){_this.placeMarkerMid(markerMid);}if(markerEnd&&isDisplayObject(markerEnd)){_this.markerEndAngle=markerEnd.getLocalEulerAngles();_this.appendChild(markerEnd);}_this.transformMarker(true);_this.transformMarker(false);return _this;}var _proto=Polygon.prototype;_proto.attributeChangedCallback=function attributeChangedCallback(attrName,oldValue,newValue,prevParsedValue,newParsedValue){if(attrName==='points'){// recalc markers
|
|
8697
8703
|
this.transformMarker(true);this.transformMarker(false);this.placeMarkerMid(this.parsedStyle.markerMid);}else if(attrName==='markerStartOffset'||attrName==='markerEndOffset'){this.transformMarker(true);this.transformMarker(false);}else if(attrName==='markerStart'){if(prevParsedValue&&isDisplayObject(prevParsedValue)){this.markerStartAngle=0;prevParsedValue.remove();}// CSSKeyword 'unset'
|
|
8698
8704
|
if(newParsedValue&&isDisplayObject(newParsedValue)){this.markerStartAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(true);}}else if(attrName==='markerEnd'){if(prevParsedValue&&isDisplayObject(prevParsedValue)){this.markerEndAngle=0;prevParsedValue.remove();}if(newParsedValue&&isDisplayObject(newParsedValue)){this.markerEndAngle=newParsedValue.getLocalEulerAngles();this.appendChild(newParsedValue);this.transformMarker(false);}}else if(attrName==='markerMid'){this.placeMarkerMid(newParsedValue);}};_proto.transformMarker=function transformMarker(isStart){var _this$parsedStyle2=this.parsedStyle,markerStart=_this$parsedStyle2.markerStart,markerEnd=_this$parsedStyle2.markerEnd,markerStartOffset=_this$parsedStyle2.markerStartOffset,markerEndOffset=_this$parsedStyle2.markerEndOffset,points=_this$parsedStyle2.points.points,defX=_this$parsedStyle2.defX,defY=_this$parsedStyle2.defY;var marker=isStart?markerStart:markerEnd;if(!marker||!isDisplayObject(marker)){return;}var rad=0;var x;var y;var ox;var oy;var offset;var originalAngle;ox=points[0][0]-defX;oy=points[0][1]-defY;if(isStart){x=points[1][0]-points[0][0];y=points[1][1]-points[0][1];offset=markerStartOffset||0;originalAngle=this.markerStartAngle;}else {var length=points.length;if(!this.style.isClosed){ox=points[length-1][0]-defX;oy=points[length-1][1]-defY;x=points[length-2][0]-points[length-1][0];y=points[length-2][1]-points[length-1][1];}else {x=points[length-1][0]-points[0][0];y=points[length-1][1]-points[0][1];}offset=markerEndOffset||0;originalAngle=this.markerEndAngle;}rad=Math.atan2(y,x);// account for markerOffset
|
|
8699
8705
|
marker.setLocalEulerAngles(rad*180/Math.PI+originalAngle);marker.setLocalPosition(ox+Math.cos(rad)*offset,oy+Math.sin(rad)*offset);};_proto.placeMarkerMid=function placeMarkerMid(marker){var _this$parsedStyle3=this.parsedStyle,points=_this$parsedStyle3.points.points,defX=_this$parsedStyle3.defX,defY=_this$parsedStyle3.defY;// clear all existed markers
|
|
8700
8706
|
this.markerMidList.forEach(function(marker){marker.remove();});this.markerMidList=[];if(marker&&isDisplayObject(marker)){for(var i=1;i<(this.style.isClosed?points.length:points.length-1);i++){var ox=points[i][0]-defX;var oy=points[i][1]-defY;var cloned=i===1?marker:marker.cloneNode(true);this.markerMidList.push(cloned);this.appendChild(cloned);cloned.setLocalPosition(ox,oy);// TODO: orient of marker
|
|
8701
8707
|
}}};return Polygon;}(DisplayObject);var _excluded$9=["style"];/**
|
|
8702
8708
|
* Polyline inherits the marker-related capabilities of Polygon.
|
|
8703
|
-
*/var Polyline=/*#__PURE__*/function(_Polygon){_inheritsLoose(Polyline,_Polygon);function Polyline(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$9);return _Polygon.call(this,_extends({type:exports.Shape.POLYLINE,style:_extends({points:'',miterLimit:'',isClosed:false},style)},rest))||this;}var _proto=Polyline.prototype;_proto.getTotalLength=function getTotalLength(){return this.parsedStyle.points.totalLength;};_proto.getPointAtLength=function getPointAtLength(distance,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}return this.getPoint(distance/this.getTotalLength(),inWorldSpace);};_proto.getPoint=function getPoint(ratio,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}var _this$parsedStyle=this.parsedStyle,defX=_this$parsedStyle.defX,defY=_this$parsedStyle.defY,_this$parsedStyle$poi=_this$parsedStyle.points,points=_this$parsedStyle$poi.points,segments=_this$parsedStyle$poi.segments;var subt=0;var index=0;segments.forEach(function(v,i){if(ratio>=v[0]&&ratio<=v[1]){subt=(ratio-v[0])/(v[1]-v[0]);index=i;}});var _LineUtil$pointAt=line.pointAt(points[index][0],points[index][1],points[index+1][0],points[index+1][1],subt),x=_LineUtil$pointAt.x,y=_LineUtil$pointAt.y;var transformed=transformMat4(create$2(),fromValues$2(x-defX,y-defY,0),inWorldSpace?this.getWorldTransform():this.getLocalTransform());// apply local transformation
|
|
8709
|
+
*/var Polyline=/*#__PURE__*/function(_Polygon){_inheritsLoose(Polyline,_Polygon);function Polyline(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$9);return _Polygon.call(this,_extends({type:exports.Shape.POLYLINE,style:_extends({points:'',miterLimit:'',isClosed:false},style),initialParsedStyle:runtime.enableCSSParsing?null:{miterLimit:4}},rest))||this;}var _proto=Polyline.prototype;_proto.getTotalLength=function getTotalLength(){return this.parsedStyle.points.totalLength;};_proto.getPointAtLength=function getPointAtLength(distance,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}return this.getPoint(distance/this.getTotalLength(),inWorldSpace);};_proto.getPoint=function getPoint(ratio,inWorldSpace){if(inWorldSpace===void 0){inWorldSpace=false;}var _this$parsedStyle=this.parsedStyle,defX=_this$parsedStyle.defX,defY=_this$parsedStyle.defY,_this$parsedStyle$poi=_this$parsedStyle.points,points=_this$parsedStyle$poi.points,segments=_this$parsedStyle$poi.segments;var subt=0;var index=0;segments.forEach(function(v,i){if(ratio>=v[0]&&ratio<=v[1]){subt=(ratio-v[0])/(v[1]-v[0]);index=i;}});var _LineUtil$pointAt=line.pointAt(points[index][0],points[index][1],points[index+1][0],points[index+1][1],subt),x=_LineUtil$pointAt.x,y=_LineUtil$pointAt.y;var transformed=transformMat4(create$2(),fromValues$2(x-defX,y-defY,0),inWorldSpace?this.getWorldTransform():this.getLocalTransform());// apply local transformation
|
|
8704
8710
|
return new Point(transformed[0],transformed[1]);};_proto.getStartTangent=function getStartTangent(){var points=this.parsedStyle.points.points;var result=[];result.push([points[1][0],points[1][1]]);result.push([points[0][0],points[0][1]]);return result;};_proto.getEndTangent=function getEndTangent(){var points=this.parsedStyle.points.points;var l=points.length-1;var result=[];result.push([points[l-1][0],points[l-1][1]]);result.push([points[l][0],points[l][1]]);return result;};return Polyline;}(Polygon);var _excluded$a=["style"];var Rect=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Rect,_DisplayObject);function Rect(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$a);return _DisplayObject.call(this,_extends({type:exports.Shape.RECT,style:_extends({x:'',y:'',width:'',height:'',radius:''},style)},rest))||this;}return Rect;}(DisplayObject);var _excluded$b=["style"];/**
|
|
8705
8711
|
* <text> @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextElement
|
|
8706
8712
|
*/var Text=/*#__PURE__*/function(_DisplayObject){_inheritsLoose(Text,_DisplayObject);/**
|
|
@@ -8709,7 +8715,7 @@
|
|
|
8709
8715
|
// LENGTHADJUST_SPACINGANDGLYPHS: number = 2;
|
|
8710
8716
|
// LENGTHADJUST_UNKNOWN: number = 0;
|
|
8711
8717
|
function Text(_temp){var _ref=_temp===void 0?{}:_temp,style=_ref.style,rest=_objectWithoutPropertiesLoose(_ref,_excluded$b);return _DisplayObject.call(this,_extends({type:exports.Shape.TEXT,style:runtime.enableCSSParsing?_extends({x:'',y:'',text:'',fontSize:'',fontFamily:'',fontStyle:'',fontWeight:'',fontVariant:'',textAlign:'',textBaseline:'',textTransform:'',fill:'black',letterSpacing:'',lineHeight:'',miterLimit:'',// whiteSpace: 'pre',
|
|
8712
|
-
wordWrap:false,wordWrapWidth:0,leading:0,dx:'',dy:''},style):_extends({},style),initialParsedStyle:runtime.enableCSSParsing?{}:{
|
|
8718
|
+
wordWrap:false,wordWrapWidth:0,leading:0,dx:'',dy:''},style):_extends({fill:'black'},style),initialParsedStyle:runtime.enableCSSParsing?{}:{x:0,y:0,fontSize:16,fontFamily:'sans-serif',fontStyle:'normal',fontWeight:'normal',fontVariant:'normal',lineHeight:0,letterSpacing:0,textBaseline:'alphabetic',textAlign:'start',wordWrap:false,wordWrapWidth:0,leading:0,dx:0,dy:0}},rest))||this;}// lengthAdjust: SVGAnimatedEnumeration;
|
|
8713
8719
|
// textLength: SVGAnimatedLength;
|
|
8714
8720
|
// getCharNumAtPosition(point?: DOMPointInit): number {
|
|
8715
8721
|
// throw new Error('Method not implemented.');
|
|
@@ -8811,10 +8817,10 @@
|
|
|
8811
8817
|
attributes.textAlign=attributes.textAnchor;}Object.assign(object.attributes,attributes);var _attributeNames=Object.keys(attributes);// clipPath
|
|
8812
8818
|
var oldClipPath=object.parsedStyle.clipPath;var oldOffsetPath=object.parsedStyle.offsetPath;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);}if(attributes.shadowColor){object.parsedStyle.shadowColor=parseColor(attributes.shadowColor);}if(attributes.filter){object.parsedStyle.filter=parseFilter(attributes.filter);}// Rect
|
|
8813
8819
|
// @ts-ignore
|
|
8814
|
-
if(attributes.radius){// @ts-ignore
|
|
8820
|
+
if(!isNil(attributes.radius)){// @ts-ignore
|
|
8815
8821
|
object.parsedStyle.radius=parseDimensionArrayFormat(// @ts-ignore
|
|
8816
8822
|
attributes.radius,4);}// Polyline
|
|
8817
|
-
if(attributes.lineDash){object.parsedStyle.lineDash=parseDimensionArrayFormat(attributes.lineDash,2);}// @ts-ignore
|
|
8823
|
+
if(!isNil(attributes.lineDash)){object.parsedStyle.lineDash=parseDimensionArrayFormat(attributes.lineDash,2);}// @ts-ignore
|
|
8818
8824
|
if(attributes.points){// @ts-ignore
|
|
8819
8825
|
object.parsedStyle.points=parsePoints(attributes.points,object);}// Path
|
|
8820
8826
|
// @ts-ignore
|
|
@@ -8835,20 +8841,22 @@
|
|
|
8835
8841
|
if(attributes.markerMid){// @ts-ignore
|
|
8836
8842
|
object.parsedStyle.markerMid=runtime.CSSPropertySyntaxFactory['<marker>'].calculator('',// @ts-ignore
|
|
8837
8843
|
attributes.markerMid,// @ts-ignore
|
|
8838
|
-
attributes.markerMid,null,null);}if(//
|
|
8839
|
-
|
|
8840
|
-
attributes.
|
|
8841
|
-
attributes.
|
|
8842
|
-
attributes.
|
|
8843
|
-
attributes.
|
|
8844
|
-
attributes.
|
|
8845
|
-
|
|
8846
|
-
attributes.
|
|
8847
|
-
attributes.
|
|
8848
|
-
attributes.
|
|
8849
|
-
|
|
8844
|
+
attributes.markerMid,null,null);}if(// Circle & Ellipse
|
|
8845
|
+
(object.nodeName===exports.Shape.CIRCLE||object.nodeName===exports.Shape.ELLIPSE)&&(// @ts-ignore
|
|
8846
|
+
!isNil(attributes.cx)||// @ts-ignore
|
|
8847
|
+
!isNil(attributes.cy))||(object.nodeName===exports.Shape.RECT||object.nodeName===exports.Shape.IMAGE||object.nodeName===exports.Shape.GROUP||object.nodeName===exports.Shape.HTML||object.nodeName===exports.Shape.TEXT||object.nodeName===exports.Shape.MESH)&&(// @ts-ignore
|
|
8848
|
+
!isNil(attributes.x)||// @ts-ignore
|
|
8849
|
+
!isNil(attributes.y)||// @ts-ignore
|
|
8850
|
+
!isNil(attributes.z))||// Line
|
|
8851
|
+
object.nodeName===exports.Shape.LINE&&(// @ts-ignore
|
|
8852
|
+
!isNil(attributes.x1)||// @ts-ignore
|
|
8853
|
+
!isNil(attributes.y1)||// @ts-ignore
|
|
8854
|
+
!isNil(attributes.z1)||// @ts-ignore
|
|
8855
|
+
!isNil(attributes.x2)||// @ts-ignore
|
|
8856
|
+
!isNil(attributes.y2)||// @ts-ignore
|
|
8857
|
+
!isNil(attributes.z2))){runtime.CSSPropertySyntaxFactory['<coordinate>'].postProcessor(object,_attributeNames);}if(!isNil(attributes.zIndex)){runtime.CSSPropertySyntaxFactory['<z-index>'].postProcessor(object,_attributeNames);}// @ts-ignore
|
|
8850
8858
|
if(attributes.path){runtime.CSSPropertySyntaxFactory['<path>'].postProcessor(object,_attributeNames);}// @ts-ignore
|
|
8851
|
-
if(attributes.points){runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object,_attributeNames);}if(attributes.offsetDistance){runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object,_attributeNames);}if(attributes.transform){runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object,_attributeNames);}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;
|
|
8859
|
+
if(attributes.points){runtime.CSSPropertySyntaxFactory['<list-of-points>'].postProcessor(object,_attributeNames);}if(!isNil(attributes.offsetDistance)){runtime.CSSPropertySyntaxFactory['<offset-distance>'].postProcessor(object,_attributeNames);}if(attributes.transform){runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object,_attributeNames);}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;
|
|
8852
8860
|
// parse according to priority
|
|
8853
8861
|
// path 50
|
|
8854
8862
|
// points 50
|
|
@@ -12529,7 +12537,8 @@
|
|
|
12529
12537
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
12530
12538
|
convertToString) {
|
|
12531
12539
|
return function (f) {
|
|
12532
|
-
|
|
12540
|
+
var interpolated = interpolate(from, to, f);
|
|
12541
|
+
return !runtime.enableCSSParsing && isNumber(interpolated) ? interpolated : convertToString(interpolated);
|
|
12533
12542
|
};
|
|
12534
12543
|
};
|
|
12535
12544
|
function propertyInterpolation(property, left, right, target) {
|
|
@@ -12546,39 +12555,21 @@
|
|
|
12546
12555
|
if (metadata && metadata.syntax && metadata.int) {
|
|
12547
12556
|
var propertyHandler = runtime.styleValueRegistry.getPropertySyntax(metadata.syntax);
|
|
12548
12557
|
if (propertyHandler) {
|
|
12549
|
-
var
|
|
12550
|
-
var
|
|
12551
|
-
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
// }
|
|
12562
|
-
// if (!isNil(parsedDefaultRight)) {
|
|
12563
|
-
// // @ts-ignore
|
|
12564
|
-
// parsedRight = parsedDefaultRight;
|
|
12565
|
-
// } else if (propertyHandler.parser) {
|
|
12566
|
-
// parsedRight = propertyHandler.parser(right, target as DisplayObject);
|
|
12567
|
-
// }
|
|
12568
|
-
// if (propertyHandler.parser) {
|
|
12569
|
-
// parsedLeft = propertyHandler.parser(left, target as DisplayObject);
|
|
12570
|
-
// parsedRight = propertyHandler.parser(right, target as DisplayObject);
|
|
12571
|
-
// }
|
|
12572
|
-
// // no need to calculate
|
|
12573
|
-
// if (propertyHandler.calculator) {
|
|
12574
|
-
// parsedLeft = propertyHandler.calculator(parsedLeft);
|
|
12575
|
-
// parsedRight = propertyHandler.calculator(parsedRight);
|
|
12576
|
-
// // parsedLeft = handler.calculator
|
|
12577
|
-
// }
|
|
12558
|
+
var usedLeft;
|
|
12559
|
+
var usedRight;
|
|
12560
|
+
if (runtime.enableCSSParsing) {
|
|
12561
|
+
var computedLeft = runtime.styleValueRegistry.parseProperty(property, left, target);
|
|
12562
|
+
var computedRight = runtime.styleValueRegistry.parseProperty(property, right, target);
|
|
12563
|
+
usedLeft = runtime.styleValueRegistry.computeProperty(property, computedLeft, target);
|
|
12564
|
+
usedRight = runtime.styleValueRegistry.computeProperty(property, computedRight, target);
|
|
12565
|
+
} else {
|
|
12566
|
+
var parser = propertyHandler.parserWithCSSDisabled;
|
|
12567
|
+
usedLeft = parser ? parser(left, target) : left;
|
|
12568
|
+
usedRight = parser ? parser(right, target) : right;
|
|
12569
|
+
}
|
|
12578
12570
|
// merger [left, right, n2string()]
|
|
12579
12571
|
var interpolationArgs = propertyHandler.mixer(usedLeft, usedRight, target);
|
|
12580
12572
|
if (interpolationArgs) {
|
|
12581
|
-
// @ts-ignore
|
|
12582
12573
|
var interp = InterpolationFactory.apply(void 0, interpolationArgs);
|
|
12583
12574
|
return function (t) {
|
|
12584
12575
|
if (t === 0) return left;
|