@antv/g 5.10.0 → 5.11.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/README.md CHANGED
@@ -28,7 +28,7 @@ https://g-next.antv.vision/en/docs/api/event
28
28
 
29
29
  ### Animation
30
30
 
31
- https://g-next.antv.vision/en/docs/api/animation
31
+ https://g-next.antv.vision/en/docs/api/animation/waapi
32
32
 
33
33
  ## Inspired by
34
34
 
package/dist/index.umd.js CHANGED
@@ -11379,7 +11379,7 @@
11379
11379
  * * transform & origin
11380
11380
  * * anchor
11381
11381
  * * lineWidth
11382
- */function convertToPath(object,applyLocalTransform){if(applyLocalTransform===void 0){applyLocalTransform=true;}var commands=[];switch(object.nodeName){case exports.Shape.LINE:var _object$parsedStyle2=object.parsedStyle,x1=_object$parsedStyle2.x1,y1=_object$parsedStyle2.y1,x2=_object$parsedStyle2.x2,y2=_object$parsedStyle2.y2;commands=lineToCommands(x1,y1,x2,y2);break;case exports.Shape.CIRCLE:{var _object$parsedStyle3=object.parsedStyle,r=_object$parsedStyle3.r,cx=_object$parsedStyle3.cx,cy=_object$parsedStyle3.cy;commands=ellipseToCommands(r,r,cx,cy);break;}case exports.Shape.ELLIPSE:{var _object$parsedStyle4=object.parsedStyle,rx=_object$parsedStyle4.rx,ry=_object$parsedStyle4.ry,_cx=_object$parsedStyle4.cx,_cy=_object$parsedStyle4.cy;commands=ellipseToCommands(rx,ry,_cx,_cy);break;}case exports.Shape.POLYLINE:case exports.Shape.POLYGON:var points=object.parsedStyle.points;commands=polygonToCommands(points.points,object.nodeName===exports.Shape.POLYGON);break;case exports.Shape.RECT:var _object$parsedStyle5=object.parsedStyle,width=_object$parsedStyle5.width,height=_object$parsedStyle5.height,x=_object$parsedStyle5.x,y=_object$parsedStyle5.y,radius=_object$parsedStyle5.radius;var hasRadius=radius&&radius.some(function(r){return r!==0;});commands=rectToCommands(width,height,x,y,hasRadius&&radius.map(function(r){return clamp(r,0,Math.min(Math.abs(width)/2,Math.abs(height)/2));}));break;case exports.Shape.PATH:var _object$parsedStyle$p=object.parsedStyle.path,curve=_object$parsedStyle$p.curve,zCommandIndexes=_object$parsedStyle$p.zCommandIndexes;commands=[].concat(curve);zCommandIndexes.forEach(function(zIndex,index){commands.splice(zIndex+index,1,['Z']);});break;}if(commands.length){return commandsToPathString(commands,object,applyLocalTransform);}}function translatePathToString(pathArray,x,y,startOffsetX,startOffsetY,endOffsetX,endOffsetY){if(startOffsetX===void 0){startOffsetX=0;}if(startOffsetY===void 0){startOffsetY=0;}if(endOffsetX===void 0){endOffsetX=0;}if(endOffsetY===void 0){endOffsetY=0;}var newValue=pathArray.map(function(params,i){var command=params[0];// @ts-ignore
11382
+ */function convertToPath(object,applyLocalTransform){if(applyLocalTransform===void 0){applyLocalTransform=true;}var commands=[];switch(object.nodeName){case exports.Shape.LINE:var _object$parsedStyle2=object.parsedStyle,x1=_object$parsedStyle2.x1,y1=_object$parsedStyle2.y1,x2=_object$parsedStyle2.x2,y2=_object$parsedStyle2.y2;commands=lineToCommands(x1,y1,x2,y2);break;case exports.Shape.CIRCLE:{var _object$parsedStyle3=object.parsedStyle,r=_object$parsedStyle3.r,cx=_object$parsedStyle3.cx,cy=_object$parsedStyle3.cy;commands=ellipseToCommands(r,r,cx,cy);break;}case exports.Shape.ELLIPSE:{var _object$parsedStyle4=object.parsedStyle,rx=_object$parsedStyle4.rx,ry=_object$parsedStyle4.ry,_cx=_object$parsedStyle4.cx,_cy=_object$parsedStyle4.cy;commands=ellipseToCommands(rx,ry,_cx,_cy);break;}case exports.Shape.POLYLINE:case exports.Shape.POLYGON:var points=object.parsedStyle.points;commands=polygonToCommands(points.points,object.nodeName===exports.Shape.POLYGON);break;case exports.Shape.RECT:var _object$parsedStyle5=object.parsedStyle,width=_object$parsedStyle5.width,height=_object$parsedStyle5.height,x=_object$parsedStyle5.x,y=_object$parsedStyle5.y,radius=_object$parsedStyle5.radius;var hasRadius=radius&&radius.some(function(r){return r!==0;});commands=rectToCommands(width,height,x,y,hasRadius&&radius.map(function(r){return clamp(r,0,Math.min(Math.abs(width)/2,Math.abs(height)/2));}));break;case exports.Shape.PATH:var _object$parsedStyle$p=object.parsedStyle.path,curve=_object$parsedStyle$p.curve,zCommandIndexes=_object$parsedStyle$p.zCommandIndexes;commands=[].concat(curve);zCommandIndexes.forEach(function(zIndex,index){commands.splice(zIndex+index+1,0,['Z']);});break;}if(commands.length){return commandsToPathString(commands,object,applyLocalTransform);}}function translatePathToString(pathArray,x,y,startOffsetX,startOffsetY,endOffsetX,endOffsetY){if(startOffsetX===void 0){startOffsetX=0;}if(startOffsetY===void 0){startOffsetY=0;}if(endOffsetX===void 0){endOffsetX=0;}if(endOffsetY===void 0){endOffsetY=0;}var newValue=pathArray.map(function(params,i){var command=params[0];// @ts-ignore
11383
11383
  var isClosed=pathArray[pathArray.length-1][0]==='Z';var offsetX=i===pathArray.length-(isClosed?2:1)?endOffsetX:0;var offsetY=i===pathArray.length-(isClosed?2:1)?endOffsetY:0;switch(command){case'M':return "M "+(params[1]-x+startOffsetX)+","+(params[2]-y+startOffsetY);case'L':return "L "+(params[1]-x+offsetX)+","+(params[2]-y+offsetY);case'Q':return "Q "+(params[1]-x)+" "+(params[2]-y)+","+(params[3]-x+offsetX)+" "+(params[4]-y+offsetY);case'C':return "C "+(params[1]-x)+" "+(params[2]-y)+","+(params[3]-x)+" "+(params[4]-y)+","+(params[5]-x+offsetX)+" "+(params[6]-y+offsetY);case'A':return "A "+params[1]+" "+params[2]+" "+params[3]+" "+params[4]+" "+params[5]+" "+(params[6]-x+offsetX)+" "+(params[7]-y+offsetY);case'Z':return 'Z';}}).join(' ');if(~newValue.indexOf('NaN')){return '';}return newValue;}function isFillOrStrokeAffected(pointerEvents,fill,stroke){// account for pointerEvents
11384
11384
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
11385
11385
  var hasFill=false;var hasStroke=false;var isFillOtherThanNone=!!fill&&!fill.isNone;var isStrokeOtherThanNone=!!stroke&&!stroke.isNone;if(pointerEvents==='visiblepainted'||pointerEvents==='painted'||pointerEvents==='auto'){hasFill=isFillOtherThanNone;hasStroke=isStrokeOtherThanNone;}else if(pointerEvents==='visiblefill'||pointerEvents==='fill'){hasFill=true;}else if(pointerEvents==='visiblestroke'||pointerEvents==='stroke'){hasStroke=true;}else if(pointerEvents==='visible'||pointerEvents==='all'){// The values of the fill and stroke do not affect event processing.
@@ -12406,7 +12406,9 @@
12406
12406
  * 设置相机矩阵
12407
12407
  */;_proto.setMatrix=function setMatrix(matrix){this.matrix=matrix;this._update();return this;};_proto.setFov=function setFov(fov){this.setPerspective(this.near,this.far,fov,this.aspect);return this;};_proto.setAspect=function setAspect(aspect){this.setPerspective(this.near,this.far,this.fov,aspect);return this;};_proto.setNear=function setNear(near){if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(near,this.far,this.fov,this.aspect);}else {this.setOrthographic(this.left,this.rright,this.top,this.bottom,near,this.far);}return this;};_proto.setFar=function setFar(far){if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,far,this.fov,this.aspect);}else {this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,far);}return this;}/**
12408
12408
  * Sets an offset in a larger frustum, used in PixelPicking
12409
- */;_proto.setViewOffset=function setViewOffset(fullWidth,fullHeight,x,y,width,height){this.aspect=fullWidth/fullHeight;if(this.view===undefined){this.view={enabled:true,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};}this.view.enabled=true;this.view.fullWidth=fullWidth;this.view.fullHeight=fullHeight;this.view.offsetX=x;this.view.offsetY=y;this.view.width=width;this.view.height=height;if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,this.far,this.fov,this.aspect);}else {this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far);}return this;};_proto.clearViewOffset=function clearViewOffset(){if(this.view!==undefined){this.view.enabled=false;}if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,this.far,this.fov,this.aspect);}else {this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far);}return this;};_proto.setZoom=function setZoom(zoom){this.zoom=zoom;if(this.projectionMode===exports.CameraProjectionMode.ORTHOGRAPHIC){this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far);}else if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,this.far,this.fov,this.aspect);}return this;};_proto.setPerspective=function setPerspective(near,far,fov,aspect){var _this$view;this.projectionMode=exports.CameraProjectionMode.PERSPECTIVE;this.fov=fov;this.near=near;this.far=far;this.aspect=aspect;var top=this.near*Math.tan(deg2rad(0.5*this.fov))/this.zoom;var height=2*top;var width=this.aspect*height;var left=-0.5*width;if((_this$view=this.view)===null||_this$view===void 0?void 0:_this$view.enabled){var fullWidth=this.view.fullWidth;var fullHeight=this.view.fullHeight;left+=this.view.offsetX*width/fullWidth;top-=this.view.offsetY*height/fullHeight;width*=this.view.width/fullWidth;height*=this.view.height/fullHeight;}makePerspective(this.projectionMatrix,left,left+width,top,top-height,near,this.far);// flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
12409
+ */;_proto.setViewOffset=function setViewOffset(fullWidth,fullHeight,x,y,width,height){this.aspect=fullWidth/fullHeight;if(this.view===undefined){this.view={enabled:true,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};}this.view.enabled=true;this.view.fullWidth=fullWidth;this.view.fullHeight=fullHeight;this.view.offsetX=x;this.view.offsetY=y;this.view.width=width;this.view.height=height;if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,this.far,this.fov,this.aspect);}else {this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far);}return this;};_proto.clearViewOffset=function clearViewOffset(){if(this.view!==undefined){this.view.enabled=false;}if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,this.far,this.fov,this.aspect);}else {this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far);}return this;};_proto.setZoom=function setZoom(zoom){this.zoom=zoom;if(this.projectionMode===exports.CameraProjectionMode.ORTHOGRAPHIC){this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far);}else if(this.projectionMode===exports.CameraProjectionMode.PERSPECTIVE){this.setPerspective(this.near,this.far,this.fov,this.aspect);}return this;}/**
12410
+ * Zoom by specified point in viewport coordinates.
12411
+ */;_proto.setZoomByViewportPoint=function setZoomByViewportPoint(zoom,viewportPoint){var _this$canvas$viewport=this.canvas.viewport2Canvas({x:viewportPoint[0],y:viewportPoint[1]}),ox=_this$canvas$viewport.x,oy=_this$canvas$viewport.y;this.setPosition(ox,oy);this.setFocalPoint(ox,oy);this.setZoom(zoom);var _this$canvas$viewport2=this.canvas.viewport2Canvas({x:viewportPoint[0],y:viewportPoint[1]}),cx=_this$canvas$viewport2.x,cy=_this$canvas$viewport2.y;this.pan(ox-cx,oy-cy);return this;};_proto.setPerspective=function setPerspective(near,far,fov,aspect){var _this$view;this.projectionMode=exports.CameraProjectionMode.PERSPECTIVE;this.fov=fov;this.near=near;this.far=far;this.aspect=aspect;var top=this.near*Math.tan(deg2rad(0.5*this.fov))/this.zoom;var height=2*top;var width=this.aspect*height;var left=-0.5*width;if((_this$view=this.view)===null||_this$view===void 0?void 0:_this$view.enabled){var fullWidth=this.view.fullWidth;var fullHeight=this.view.fullHeight;left+=this.view.offsetX*width/fullWidth;top-=this.view.offsetY*height/fullHeight;width*=this.view.width/fullWidth;height*=this.view.height/fullHeight;}makePerspective(this.projectionMatrix,left,left+width,top,top-height,near,this.far);// flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
12410
12412
  scale(this.projectionMatrix,this.projectionMatrix,fromValues$2(1,-1,1));invert(this.projectionMatrixInverse,this.projectionMatrix);this.triggerUpdate();return this;};_proto.setOrthographic=function setOrthographic(l,r,t,b,near,far){var _this$view2;this.projectionMode=exports.CameraProjectionMode.ORTHOGRAPHIC;this.rright=r;this.left=l;this.top=t;this.bottom=b;this.near=near;this.far=far;var dx=(this.rright-this.left)/(2*this.zoom);var dy=(this.top-this.bottom)/(2*this.zoom);var cx=(this.rright+this.left)/2;var cy=(this.top+this.bottom)/2;var left=cx-dx;var right=cx+dx;var top=cy+dy;var bottom=cy-dy;if((_this$view2=this.view)===null||_this$view2===void 0?void 0:_this$view2.enabled){var scaleW=(this.rright-this.left)/this.view.fullWidth/this.zoom;var scaleH=(this.top-this.bottom)/this.view.fullHeight/this.zoom;left+=scaleW*this.view.offsetX;right=left+scaleW*this.view.width;top-=scaleH*this.view.offsetY;bottom=top-scaleH*this.view.height;}ortho(this.projectionMatrix,left,right,bottom,top,near,far);// flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
12411
12413
  scale(this.projectionMatrix,this.projectionMatrix,fromValues$2(1,-1,1));invert(this.projectionMatrixInverse,this.projectionMatrix);this._getOrthoMatrix();this.triggerUpdate();return this;}/**
12412
12414
  * Move the camera in world coordinates.