@antv/g 5.15.4 → 5.15.6
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 +17 -4
- package/dist/index.umd.min.js +1 -1
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -5846,6 +5846,7 @@
|
|
|
5846
5846
|
function piMod(angle) {
|
|
5847
5847
|
return (angle + Math.PI * 2) % (Math.PI * 2);
|
|
5848
5848
|
}
|
|
5849
|
+
|
|
5849
5850
|
var line = {
|
|
5850
5851
|
/**
|
|
5851
5852
|
* 计算线段的包围盒
|
|
@@ -5940,6 +5941,7 @@
|
|
|
5940
5941
|
return Math.atan2(y2 - y1, x2 - x1);
|
|
5941
5942
|
}
|
|
5942
5943
|
};
|
|
5944
|
+
|
|
5943
5945
|
var EPSILON$1 = 0.0001;
|
|
5944
5946
|
/**
|
|
5945
5947
|
* 使用牛顿切割法求最近的点
|
|
@@ -6109,6 +6111,7 @@
|
|
|
6109
6111
|
return piMod(angle);
|
|
6110
6112
|
}
|
|
6111
6113
|
};
|
|
6114
|
+
|
|
6112
6115
|
function cubicAt(p0, p1, p2, p3, t) {
|
|
6113
6116
|
var onet = 1 - t; // t * t * t 的性能大概是 Math.pow(t, 3) 的三倍
|
|
6114
6117
|
return onet * onet * onet * p0 + 3 * p1 * t * onet * onet + 3 * p2 * t * t * onet + p3 * t * t * t;
|
|
@@ -6540,6 +6543,7 @@
|
|
|
6540
6543
|
return piMod(Math.atan2(dy, dx));
|
|
6541
6544
|
}
|
|
6542
6545
|
};
|
|
6546
|
+
|
|
6543
6547
|
function analyzePoints(points) {
|
|
6544
6548
|
// 计算每段的长度和总的长度
|
|
6545
6549
|
var totalLength = 0;
|
|
@@ -6652,6 +6656,7 @@
|
|
|
6652
6656
|
}
|
|
6653
6657
|
return minDistance;
|
|
6654
6658
|
}
|
|
6659
|
+
|
|
6655
6660
|
var polyline = {
|
|
6656
6661
|
/**
|
|
6657
6662
|
* 计算多折线的包围盒
|
|
@@ -8323,7 +8328,14 @@
|
|
|
8323
8328
|
return target[name];}return _this.getAttribute(name);},set:function set(_,prop,value){_this.setAttribute(prop,value);return true;}});// insert this group into pool
|
|
8324
8329
|
runtime.displayObjectPool.add(_this.entity,_assertThisInitialized(_this));return _this;}var _proto=DisplayObject.prototype;_proto.destroy=function destroy(){_Element.prototype.destroy.call(this);// remove from pool
|
|
8325
8330
|
runtime.displayObjectPool.remove(this.entity);// stop all active animations
|
|
8326
|
-
this.getAnimations().forEach(function(animation){animation.cancel();})
|
|
8331
|
+
this.getAnimations().forEach(function(animation){animation.cancel();});// FIXME
|
|
8332
|
+
// this.renderable = null;
|
|
8333
|
+
// this.cullable = null;
|
|
8334
|
+
// this.transformable = null;
|
|
8335
|
+
// this.rBushNode = null;
|
|
8336
|
+
// this.geometry = null;
|
|
8337
|
+
// this.sortable = null;
|
|
8338
|
+
};_proto.cloneNode=function cloneNode(deep,customCloneFunc){var clonedStyle=_extends({},this.attributes);for(var attributeName in clonedStyle){var attribute=clonedStyle[attributeName];// @see https://github.com/antvis/G/issues/1095
|
|
8327
8339
|
if(attribute instanceof DisplayObject&&// share the same clipPath if possible
|
|
8328
8340
|
attributeName!=='clipPath'&&attributeName!=='offsetPath'&&attributeName!=='textPath'){clonedStyle[attributeName]=attribute.cloneNode(deep);}// TODO: clone other type
|
|
8329
8341
|
if(customCloneFunc){clonedStyle[attributeName]=customCloneFunc(attributeName,attribute);}}var cloned=new this.constructor({// copy id & name
|
|
@@ -9324,7 +9336,8 @@
|
|
|
9324
9336
|
// }
|
|
9325
9337
|
lineHeight+=leading;// handle vertical text baseline
|
|
9326
9338
|
var offsetY=0;if(textBaseline==='middle'){offsetY=-height/2;}else if(textBaseline==='bottom'||textBaseline==='alphabetic'||textBaseline==='ideographic'){offsetY=-height;}else if(textBaseline==='top'||textBaseline==='hanging'){offsetY=0;}return {font:font,width:_width,height:height,lines:lines,lineWidths:lineWidths,lineHeight:lineHeight,maxLineWidth:maxLineWidth,fontProperties:fontProperties,lineMetrics:lineWidths.map(function(width,i){var offsetX=0;// handle horizontal text align
|
|
9327
|
-
if(textAlign==='center'||textAlign==='middle'){offsetX-=width/2;}else if(textAlign==='right'||textAlign==='end'){offsetX-=width;}return new Rectangle(offsetX-lineWidth/2,offsetY+i*lineHeight,width+lineWidth,lineHeight);})};}};_proto.setGraphemeOnPath=function setGraphemeOnPath(){};_proto.wordWrap=function wordWrap(text,parsedStyle,offscreenCanvas){var _this2=this;var _parsedStyle$wordWrap=parsedStyle.wordWrapWidth,wordWrapWidth=_parsedStyle$wordWrap===void 0?0:_parsedStyle$wordWrap,letterSpacing=parsedStyle.letterSpacing,_parsedStyle$maxLines=parsedStyle.maxLines,maxLines=_parsedStyle$maxLines===void 0?Infinity:_parsedStyle$maxLines,textOverflow=parsedStyle.textOverflow;var context=this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);var maxWidth=wordWrapWidth+letterSpacing
|
|
9339
|
+
if(textAlign==='center'||textAlign==='middle'){offsetX-=width/2;}else if(textAlign==='right'||textAlign==='end'){offsetX-=width;}return new Rectangle(offsetX-lineWidth/2,offsetY+i*lineHeight,width+lineWidth,lineHeight);})};}};_proto.setGraphemeOnPath=function setGraphemeOnPath(){};_proto.wordWrap=function wordWrap(text,parsedStyle,offscreenCanvas){var _this2=this;var _parsedStyle$wordWrap=parsedStyle.wordWrapWidth,wordWrapWidth=_parsedStyle$wordWrap===void 0?0:_parsedStyle$wordWrap,letterSpacing=parsedStyle.letterSpacing,_parsedStyle$maxLines=parsedStyle.maxLines,maxLines=_parsedStyle$maxLines===void 0?Infinity:_parsedStyle$maxLines,textOverflow=parsedStyle.textOverflow,metrics=parsedStyle.metrics;var context=this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);var maxWidth=wordWrapWidth+letterSpacing;// single line & no need to wrap
|
|
9340
|
+
if(maxLines===1&&metrics.width<=maxWidth){return text;}var ellipsis='';if(textOverflow==='ellipsis'){ellipsis='...';}else if(textOverflow&&textOverflow!=='clip'){ellipsis=textOverflow;}var lines=[];var currentIndex=0;var currentWidth=0;var cache={};var calcWidth=function calcWidth(char){return _this2.getFromCache(char,letterSpacing,cache,context);};var ellipsisWidth=Array.from(ellipsis).reduce(function(prev,cur){return prev+calcWidth(cur);},0);var chars=Array.from(text);for(var i=0;i<chars.length;i++){var char=chars[i];var prevChar=text[i-1];var nextChar=text[i+1];var charWidth=calcWidth(char);if(this.isNewline(char)){currentIndex++;// exceed maxLines, break immediately
|
|
9328
9341
|
if(currentIndex>=maxLines){parsedStyle.isOverflowing=true;break;}currentWidth=0;lines[currentIndex]='';continue;}if(currentWidth>0&¤tWidth+charWidth>maxWidth){if(currentIndex+1>=maxLines){parsedStyle.isOverflowing=true;// If there is not enough space to display the string itself, it is clipped.
|
|
9329
9342
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
|
|
9330
9343
|
if(ellipsisWidth>0&&ellipsisWidth<=maxWidth){// Backspace from line's end.
|
|
@@ -9490,7 +9503,7 @@
|
|
|
9490
9503
|
// });
|
|
9491
9504
|
if(destroyScenegraph){// destroy Document
|
|
9492
9505
|
this.document.destroy();this.getEventService().destroy();// clear rbush
|
|
9493
|
-
this.context.rBushRoot.clear();this.context.rBushRoot=null;this.context.renderingContext.root=null;}// destroy services
|
|
9506
|
+
if(this.context.rBushRoot){this.context.rBushRoot.clear();this.context.rBushRoot=null;}this.context.renderingContext.root=null;}// destroy services
|
|
9494
9507
|
this.getRenderingService().destroy();this.getContextService().destroy();if(!skipTriggerEvent){this.dispatchEvent(new CustomEvent(exports.CanvasEvent.AFTER_DESTROY));}}/**
|
|
9495
9508
|
* compatible with G 3.0
|
|
9496
9509
|
* @deprecated
|
|
@@ -12923,7 +12936,7 @@
|
|
|
12923
12936
|
_proto.updateTiming = function updateTiming(timing) {
|
|
12924
12937
|
var _this2 = this;
|
|
12925
12938
|
Object.keys(timing || {}).forEach(function (name) {
|
|
12926
|
-
_this2.timing = timing[name];
|
|
12939
|
+
_this2.timing[name] = timing[name];
|
|
12927
12940
|
});
|
|
12928
12941
|
};
|
|
12929
12942
|
return KeyframeEffect;
|