@antv/g 5.0.21 → 5.0.22-alpha.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.
Files changed (38) hide show
  1. package/dist/index.umd.min.js +2 -2
  2. package/es/Canvas.js +6 -8
  3. package/es/camera/Camera.d.ts +12 -7
  4. package/es/camera/Camera.js +53 -21
  5. package/es/camera/Landmark.d.ts +2 -0
  6. package/es/camera/Landmark.js +9 -3
  7. package/es/display-objects/DisplayObject.js +7 -2
  8. package/es/plugins/EventPlugin.js +4 -1
  9. package/es/services/EventService.js +23 -2
  10. package/es/services/RenderingContext.d.ts +2 -1
  11. package/es/services/RenderingContext.js +3 -1
  12. package/es/services/SceneGraphService.d.ts +2 -1
  13. package/es/services/SceneGraphService.js +2 -2
  14. package/es/services/aabb/interfaces.d.ts +3 -2
  15. package/es/services/aabb/interfaces.js +3 -2
  16. package/es/types.d.ts +2 -1
  17. package/es/types.js +2 -1
  18. package/es/utils/custom-easing.d.ts +0 -9
  19. package/es/utils/custom-easing.js +37 -53
  20. package/lib/Canvas.js +6 -8
  21. package/lib/camera/Camera.d.ts +12 -7
  22. package/lib/camera/Camera.js +57 -21
  23. package/lib/camera/Landmark.d.ts +2 -0
  24. package/lib/camera/Landmark.js +9 -3
  25. package/lib/display-objects/DisplayObject.js +6 -1
  26. package/lib/plugins/EventPlugin.js +4 -1
  27. package/lib/services/EventService.js +23 -2
  28. package/lib/services/RenderingContext.d.ts +2 -1
  29. package/lib/services/RenderingContext.js +4 -1
  30. package/lib/services/SceneGraphService.d.ts +2 -1
  31. package/lib/services/SceneGraphService.js +2 -1
  32. package/lib/services/aabb/interfaces.d.ts +3 -2
  33. package/lib/services/aabb/interfaces.js +8 -2
  34. package/lib/types.d.ts +2 -1
  35. package/lib/types.js +5 -1
  36. package/lib/utils/custom-easing.d.ts +0 -9
  37. package/lib/utils/custom-easing.js +41 -65
  38. package/package.json +3 -3
@@ -1,9 +1,11 @@
1
1
  import { EventEmitter } from 'eventemitter3';
2
+ import type { vec2 } from 'gl-matrix';
2
3
  import { mat4, vec3 } from 'gl-matrix';
3
4
  import { Landmark } from './Landmark';
4
5
  import { Frustum } from '../shapes';
5
6
  import type { Canvas } from '../Canvas';
