@antv/g 5.15.5 → 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 CHANGED
@@ -8328,7 +8328,14 @@
8328
8328
  return target[name];}return _this.getAttribute(name);},set:function set(_,prop,value){_this.setAttribute(prop,value);return true;}});// insert this group into pool
8329
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
8330
8330
  runtime.displayObjectPool.remove(this.entity);// stop all active animations
8331
- this.getAnimations().forEach(function(animation){animation.cancel();});this.renderable=null;this.cullable=null;this.transformable=null;this.rBushNode=null;this.geometry=null;this.sortable=null;};_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
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
8332
8339
  if(attribute instanceof DisplayObject&&// share the same clipPath if possible
8333
8340
  attributeName!=='clipPath'&&attributeName!=='offsetPath'&&attributeName!=='textPath'){clonedStyle[attributeName]=attribute.cloneNode(deep);}// TODO: clone other type
8334
8341
  if(customCloneFunc){clonedStyle[attributeName]=customCloneFunc(attributeName,attribute);}}var cloned=new this.constructor({// copy id & name
@@ -9329,7 +9336,8 @@
9329
9336
  // }
9330
9337
  lineHeight+=leading;// handle vertical text baseline
9331
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
9332
- 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
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
9333
9341
  if(currentIndex>=maxLines){parsedStyle.isOverflowing=true;break;}currentWidth=0;lines[currentIndex]='';continue;}if(currentWidth>0&&currentWidth+charWidth>maxWidth){if(currentIndex+1>=maxLines){parsedStyle.isOverflowing=true;// If there is not enough space to display the string itself, it is clipped.
9334
9342
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#values
9335
9343
  if(ellipsisWidth>0&&ellipsisWidth<=maxWidth){// Backspace from line's end.
@@ -9495,7 +9503,7 @@
9495
9503
  // });
9496
9504
  if(destroyScenegraph){// destroy Document
9497
9505
  this.document.destroy();this.getEventService().destroy();// clear rbush
9498
- 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
9499
9507
  this.getRenderingService().destroy();this.getContextService().destroy();if(!skipTriggerEvent){this.dispatchEvent(new CustomEvent(exports.CanvasEvent.AFTER_DESTROY));}}/**
9500
9508
  * compatible with G 3.0
9501
9509
  * @deprecated
@@ -12928,7 +12936,7 @@
12928
12936
  _proto.updateTiming = function updateTiming(timing) {
12929
12937
  var _this2 = this;
12930
12938
  Object.keys(timing || {}).forEach(function (name) {
12931
- _this2.timing = timing[name];
12939
+ _this2.timing[name] = timing[name];
12932
12940
  });
12933
12941
  };
12934
12942
  return KeyframeEffect;