@antv/g 5.15.6 → 5.15.8
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 +5 -10
- package/dist/index.umd.min.js +1 -1
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -5846,7 +5846,6 @@
|
|
|
5846
5846
|
function piMod(angle) {
|
|
5847
5847
|
return (angle + Math.PI * 2) % (Math.PI * 2);
|
|
5848
5848
|
}
|
|
5849
|
-
|
|
5850
5849
|
var line = {
|
|
5851
5850
|
/**
|
|
5852
5851
|
* 计算线段的包围盒
|
|
@@ -5941,7 +5940,6 @@
|
|
|
5941
5940
|
return Math.atan2(y2 - y1, x2 - x1);
|
|
5942
5941
|
}
|
|
5943
5942
|
};
|
|
5944
|
-
|
|
5945
5943
|
var EPSILON$1 = 0.0001;
|
|
5946
5944
|
/**
|
|
5947
5945
|
* 使用牛顿切割法求最近的点
|
|
@@ -6111,7 +6109,6 @@
|
|
|
6111
6109
|
return piMod(angle);
|
|
6112
6110
|
}
|
|
6113
6111
|
};
|
|
6114
|
-
|
|
6115
6112
|
function cubicAt(p0, p1, p2, p3, t) {
|
|
6116
6113
|
var onet = 1 - t; // t * t * t 的性能大概是 Math.pow(t, 3) 的三倍
|
|
6117
6114
|
return onet * onet * onet * p0 + 3 * p1 * t * onet * onet + 3 * p2 * t * t * onet + p3 * t * t * t;
|
|
@@ -6543,7 +6540,6 @@
|
|
|
6543
6540
|
return piMod(Math.atan2(dy, dx));
|
|
6544
6541
|
}
|
|
6545
6542
|
};
|
|
6546
|
-
|
|
6547
6543
|
function analyzePoints(points) {
|
|
6548
6544
|
// 计算每段的长度和总的长度
|
|
6549
6545
|
var totalLength = 0;
|
|
@@ -6656,7 +6652,6 @@
|
|
|
6656
6652
|
}
|
|
6657
6653
|
return minDistance;
|
|
6658
6654
|
}
|
|
6659
|
-
|
|
6660
6655
|
var polyline = {
|
|
6661
6656
|
/**
|
|
6662
6657
|
* 计算多折线的包围盒
|
|
@@ -9336,8 +9331,7 @@
|
|
|
9336
9331
|
// }
|
|
9337
9332
|
lineHeight+=leading;// handle vertical text baseline
|
|
9338
9333
|
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
|
|
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
|
|
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
|
|
9334
|
+
if(textAlign==='center'||textAlign==='middle'){offsetX-=width/2;}else if(textAlign==='right'||textAlign==='end'){offsetX-=width;}return new Rectangle(offsetX-lineWidth/2,offsetY+i*lineHeight,width+lineWidth,lineHeight);})};}};_proto.setGraphemeOnPath=function setGraphemeOnPath(){};_proto.wordWrap=function wordWrap(text,parsedStyle,offscreenCanvas){var _this2=this;var _parsedStyle$wordWrap=parsedStyle.wordWrapWidth,wordWrapWidth=_parsedStyle$wordWrap===void 0?0:_parsedStyle$wordWrap,letterSpacing=parsedStyle.letterSpacing,_parsedStyle$maxLines=parsedStyle.maxLines,maxLines=_parsedStyle$maxLines===void 0?Infinity:_parsedStyle$maxLines,textOverflow=parsedStyle.textOverflow;var context=this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);var maxWidth=wordWrapWidth+letterSpacing;var ellipsis='';if(textOverflow==='ellipsis'){ellipsis='...';}else if(textOverflow&&textOverflow!=='clip'){ellipsis=textOverflow;}var lines=[];var currentIndex=0;var currentWidth=0;var cache={};var calcWidth=function calcWidth(char){return _this2.getFromCache(char,letterSpacing,cache,context);};var ellipsisWidth=Array.from(ellipsis).reduce(function(prev,cur){return prev+calcWidth(cur);},0);var chars=Array.from(text);for(var i=0;i<chars.length;i++){var char=chars[i];var prevChar=text[i-1];var nextChar=text[i+1];var charWidth=calcWidth(char);if(this.isNewline(char)){currentIndex++;// exceed maxLines, break immediately
|
|
9341
9335
|
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.
|
|
9342
9336
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
|
|
9343
9337
|
if(ellipsisWidth>0&&ellipsisWidth<=maxWidth){// Backspace from line's end.
|
|
@@ -9502,9 +9496,10 @@
|
|
|
9502
9496
|
// this.unmountChildren(child);
|
|
9503
9497
|
// });
|
|
9504
9498
|
if(destroyScenegraph){// destroy Document
|
|
9505
|
-
this.document.destroy();this.getEventService().destroy()
|
|
9506
|
-
|
|
9507
|
-
|
|
9499
|
+
this.document.destroy();this.getEventService().destroy();}// destroy services
|
|
9500
|
+
this.getRenderingService().destroy();this.getContextService().destroy();// clear root after renderservice destroyed
|
|
9501
|
+
if(destroyScenegraph&&this.context.rBushRoot){// clear rbush
|
|
9502
|
+
this.context.rBushRoot.clear();this.context.rBushRoot=null;this.context.renderingContext.root=null;}if(!skipTriggerEvent){this.dispatchEvent(new CustomEvent(exports.CanvasEvent.AFTER_DESTROY));}}/**
|
|
9508
9503
|
* compatible with G 3.0
|
|
9509
9504
|
* @deprecated
|
|
9510
9505
|
* @alias resize
|