6
- export declare const DefaultCamera = "DefaultCamera";
7
+ import { Syringe } from 'mana-syringe';
8
+ export declare const DefaultCamera: Syringe.DefinedToken;
7
9
  export declare enum CAMERA_TYPE {
8
10
  ORBITING = "ORBITING",
9
11
  EXPLORING = "EXPLORING",
@@ -114,7 +116,6 @@ export declare class Camera extends EventEmitter {
114
116
  private projectionMatrixInverse;
115
117
  private jitteredProjectionMatrix;
116
118
  private view;
117
- private following;
118
119
  private type;
119
120
  private trackingMode;
120
121
  private projectionMode;
@@ -239,13 +240,17 @@ export declare class Camera extends EventEmitter {
239
240
  * 沿 n 轴移动,当距离视点远时移动速度较快,离视点越近速度越慢
240
241
  */
241
242
  dolly(value: number): this;
242
- createLandmark(name: string, params: {
243
- position: vec3;
244
- focalPoint: vec3;
243
+ createLandmark(name: string, params?: Partial<{
244
+ position: vec3 | vec2;
245
+ focalPoint: vec3 | vec2;
246
+ zoom?: number;
245
247
  roll?: number;
246
- }): Landmark;
248
+ }>): Landmark;
247
249
  setLandmark(name: string): this;
248
- gotoLandmark(name: string, duration?: number): void;
250
+ gotoLandmark(name: string | Landmark, options?: number | Partial<{
251
+ easing: string;
252
+ duration: number;
253
+ }>): void;
249
254
  /**
250
255
  * 根据相机矩阵重新计算各种相机参数
251
256
  */
@@ -17,7 +17,14 @@ var _shapes = require("../shapes");
17
17
 
18
18
  var _math = require("../utils/math");
19
19
 
20
- var DefaultCamera = 'DefaultCamera';
20
+ var _animation = require("../utils/animation");
21
+
22
+ var _util = require("@antv/util");
23
+
24
+ var _manaSyringe = require("mana-syringe");
25
+
26
+ var DefaultCamera = _manaSyringe.Syringe.defineToken('DefaultCamera');
27
+
21
28
  exports.DefaultCamera = DefaultCamera;
22
29
  var CAMERA_TYPE;
23
30
  exports.CAMERA_TYPE = CAMERA_TYPE;
@@ -157,8 +164,8 @@ function (_super) {
157
164
  _this.aspect = 1;
158
165
  _this.projectionMatrix = _glMatrix.mat4.create();
159
166
  _this.projectionMatrixInverse = _glMatrix.mat4.create();
160
- _this.jitteredProjectionMatrix = undefined;
161
- _this.following = undefined;
167
+ _this.jitteredProjectionMatrix = undefined; // private following = undefined;
168
+
162
169
  _this.type = CAMERA_TYPE.EXPLORING;
163
170
  _this.trackingMode = CAMERA_TRACKING_MODE.DEFAULT;
164
171
  _this.projectionMode = CAMERA_PROJECTION_MODE.PERSPECTIVE;
@@ -775,12 +782,24 @@ function (_super) {
775
782
  };
776
783
 
777
784
  Camera.prototype.createLandmark = function (name, params) {
785
+ if (params === void 0) {
786
+ params = {};
787
+ }
788
+
789
+ var position = params.position,
790
+ focalPoint = params.focalPoint,
791
+ roll = params.roll,
792
+ zoom = params.zoom;
778
793
  var camera = this.clone();
779
- camera.setPosition(params.position);
780
- camera.setFocalPoint(params.focalPoint);
794
+ camera.setPosition(_glMatrix.vec3.fromValues(position[0], position[1], position[2] || this.position[2]));
795
+ camera.setFocalPoint(_glMatrix.vec3.fromValues(focalPoint[0], focalPoint[1], focalPoint[2] || this.focalPoint[2]));
781
796
 
782
- if (params.roll !== undefined) {
783
- camera.setRoll(params.roll);
797
+ if (!(0, _util.isUndefined)(roll)) {
798
+ camera.setRoll(roll);
799
+ }
800
+
801
+ if (!(0, _util.isUndefined)(zoom)) {
802
+ camera.setZoom(zoom);
784
803
  }
785
804
 
786
805
  var landmark = new _Landmark.Landmark(name, camera);
@@ -794,19 +813,29 @@ function (_super) {
794
813
  return this;
795
814
  };
796
815
 
797
- Camera.prototype.gotoLandmark = function (name, duration) {
816
+ Camera.prototype.gotoLandmark = function (name, options) {
798
817
  var _this = this;
799
818
 
800
- if (duration === void 0) {
801
- duration = 1000;
819
+ if (options === void 0) {
820
+ options = {};
802
821
  }
803
822
 
804
- var landmark = this.landmarks.find(function (l) {
823
+ var landmark = (0, _util.isString)(name) ? this.landmarks.find(function (l) {
805
824
  return l.name === name;
806
- });
825
+ }) : name;
807
826
 
808
827
  if (landmark) {
809
- if (duration === 0) {
828
+ var _a = (0, _util.isNumber)(options) ? {
829
+ duration: options
830
+ } : options,
831
+ _b = _a.easing,
832
+ easing = _b === void 0 ? 'ease' : _b,
833
+ _c = _a.duration,
834
+ duration_1 = _c === void 0 ? 1000 : _c;
835
+
836
+ var epsilon_1 = 0.01;
837
+
838
+ if (duration_1 === 0) {
810
839
  landmark.retrieve(this);
811
840
  return;
812
841
  }
@@ -819,7 +848,9 @@ function (_super) {
819
848
 
820
849
  var destPosition_1 = landmark.getPosition();
821
850
  var destFocalPoint_1 = landmark.getFocalPoint();
851
+ var destZoom_1 = landmark.getZoom();
822
852
  var destRoll_1 = landmark.getRoll();
853
+ var easingFunction_1 = (0, _animation.parseEasingFunction)(easing);
823
854
  var timeStart_1;
824
855
 
825
856
  var animate_1 = function animate_1(timestamp) {
@@ -827,14 +858,15 @@ function (_super) {
827
858
  timeStart_1 = timestamp;
828
859
  }
829
860
 
830
- var elapsed = timestamp - timeStart_1; // TODO: use better ease function
861
+ var elapsed = timestamp - timeStart_1; // use the same ease function in animatio system
831
862
 
832
- var t = (1 - Math.cos(elapsed / duration * Math.PI)) / 2;
863
+ var t = easingFunction_1(elapsed / duration_1);
833
864
 
834
865
  var interFocalPoint = _glMatrix.vec3.create();
835
866
 
836
867
  var interPosition = _glMatrix.vec3.create();
837
868
 
869
+ var interZoom = 1;
838
870
  var interRoll = 0;
839
871
 
840
872
  _glMatrix.vec3.lerp(interFocalPoint, _this.focalPoint, destFocalPoint_1, t);
@@ -842,6 +874,7 @@ function (_super) {
842
874
  _glMatrix.vec3.lerp(interPosition, _this.position, destPosition_1, t);
843
875
 
844
876
  interRoll = _this.roll * (1 - t) + destRoll_1 * t;
877
+ interZoom = _this.zoom * (1 - t) + destZoom_1 * t;
845
878
 
846
879
  _this.setFocalPoint(interFocalPoint);
847
880
 
@@ -849,19 +882,22 @@ function (_super) {
849
882
 
850
883
  _this.setRoll(interRoll);
851
884
 
885
+ _this.setZoom(interZoom);
886
+
852
887
  _this.computeMatrix();
853
888
 
854
889
  _this.triggerUpdate();
855
890
 
856
891
  var dist = _glMatrix.vec3.dist(interFocalPoint, destFocalPoint_1) + _glMatrix.vec3.dist(interPosition, destPosition_1);
857
892
 
858
- if (dist > 0.01) {//
859
- } else {
860
- _this.setFocalPoint(interFocalPoint);
893
+ if (dist <= epsilon_1) {
894
+ _this.setFocalPoint(destFocalPoint_1);
895
+
896
+ _this.setPosition(destPosition_1);
861
897
 
862
- _this.setPosition(interPosition);
898
+ _this.setRoll(destRoll_1);
863
899
 
864
- _this.setRoll(interRoll);
900
+ _this.setZoom(destZoom_1);
865
901
 
866
902
  _this.computeMatrix(); // this.interactor.connect();
867
903
 
@@ -869,7 +905,7 @@ function (_super) {
869
905
  return;
870
906
  }
871
907
 
872
- if (elapsed < duration) {
908
+ if (elapsed < duration_1) {
873
909
  _this.landmarkAnimationID = _this.canvas.requestAnimationFrame(animate_1);
874
910
  }
875
911
  };
@@ -20,9 +20,11 @@ export declare class Landmark {
20
20
  private relAzimuth;
21
21
  private relElevation;
22
22
  private relRoll;
23
+ private zoom;
23
24
  constructor(name: string, c: Camera);
24
25
  getPosition(): vec3;
25
26
  getFocalPoint(): vec3;
26
27
  getRoll(): number;
28
+ getZoom(): number;
27
29
  retrieve(c: Camera): void;
28
30
  }
@@ -13,7 +13,6 @@ var _glMatrix = require("gl-matrix");
13
13
  var Landmark =
14
14
  /** @class */
15
15
  function () {
16
- // private zoom = 1;
17
16
  function Landmark(name, c) {
18
17
  this.azimuth = 0;
19
18
  this.elevation = 0;
@@ -21,6 +20,7 @@ function () {
21
20
  this.relAzimuth = 0;
22
21
  this.relElevation = 0;
23
22
  this.relRoll = 0;
23
+ this.zoom = 1;
24
24
  this.name = name;
25
25
  this.matrix = _glMatrix.mat4.clone(c.matrix);
26
26
  this.right = _glMatrix.vec3.clone(c.right);
@@ -36,7 +36,8 @@ function () {
36
36
  this.relElevation = c.relElevation;
37
37
  this.relRoll = c.relRoll;
38
38
  this.dollyingStep = c.dollyingStep;
39
- this.distance = c.distance; // this.zoom = c.zoom;
39
+ this.distance = c.distance;
40
+ this.zoom = c.zoom;
40
41
  }
41
42
 
42
43
  Landmark.prototype.getPosition = function () {
@@ -51,6 +52,10 @@ function () {
51
52
  return this.roll;
52
53
  };
53
54
 
55
+ Landmark.prototype.getZoom = function () {
56
+ return this.zoom;
57
+ };
58
+
54
59
  Landmark.prototype.retrieve = function (c) {
55
60
  c.matrix = _glMatrix.mat4.copy(c.matrix, this.matrix);
56
61
  c.right = _glMatrix.vec3.copy(c.right, this.right);
@@ -66,7 +71,8 @@ function () {
66
71
  c.relElevation = this.relElevation;
67
72
  c.relRoll = this.relRoll;
68
73
  c.dollyingStep = this.dollyingStep;
69
- c.distance = this.distance; // c.zoom = this.zoom;
74
+ c.distance = this.distance;
75
+ c.zoom = this.zoom;
70
76
  };
71
77
 
72
78
  return Landmark;
@@ -210,7 +210,12 @@ function (_super) {
210
210
 
211
211
  var _a = (0, _tslib.__read)((0, _utils.formatAttribute)(name, value), 2),
212
212
  attributeName = _a[0],
213
- attributeValue = _a[1];
213
+ attributeValue = _a[1]; // ignore undefined value
214
+
215
+
216
+ if ((0, _util.isUndefined)(value)) {
217
+ return;
218
+ }
214
219
 
215
220
  if (force || !(0, _util.isEqual)(attributeValue, this.attributes[attributeName])) {
216
221
  this.internalSetAttribute(attributeName, attributeValue);
@@ -319,7 +319,10 @@ function () {
319
319
  if ((0, _util.isUndefined)(touch.twist)) touch.twist = 0;
320
320
  if ((0, _util.isUndefined)(touch.tangentialPressure)) touch.tangentialPressure = 0;
321
321
  touch.isNormalized = true;
322
- touch.type = event.type;
322
+ touch.type = event.type; // ref to nativeEvent
323
+ // touch.nativeEvent = event;
324
+ // touch.isLast = event.changedTouches.length - 1 === i;
325
+
323
326
  normalizedEvents.push(touch);
324
327
  }
325
328
  } else if (canvas.isMouseEvent(event)) {
@@ -69,7 +69,9 @@ function (_super) {
69
69
  this.dispatchEvent(e, 'pointerdown');
70
70
 
71
71
  if (e.pointerType === 'touch') {
72
- this.dispatchEvent(e, 'touchstart');
72
+ // only the
73
+ // if (e.isLast) {
74
+ this.dispatchEvent(e, 'touchstart'); // }
73
75
  } else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
74
76
  isRightButton = e.button === 2;
75
77
  this.dispatchEvent(e, isRightButton ? 'rightdown' : 'mousedown');
@@ -693,8 +695,27 @@ function (_super) {
693
695
  };
694
696
 
695
697
  EventService.prototype.isNativeEventFromCanvas = function (event) {
698
+ var _a;
699
+
696
700
  var $el = this.contextService.getDomElement();
697
- return event.nativeEvent.composedPath().indexOf($el) > -1;
701
+ var target = (_a = event.nativeEvent) === null || _a === void 0 ? void 0 : _a.target;
702
+
703
+ if (target) {
704
+ if (target === $el) {
705
+ return true;
706
+ }
707
+
708
+ if ($el && $el.contains) {
709
+ return $el.contains(target);
710
+ }
711
+ }
712
+
713
+ if (event.nativeEvent.composedPath) {
714
+ return event.nativeEvent.composedPath().indexOf($el) > -1;
715
+ } // account for Touch
716
+
717
+
718
+ return false;
698
719
  };
699
720
 
700
721
  EventService.prototype.createPointerEvent = function (from, type, target) {
@@ -1,3 +1,4 @@
1
+ import { Syringe } from 'mana-syringe';
1
2
  import type { Group } from '../display-objects';
2
3
  /**
3
4
  * why we need re-render
@@ -7,7 +8,7 @@ export declare enum RenderReason {
7
8
  DISPLAY_OBJECT_CHANGED = 1,
8
9
  NONE = 2
9
10
  }
10
- export declare const RenderingContext = "RenderingContext";
11
+ export declare const RenderingContext: Syringe.DefinedToken;
11
12
  export interface RenderingContext {
12
13
  /**
13
14
  * root of scenegraph
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.RenderingContext = exports.RenderReason = void 0;
7
7
 
8
+ var _manaSyringe = require("mana-syringe");
9
+
8
10
  /**
9
11
  * why we need re-render
10
12
  */
@@ -17,5 +19,6 @@ exports.RenderReason = RenderReason;
17
19
  RenderReason[RenderReason["NONE"] = 2] = "NONE";
18
20
  })(RenderReason || (exports.RenderReason = RenderReason = {}));
19
21
 
20
- var RenderingContext = 'RenderingContext';
22
+ var RenderingContext = _manaSyringe.Syringe.defineToken('RenderingContext');
23
+
21
24
  exports.RenderingContext = RenderingContext;
@@ -1,3 +1,4 @@
1
+ import { Syringe } from 'mana-syringe';
1
2
  import type { Transform } from '../components';
2
3
  import type { vec2 } from 'gl-matrix';
3
4
  import { mat4, quat, vec3 } from 'gl-matrix';
@@ -5,7 +6,7 @@ import { AABB, Rectangle } from '../shapes';
5
6
  import type { IElement, INode, IParentNode } from '../dom/interfaces';
6
7
  export declare function sortByZIndex(o1: IElement, o2: IElement): number;
7
8
  export declare function dirtifyToRoot(element: INode, affectChildren?: boolean): void;
8
- export declare const SceneGraphService = "SceneGraphService";
9
+ export declare const SceneGraphService: Syringe.DefinedToken;
9
10
  export interface SceneGraphService {
10
11
  matches: <T extends IElement>(query: string, root: T) => boolean;
11
12
  querySelector: <R extends IElement, T extends IElement>(query: string, root: R) => T | null;
@@ -64,13 +64,14 @@ function dirtifyToRoot(element, affectChildren) {
64
64
  });
65
65
  }
66
66
 
67
- var SceneGraphService = 'SceneGraphService';
67
+ var SceneGraphService = _manaSyringe.Syringe.defineToken('SceneGraphService');
68
68
  /**
69
69
  * update transform in scene graph
70
70
  *
71
71
  * @see https://community.khronos.org/t/scene-graphs/50542/7
72
72
  */
73
73
 
74
+
74
75
  exports.SceneGraphService = SceneGraphService;
75
76
 
76
77
  var DefaultSceneGraphService =
@@ -1,7 +1,8 @@
1
+ import { Syringe } from 'mana-syringe';
1
2
  import type { DisplayObject } from '../../display-objects/DisplayObject';
2
3
  import type { ParsedBaseStyleProps } from '../../types';
3
- export declare const GeometryUpdaterFactory = "GeometryUpdaterFactory";
4
- export declare const GeometryAABBUpdater = "GeometryAABBUpdater";
4
+ export declare const GeometryUpdaterFactory: Syringe.DefinedToken;
5
+ export declare const GeometryAABBUpdater: Syringe.DefinedToken;
5
6
  export interface GeometryAABBUpdater<T extends ParsedBaseStyleProps = any> {
6
7
  update: (parsedStyle: T, object: DisplayObject) => {
7
8
  width: number;
@@ -4,7 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.GeometryUpdaterFactory = exports.GeometryAABBUpdater = void 0;
7
- var GeometryUpdaterFactory = 'GeometryUpdaterFactory';
7
+
8
+ var _manaSyringe = require("mana-syringe");
9
+
10
+ var GeometryUpdaterFactory = _manaSyringe.Syringe.defineToken('GeometryUpdaterFactory');
11
+
8
12
  exports.GeometryUpdaterFactory = GeometryUpdaterFactory;
9
- var GeometryAABBUpdater = 'GeometryAABBUpdater';
13
+
14
+ var GeometryAABBUpdater = _manaSyringe.Syringe.defineToken('GeometryAABBUpdater');
15
+
10
16
  exports.GeometryAABBUpdater = GeometryAABBUpdater;
package/lib/types.d.ts CHANGED
@@ -4,6 +4,7 @@ import type { ParsedPathStyleProps, ParsedPolylineStyleProps } from './display-o
4
4
  import type { DisplayObject } from './display-objects';
5
5
  import type { IRenderer } from './AbstractRenderer';
6
6
  import type { CSSGlobalKeywords, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSUnitValue } from './css';
7
+ import { Syringe } from 'mana-syringe';
7
8
  export declare enum Shape {
8
9
  GROUP = "g",
9
10
  CIRCLE = "circle",
@@ -209,7 +210,7 @@ export interface RendererConfig {
209
210
  */
210
211
  enableTAA: boolean;
211
212
  }
212
- export declare const CanvasConfig = "CanvasConfig";
213
+ export declare const CanvasConfig: Syringe.DefinedToken;
213
214
  export interface CanvasConfig {
214
215
  /**
215
216
  * Renderer
package/lib/types.js CHANGED
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TextTransform = exports.TextAlign = exports.Shape = exports.LineJoin = exports.LineCap = exports.CanvasConfig = void 0;
7
+
8
+ var _manaSyringe = require("mana-syringe");
9
+
7
10
  var Shape;
8
11
  exports.Shape = Shape;
9
12
 
@@ -60,5 +63,6 @@ exports.TextAlign = TextAlign;
60
63
  TextAlign["RIGHT"] = "right";
61
64
  })(TextAlign || (exports.TextAlign = TextAlign = {}));
62
65
 
63
- var CanvasConfig = 'CanvasConfig';
66
+ var CanvasConfig = _manaSyringe.Syringe.defineToken('CanvasConfig');
67
+
64
68
  exports.CanvasConfig = CanvasConfig;
@@ -38,7 +38,6 @@ export declare const parseEasingParameters: (str: string) => (string | number)[]
38
38
  * easing functions, because of the nature of the function it can sometimes create an infinite loop, I suggest only using
39
39
  * `getEasingDuration` for `spring`, specifically 'out-spring' and 'spring'
40
40
  */
41
- export declare const getEasingDuration: (easing?: string | TypeEasingFunction) => number;
42
41
  /**
43
42
  These Easing Functions are based off of the Sozi Project's easing functions
44
43
  https://github.com/sozi-projects/Sozi/blob/d72e44ebd580dc7579d1e177406ad41e632f961d/src/js/player/Timing.js
@@ -63,11 +62,3 @@ export declare const EasingFunctions: Record<string, TypeEasingFunction>;
63
62
  export declare const complexEasingSyntax: (ease: string) => string;
64
63
  /** Re-maps a number from one range to another. Numbers outside the range are not clamped to 0 and 1, because out-of-range values are often intentional and useful. */
65
64
  export declare const getEasingFunction: (ease: string) => TypeEasingFunction;
66
- /**
67
- * Allows you to register new easing functions
68
- */
69
- export declare const registerEasingFunction: (key: string, fn: TypeEasingFunction) => void;
70
- /**
71
- * Allows you to register multiple new easing functions
72
- */
73
- export declare const registerEasingFunctions: (...obj: (typeof EasingFunctions)[]) => void;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.registerEasingFunctions = exports.registerEasingFunction = exports.parseEasingParameters = exports.limit = exports.getEasingFunction = exports.getEasingDuration = exports.easein = exports.convertToDash = exports.complexEasingSyntax = exports.Steps = exports.Spring = exports.Sine = exports.Quint = exports.Quart = exports.Quad = exports.INTINITE_LOOP_LIMIT = exports.Expo = exports.Elastic = exports.EasingFunctions = exports.EasingDurationCache = exports.EaseOutIn = exports.EaseOut = exports.EaseInOut = exports.Cubic = exports.Circ = exports.Bounce = exports.Bezier = exports.Back = void 0;
6
+ exports.parseEasingParameters = exports.limit = exports.getEasingFunction = exports.easein = exports.convertToDash = exports.complexEasingSyntax = exports.Steps = exports.Spring = exports.Sine = exports.Quint = exports.Quart = exports.Quad = exports.INTINITE_LOOP_LIMIT = exports.Expo = exports.Elastic = exports.EasingFunctions = exports.EasingDurationCache = exports.EaseOutIn = exports.EaseOut = exports.EaseInOut = exports.Cubic = exports.Circ = exports.Bounce = exports.Bezier = exports.Back = void 0;
7
7
 
8
8
  var _tslib = require("tslib");
9
9
 
@@ -177,46 +177,36 @@ var parseEasingParameters = function parseEasingParameters(str) {
177
177
  * easing functions, because of the nature of the function it can sometimes create an infinite loop, I suggest only using
178
178
  * `getEasingDuration` for `spring`, specifically 'out-spring' and 'spring'
179
179
  */
180
+ // export const getEasingDuration = (easing: string | TypeEasingFunction = 'spring') => {
181
+ // if (EasingDurationCache.has(easing)) return EasingDurationCache.get(easing);
182
+ // // eslint-disable-next-line @typescript-eslint/no-use-before-define
183
+ // const easingFunction = typeof easing == 'function' ? easing : getEasingFunction(easing as string);
184
+ // const params = typeof easing == 'function' ? [] : parseEasingParameters(easing);
185
+ // const frame = 1 / 6;
186
+ // let elapsed = 0;
187
+ // let rest = 0;
188
+ // let count = 0;
189
+ // while (++count < INTINITE_LOOP_LIMIT) {
190
+ // elapsed += frame;
191
+ // if (easingFunction(elapsed, params, undefined) === 1) {
192
+ // rest++;
193
+ // if (rest >= 16) break;
194
+ // } else {
195
+ // rest = 0;
196
+ // }
197
+ // }
198
+ // const duration = elapsed * frame * 1000;
199
+ // EasingDurationCache.set(easing, duration);
200
+ // return duration;
201
+ // };
180
202
 
181
-
182
- exports.parseEasingParameters = parseEasingParameters;
183
-
184
- var getEasingDuration = function getEasingDuration(easing) {
185
- if (easing === void 0) {
186
- easing = 'spring';
187
- }
188
-
189
- if (EasingDurationCache.has(easing)) return EasingDurationCache.get(easing); // eslint-disable-next-line @typescript-eslint/no-use-before-define
190
-
191
- var easingFunction = typeof easing == 'function' ? easing : getEasingFunction(easing);
192
- var params = typeof easing == 'function' ? [] : parseEasingParameters(easing);
193
- var frame = 1 / 6;
194
- var elapsed = 0;
195
- var rest = 0;
196
- var count = 0;
197
-
198
- while (++count < INTINITE_LOOP_LIMIT) {
199
- elapsed += frame;
200
-
201
- if (easingFunction(elapsed, params, undefined) === 1) {
202
- rest++;
203
- if (rest >= 16) break;
204
- } else {
205
- rest = 0;
206
- }
207
- }
208
-
209
- var duration = elapsed * frame * 1000;
210
- EasingDurationCache.set(easing, duration);
211
- return duration;
212
- };
213
203
  /**
214
204
  These Easing Functions are based off of the Sozi Project's easing functions
215
205
  https://github.com/sozi-projects/Sozi/blob/d72e44ebd580dc7579d1e177406ad41e632f961d/src/js/player/Timing.js
216
206
  */
217
207
 
218
208
 
219
- exports.getEasingDuration = getEasingDuration;
209
+ exports.parseEasingParameters = parseEasingParameters;
220
210
 
221
211
  var Steps = function Steps(t, params) {
222
212
  if (params === void 0) {
@@ -383,34 +373,20 @@ exports.complexEasingSyntax = complexEasingSyntax;
383
373
 
384
374
  var getEasingFunction = function getEasingFunction(ease) {
385
375
  return EasingFunctions[complexEasingSyntax(ease)] || EasingFunctions.linear;
386
- };
387
- /**
388
- * Allows you to register new easing functions
389
- */
390
-
391
-
392
- exports.getEasingFunction = getEasingFunction;
393
-
394
- var registerEasingFunction = function registerEasingFunction(key, fn) {
395
- var _a;
396
-
397
- Object.assign(EasingFunctions, (_a = {}, _a[key] = fn, _a));
398
- };
399
- /**
400
- * Allows you to register multiple new easing functions
401
- */
402
-
403
-
404
- exports.registerEasingFunction = registerEasingFunction;
405
-
406
- var registerEasingFunctions = function registerEasingFunctions() {
407
- var obj = [];
408
-
409
- for (var _i = 0; _i < arguments.length; _i++) {
410
- obj[_i] = arguments[_i];
411
- }
412
-
413
- Object.assign.apply(Object, (0, _tslib.__spreadArray)([EasingFunctions], (0, _tslib.__read)(obj), false));
414
- };
415
-
416
- exports.registerEasingFunctions = registerEasingFunctions;
376
+ }; // /**
377
+ // * Allows you to register new easing functions
378
+ // */
379
+ // export const registerEasingFunction = (key: string, fn: TypeEasingFunction) => {
380
+ // Object.assign(EasingFunctions, {
381
+ // [key]: fn,
382
+ // });
383
+ // };
384
+ // /**
385
+ // * Allows you to register multiple new easing functions
386
+ // */
387
+ // export const registerEasingFunctions = (...obj: typeof EasingFunctions[]) => {
388
+ // Object.assign(EasingFunctions, ...obj);
389
+ // };
390
+
391
+
392
+ exports.getEasingFunction = getEasingFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.21",
3
+ "version": "5.0.22-alpha.0",
4
4
  "description": "A core module including ECS and DI container.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "homepage": "https://github.com/antvis/g#readme",
39
39
  "dependencies": {
40
- "@antv/g-math": "^1.0.18",
40
+ "@antv/g-math": "^1.0.19-alpha.0",
41
41
  "@antv/path-util": "^2.0.14",
42
42
  "@antv/util": "^2.0.13",
43
43
  "@types/offscreencanvas": "^2019.6.4",
@@ -53,5 +53,5 @@
53
53
  "scripts": {
54
54
  "umd": "webpack"
55
55
  },
56
- "gitHead": "cc8e74c562a0cb5b5fab1063510c4c9fc9aae360"
56
+ "gitHead": "165c34e1ec5e28cdf6e52b996fdd6a0d8d0f2609"
57
57
  }