@antv/g 5.0.21 → 5.0.22-alpha.2

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 (265) hide show
  1. package/es/AbstractRenderer.js +1 -3
  2. package/es/Canvas.js +7 -11
  3. package/es/DisplayObjectPool.js +1 -3
  4. package/es/camera/Camera.d.ts +12 -7
  5. package/es/camera/Camera.js +54 -24
  6. package/es/camera/Landmark.d.ts +2 -0
  7. package/es/camera/Landmark.js +10 -6
  8. package/es/components/Cullable.js +1 -3
  9. package/es/components/Geometry.js +1 -3
  10. package/es/components/Renderable.js +1 -3
  11. package/es/components/Sortable.js +1 -3
  12. package/es/components/Transform.js +1 -3
  13. package/es/css/LayoutRegistry.js +1 -3
  14. package/es/css/StyleValueRegistry.js +1 -3
  15. package/es/css/cssom/CSSColorValue.js +1 -3
  16. package/es/css/cssom/CSSGradientValue.js +6 -8
  17. package/es/css/cssom/CSSKeywordValue.js +1 -3
  18. package/es/css/cssom/CSSMathInvert.js +1 -3
  19. package/es/css/cssom/CSSMathMax.js +1 -3
  20. package/es/css/cssom/CSSMathMin.js +1 -3
  21. package/es/css/cssom/CSSMathNegate.js +1 -3
  22. package/es/css/cssom/CSSMathProduct.js +1 -3
  23. package/es/css/cssom/CSSMathSum.js +1 -3
  24. package/es/css/cssom/CSSMathValue.js +1 -3
  25. package/es/css/cssom/CSSMathVariadic.js +1 -3
  26. package/es/css/cssom/CSSNumericValue.js +1 -3
  27. package/es/css/cssom/CSSNumericValueType.d.ts +1 -1
  28. package/es/css/cssom/CSSNumericValueType.js +1 -3
  29. package/es/css/cssom/CSSRGB.js +2 -4
  30. package/es/css/cssom/CSSStyleValue.d.ts +2 -2
  31. package/es/css/cssom/CSSStyleValue.js +2 -4
  32. package/es/css/cssom/CSSTransformComponent.js +1 -3
  33. package/es/css/cssom/CSSTransformValue.js +1 -3
  34. package/es/css/cssom/CSSTranslate.js +1 -3
  35. package/es/css/cssom/CSSUnitValue.js +2 -4
  36. package/es/css/parser/color.js +1 -1
  37. package/es/css/parser/dimension.js +1 -1
  38. package/es/css/parser/transform.d.ts +1 -1
  39. package/es/css/parser/transform.js +2 -2
  40. package/es/css/properties/CSSPropertyAnchor.js +1 -3
  41. package/es/css/properties/CSSPropertyClipPath.js +1 -3
  42. package/es/css/properties/CSSPropertyColor.js +1 -3
  43. package/es/css/properties/CSSPropertyFilter.js +1 -3
  44. package/es/css/properties/CSSPropertyLengthOrPercentage.js +1 -3
  45. package/es/css/properties/CSSPropertyLineDash.js +1 -3
  46. package/es/css/properties/CSSPropertyLocalPosition.js +1 -3
  47. package/es/css/properties/CSSPropertyOffsetDistance.js +1 -3
  48. package/es/css/properties/CSSPropertyOffsetPath.js +1 -3
  49. package/es/css/properties/CSSPropertyOpacity.js +1 -3
  50. package/es/css/properties/CSSPropertyPath.js +1 -3
  51. package/es/css/properties/CSSPropertyPoints.js +1 -3
  52. package/es/css/properties/CSSPropertyShadowBlur.js +1 -3
  53. package/es/css/properties/CSSPropertyText.js +2 -4
  54. package/es/css/properties/CSSPropertyTextTransform.js +1 -3
  55. package/es/css/properties/CSSPropertyTransform.js +1 -3
  56. package/es/css/properties/CSSPropertyTransformOrigin.js +1 -3
  57. package/es/css/properties/CSSPropertyVisibility.js +1 -3
  58. package/es/css/properties/CSSPropertyZIndex.js +1 -3
  59. package/es/display-objects/Circle.js +1 -3
  60. package/es/display-objects/CustomElement.js +1 -3
  61. package/es/display-objects/DisplayObject.js +10 -8
  62. package/es/display-objects/Ellipse.js +1 -3
  63. package/es/display-objects/Group.js +1 -3
  64. package/es/display-objects/HTML.js +3 -6
  65. package/es/display-objects/Image.js +1 -3
  66. package/es/display-objects/Line.js +1 -3
  67. package/es/display-objects/Path.js +1 -3
  68. package/es/display-objects/Polygon.js +1 -3
  69. package/es/display-objects/Polyline.js +1 -3
  70. package/es/display-objects/Rect.js +1 -3
  71. package/es/display-objects/Text.js +3 -6
  72. package/es/dom/Animation.js +2 -4
  73. package/es/dom/AnimationEffectTiming.js +1 -3
  74. package/es/dom/AnimationEvent.js +1 -3
  75. package/es/dom/AnimationTimeline.js +1 -3
  76. package/es/dom/CustomElementRegistry.js +1 -3
  77. package/es/dom/CustomEvent.js +1 -3
  78. package/es/dom/Document.js +1 -3
  79. package/es/dom/Element.js +4 -6
  80. package/es/dom/EventTarget.js +3 -5
  81. package/es/dom/FederatedEvent.js +1 -3
  82. package/es/dom/FederatedMouseEvent.js +1 -3
  83. package/es/dom/FederatedPointerEvent.js +1 -3
  84. package/es/dom/FederatedWheelEvent.js +1 -3
  85. package/es/dom/KeyframeEffect.js +1 -3
  86. package/es/dom/KeyframeList.js +1 -1
  87. package/es/dom/MutationEvent.js +1 -3
  88. package/es/dom/MutationObserver.js +3 -10
  89. package/es/dom/MutationRecord.js +1 -3
  90. package/es/dom/Node.js +2 -4
  91. package/es/plugins/CullingPlugin.js +1 -3
  92. package/es/plugins/DirtyCheckPlugin.js +1 -3
  93. package/es/plugins/EventPlugin.js +5 -4
  94. package/es/plugins/FrustumCullingStrategy.js +1 -3
  95. package/es/plugins/PrepareRendererPlugin.js +1 -3
  96. package/es/services/EventService.js +26 -7
  97. package/es/services/OffscreenCanvasCreator.js +1 -3
  98. package/es/services/RenderingContext.d.ts +2 -1
  99. package/es/services/RenderingContext.js +3 -1
  100. package/es/services/RenderingService.js +1 -3
  101. package/es/services/SceneGraphSelector.js +1 -3
  102. package/es/services/SceneGraphService.d.ts +2 -1
  103. package/es/services/SceneGraphService.js +3 -5
  104. package/es/services/TextService.js +3 -5
  105. package/es/services/aabb/CircleUpdater.js +1 -3
  106. package/es/services/aabb/EllipseUpdater.js +1 -3
  107. package/es/services/aabb/LineUpdater.js +1 -3
  108. package/es/services/aabb/PathUpdater.js +1 -3
  109. package/es/services/aabb/PolylineUpdater.js +1 -3
  110. package/es/services/aabb/RectUpdater.js +1 -3
  111. package/es/services/aabb/TextUpdater.js +1 -3
  112. package/es/services/aabb/interfaces.d.ts +3 -2
  113. package/es/services/aabb/interfaces.js +3 -2
  114. package/es/shapes/AABB.js +1 -3
  115. package/es/shapes/BoundingSphere.js +1 -3
  116. package/es/shapes/Frustum.js +1 -3
  117. package/es/shapes/Plane.js +1 -3
  118. package/es/shapes/Point.js +1 -3
  119. package/es/shapes/Ray.js +1 -3
  120. package/es/shapes/Rectangle.js +1 -3
  121. package/es/types.d.ts +2 -1
  122. package/es/types.js +2 -1
  123. package/es/utils/custom-easing.d.ts +0 -9
  124. package/es/utils/custom-easing.js +38 -54
  125. package/es/utils/path.d.ts +1 -1
  126. package/es/utils/path.js +3 -3
  127. package/es/utils/text.js +3 -3
  128. package/lib/AbstractRenderer.js +1 -3
  129. package/lib/Canvas.js +8 -12
  130. package/lib/DisplayObjectPool.js +1 -3
  131. package/lib/camera/Camera.d.ts +12 -7
  132. package/lib/camera/Camera.js +59 -25
  133. package/lib/camera/Landmark.d.ts +2 -0
  134. package/lib/camera/Landmark.js +10 -6
  135. package/lib/components/Cullable.js +2 -4
  136. package/lib/components/Geometry.js +1 -3
  137. package/lib/components/Renderable.js +1 -3
  138. package/lib/components/Sortable.js +1 -3
  139. package/lib/components/Transform.js +1 -3
  140. package/lib/css/LayoutRegistry.js +1 -3
  141. package/lib/css/StyleValueRegistry.js +1 -3
  142. package/lib/css/cssom/CSSColorValue.js +1 -3
  143. package/lib/css/cssom/CSSGradientValue.js +7 -9
  144. package/lib/css/cssom/CSSKeywordValue.js +1 -3
  145. package/lib/css/cssom/CSSMathInvert.js +1 -3
  146. package/lib/css/cssom/CSSMathMax.js +1 -3
  147. package/lib/css/cssom/CSSMathMin.js +1 -3
  148. package/lib/css/cssom/CSSMathNegate.js +1 -3
  149. package/lib/css/cssom/CSSMathOperator.js +1 -1
  150. package/lib/css/cssom/CSSMathProduct.js +1 -3
  151. package/lib/css/cssom/CSSMathSum.js +1 -3
  152. package/lib/css/cssom/CSSMathValue.js +1 -3
  153. package/lib/css/cssom/CSSMathVariadic.js +2 -4
  154. package/lib/css/cssom/CSSNumericValue.js +1 -3
  155. package/lib/css/cssom/CSSNumericValueType.d.ts +1 -1
  156. package/lib/css/cssom/CSSNumericValueType.js +3 -5
  157. package/lib/css/cssom/CSSRGB.js +2 -4
  158. package/lib/css/cssom/CSSStyleValue.d.ts +2 -2
  159. package/lib/css/cssom/CSSStyleValue.js +108 -110
  160. package/lib/css/cssom/CSSTransformComponent.js +2 -4
  161. package/lib/css/cssom/CSSTransformValue.js +1 -3
  162. package/lib/css/cssom/CSSTranslate.js +1 -3
  163. package/lib/css/cssom/CSSUnitValue.js +2 -4
  164. package/lib/css/cssom/types.js +1 -1
  165. package/lib/css/parser/color.js +3 -3
  166. package/lib/css/parser/dimension.js +6 -7
  167. package/lib/css/parser/numeric.js +3 -3
  168. package/lib/css/parser/path.js +1 -1
  169. package/lib/css/parser/transform.d.ts +1 -1
  170. package/lib/css/parser/transform.js +11 -11
  171. package/lib/css/properties/CSSPropertyAnchor.js +1 -3
  172. package/lib/css/properties/CSSPropertyClipPath.js +1 -3
  173. package/lib/css/properties/CSSPropertyColor.js +1 -3
  174. package/lib/css/properties/CSSPropertyFilter.js +1 -3
  175. package/lib/css/properties/CSSPropertyLengthOrPercentage.js +1 -3
  176. package/lib/css/properties/CSSPropertyLineDash.js +1 -3
  177. package/lib/css/properties/CSSPropertyLocalPosition.js +1 -3
  178. package/lib/css/properties/CSSPropertyOffsetDistance.js +1 -3
  179. package/lib/css/properties/CSSPropertyOffsetPath.js +1 -3
  180. package/lib/css/properties/CSSPropertyOpacity.js +1 -3
  181. package/lib/css/properties/CSSPropertyPath.js +1 -3
  182. package/lib/css/properties/CSSPropertyPoints.js +1 -3
  183. package/lib/css/properties/CSSPropertyShadowBlur.js +1 -3
  184. package/lib/css/properties/CSSPropertyText.js +2 -4
  185. package/lib/css/properties/CSSPropertyTextTransform.js +1 -3
  186. package/lib/css/properties/CSSPropertyTransform.js +1 -3
  187. package/lib/css/properties/CSSPropertyTransformOrigin.js +1 -3
  188. package/lib/css/properties/CSSPropertyVisibility.js +1 -3
  189. package/lib/css/properties/CSSPropertyZIndex.js +1 -3
  190. package/lib/display-objects/Circle.js +1 -3
  191. package/lib/display-objects/CustomElement.js +1 -3
  192. package/lib/display-objects/DisplayObject.js +9 -7
  193. package/lib/display-objects/Ellipse.js +1 -3
  194. package/lib/display-objects/Group.js +1 -3
  195. package/lib/display-objects/HTML.js +4 -6
  196. package/lib/display-objects/Image.js +1 -3
  197. package/lib/display-objects/Line.js +1 -3
  198. package/lib/display-objects/Path.js +1 -3
  199. package/lib/display-objects/Polygon.js +1 -3
  200. package/lib/display-objects/Polyline.js +1 -3
  201. package/lib/display-objects/Rect.js +1 -3
  202. package/lib/display-objects/Text.js +4 -6
  203. package/lib/dom/Animation.js +2 -4
  204. package/lib/dom/AnimationEffectTiming.js +1 -3
  205. package/lib/dom/AnimationEvent.js +1 -3
  206. package/lib/dom/AnimationTimeline.js +2 -4
  207. package/lib/dom/CustomElementRegistry.js +1 -3
  208. package/lib/dom/CustomEvent.js +1 -3
  209. package/lib/dom/Document.js +1 -3
  210. package/lib/dom/Element.js +4 -6
  211. package/lib/dom/EventTarget.js +3 -5
  212. package/lib/dom/FederatedEvent.js +1 -3
  213. package/lib/dom/FederatedMouseEvent.js +1 -3
  214. package/lib/dom/FederatedPointerEvent.js +1 -3
  215. package/lib/dom/FederatedWheelEvent.js +1 -3
  216. package/lib/dom/KeyframeEffect.js +2 -4
  217. package/lib/dom/KeyframeList.js +1 -1
  218. package/lib/dom/MutationEvent.js +1 -3
  219. package/lib/dom/MutationObserver.js +4 -11
  220. package/lib/dom/MutationRecord.js +1 -3
  221. package/lib/dom/Node.js +2 -4
  222. package/lib/index.js +1 -1
  223. package/lib/plugins/CullingPlugin.js +2 -4
  224. package/lib/plugins/DirtyCheckPlugin.js +1 -3
  225. package/lib/plugins/EventPlugin.js +5 -4
  226. package/lib/plugins/FrustumCullingStrategy.js +1 -3
  227. package/lib/plugins/PrepareRendererPlugin.js +1 -3
  228. package/lib/services/EventService.js +26 -7
  229. package/lib/services/OffscreenCanvasCreator.js +1 -3
  230. package/lib/services/RenderingContext.d.ts +2 -1
  231. package/lib/services/RenderingContext.js +4 -1
  232. package/lib/services/RenderingService.js +1 -3
  233. package/lib/services/SceneGraphSelector.js +2 -4
  234. package/lib/services/SceneGraphService.d.ts +2 -1
  235. package/lib/services/SceneGraphService.js +5 -6
  236. package/lib/services/TextService.js +3 -5
  237. package/lib/services/aabb/CircleUpdater.js +1 -3
  238. package/lib/services/aabb/EllipseUpdater.js +1 -3
  239. package/lib/services/aabb/LineUpdater.js +1 -3
  240. package/lib/services/aabb/PathUpdater.js +1 -3
  241. package/lib/services/aabb/PolylineUpdater.js +1 -3
  242. package/lib/services/aabb/RectUpdater.js +1 -3
  243. package/lib/services/aabb/TextUpdater.js +1 -3
  244. package/lib/services/aabb/index.js +10 -10
  245. package/lib/services/aabb/interfaces.d.ts +3 -2
  246. package/lib/services/aabb/interfaces.js +9 -3
  247. package/lib/shapes/AABB.js +1 -3
  248. package/lib/shapes/BoundingSphere.js +1 -3
  249. package/lib/shapes/Frustum.js +2 -4
  250. package/lib/shapes/Plane.js +1 -3
  251. package/lib/shapes/Point.js +1 -3
  252. package/lib/shapes/Ray.js +1 -3
  253. package/lib/shapes/Rectangle.js +1 -3
  254. package/lib/types.d.ts +2 -1
  255. package/lib/types.js +6 -2
  256. package/lib/utils/animation.js +2 -3
  257. package/lib/utils/bezier-easing.js +1 -1
  258. package/lib/utils/custom-easing.d.ts +0 -9
  259. package/lib/utils/custom-easing.js +42 -66
  260. package/lib/utils/math.js +9 -9
  261. package/lib/utils/path.d.ts +1 -1
  262. package/lib/utils/path.js +6 -6
  263. package/lib/utils/text.js +3 -3
  264. package/package.json +3 -3
  265. package/dist/index.umd.min.js +0 -30
@@ -1,8 +1,6 @@
1
1
  import { __assign } from "tslib";
2
2
 
3
- var AbstractRenderer =
4
- /** @class */
5
- function () {
3
+ var AbstractRenderer = function () {
6
4
  function AbstractRenderer(config) {
7
5
  this.plugins = [];
8
6
  this.config = __assign({
package/es/Canvas.js CHANGED
@@ -32,9 +32,7 @@ export var CanvasEvent;
32
32
  */
33
33
 
34
34
 
35
- var Canvas =
36
- /** @class */
37
- function (_super) {
35
+ var Canvas = function (_super) {
38
36
  __extends(Canvas, _super);
39
37
 
40
38
  function Canvas(config) {
@@ -89,20 +87,18 @@ function (_super) {
89
87
 
90
88
 
91
89
  _this.devicePixelRatio = dpr;
92
- _this.requestAnimationFrame = requestAnimationFrame || rAF.bind(globalThis);
93
- _this.cancelAnimationFrame = cancelAnimationFrame || cancelRAF.bind(globalThis);
90
+ _this.requestAnimationFrame = requestAnimationFrame !== null && requestAnimationFrame !== void 0 ? requestAnimationFrame : rAF.bind(globalThis);
91
+ _this.cancelAnimationFrame = cancelAnimationFrame !== null && cancelAnimationFrame !== void 0 ? cancelAnimationFrame : cancelRAF.bind(globalThis);
94
92
  /**
95
93
  * limits query
96
94
  */
97
95
 
98
- _this.supportTouchEvent = supportTouchEvent || 'ontouchstart' in globalThis;
99
- _this.supportPointerEvent = supportPointerEvent || !!globalThis.PointerEvent;
100
-
101
- _this.isTouchEvent = isTouchEvent || function (event) {
96
+ _this.supportTouchEvent = supportTouchEvent !== null && supportTouchEvent !== void 0 ? supportTouchEvent : 'ontouchstart' in globalThis;
97
+ _this.supportPointerEvent = supportPointerEvent !== null && supportPointerEvent !== void 0 ? supportPointerEvent : !!globalThis.PointerEvent;
98
+ _this.isTouchEvent = isTouchEvent !== null && isTouchEvent !== void 0 ? isTouchEvent : function (event) {
102
99
  return _this.supportTouchEvent && event instanceof globalThis.TouchEvent;
103
100
  };
104
-
105
- _this.isMouseEvent = isMouseEvent || function (event) {
101
+ _this.isMouseEvent = isMouseEvent !== null && isMouseEvent !== void 0 ? isMouseEvent : function (event) {
106
102
  return !globalThis.MouseEvent || event instanceof globalThis.MouseEvent && (!_this.supportPointerEvent || !(event instanceof globalThis.PointerEvent));
107
103
  };
108
104
 
@@ -1,9 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { singleton } from 'mana-syringe';
3
3
 
4
- var DisplayObjectPool =
5
- /** @class */
6
- function () {
4
+ var DisplayObjectPool = function () {
7
5
  function DisplayObjectPool() {
8
6
  this.pool = {};
9
7
  }
@@ -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
  */
@@ -4,7 +4,10 @@ import { mat3, mat4, quat, vec3, vec4 } from 'gl-matrix';
4
4
  import { Landmark } from './Landmark';
5
5
  import { Frustum } from '../shapes';
6
6
  import { createVec3, getAngle, makePerspective } from '../utils/math';
7
- export var DefaultCamera = 'DefaultCamera';
7
+ import { parseEasingFunction } from '../utils/animation';
8
+ import { isNumber, isString, isUndefined } from '@antv/util';
9
+ import { Syringe } from 'mana-syringe';
10
+ export var DefaultCamera = Syringe.defineToken('DefaultCamera');
8
11
  export var CAMERA_TYPE;
9
12
 
10
13
  (function (CAMERA_TYPE) {
@@ -43,9 +46,7 @@ var RAD_2_DEG = 180 / Math.PI;
43
46
  * 4. 移动到 Landmark,具有平滑的动画效果,其间禁止其他用户交互
44
47
  */
45
48
 
46
- var Camera =
47
- /** @class */
48
- function (_super) {
49
+ var Camera = function (_super) {
49
50
  __extends(Camera, _super);
50
51
 
51
52
  function Camera() {
@@ -139,8 +140,8 @@ function (_super) {
139
140
  _this.aspect = 1;
140
141
  _this.projectionMatrix = mat4.create();
141
142
  _this.projectionMatrixInverse = mat4.create();
142
- _this.jitteredProjectionMatrix = undefined;
143
- _this.following = undefined;
143
+ _this.jitteredProjectionMatrix = undefined; // private following = undefined;
144
+
144
145
  _this.type = CAMERA_TYPE.EXPLORING;
145
146
  _this.trackingMode = CAMERA_TRACKING_MODE.DEFAULT;
146
147
  _this.projectionMode = CAMERA_PROJECTION_MODE.PERSPECTIVE;
@@ -729,12 +730,24 @@ function (_super) {
729
730
  };
730
731
 
731
732
  Camera.prototype.createLandmark = function (name, params) {
733
+ if (params === void 0) {
734
+ params = {};
735
+ }
736
+
737
+ var position = params.position,
738
+ focalPoint = params.focalPoint,
739
+ roll = params.roll,
740
+ zoom = params.zoom;
732
741
  var camera = this.clone();
733
- camera.setPosition(params.position);
734
- camera.setFocalPoint(params.focalPoint);
742
+ camera.setPosition(vec3.fromValues(position[0], position[1], position[2] || this.position[2]));
743
+ camera.setFocalPoint(vec3.fromValues(focalPoint[0], focalPoint[1], focalPoint[2] || this.focalPoint[2]));
744
+
745
+ if (!isUndefined(roll)) {
746
+ camera.setRoll(roll);
747
+ }
735
748
 
736
- if (params.roll !== undefined) {
737
- camera.setRoll(params.roll);
749
+ if (!isUndefined(zoom)) {
750
+ camera.setZoom(zoom);
738
751
  }
739
752
 
740
753
  var landmark = new Landmark(name, camera);
@@ -748,19 +761,29 @@ function (_super) {
748
761
  return this;
749
762
  };
750
763
 
751
- Camera.prototype.gotoLandmark = function (name, duration) {
764
+ Camera.prototype.gotoLandmark = function (name, options) {
752
765
  var _this = this;
753
766
 
754
- if (duration === void 0) {
755
- duration = 1000;
767
+ if (options === void 0) {
768
+ options = {};
756
769
  }
757
770
 
758
- var landmark = this.landmarks.find(function (l) {
771
+ var landmark = isString(name) ? this.landmarks.find(function (l) {
759
772
  return l.name === name;
760
- });
773
+ }) : name;
761
774
 
762
775
  if (landmark) {
763
- if (duration === 0) {
776
+ var _a = isNumber(options) ? {
777
+ duration: options
778
+ } : options,
779
+ _b = _a.easing,
780
+ easing = _b === void 0 ? 'ease' : _b,
781
+ _c = _a.duration,
782
+ duration_1 = _c === void 0 ? 1000 : _c;
783
+
784
+ var epsilon_1 = 0.01;
785
+
786
+ if (duration_1 === 0) {
764
787
  landmark.retrieve(this);
765
788
  return;
766
789
  }
@@ -773,7 +796,9 @@ function (_super) {
773
796
 
774
797
  var destPosition_1 = landmark.getPosition();
775
798
  var destFocalPoint_1 = landmark.getFocalPoint();
799
+ var destZoom_1 = landmark.getZoom();
776
800
  var destRoll_1 = landmark.getRoll();
801
+ var easingFunction_1 = parseEasingFunction(easing);
777
802
  var timeStart_1;
778
803
 
779
804
  var animate_1 = function animate_1(timestamp) {
@@ -781,15 +806,17 @@ function (_super) {
781
806
  timeStart_1 = timestamp;
782
807
  }
783
808
 
784
- var elapsed = timestamp - timeStart_1; // TODO: use better ease function
809
+ var elapsed = timestamp - timeStart_1; // use the same ease function in animatio system
785
810
 
786
- var t = (1 - Math.cos(elapsed / duration * Math.PI)) / 2;
811
+ var t = easingFunction_1(elapsed / duration_1);
787
812
  var interFocalPoint = vec3.create();
788
813
  var interPosition = vec3.create();
814
+ var interZoom = 1;
789
815
  var interRoll = 0;
790
816
  vec3.lerp(interFocalPoint, _this.focalPoint, destFocalPoint_1, t);
791
817
  vec3.lerp(interPosition, _this.position, destPosition_1, t);
792
818
  interRoll = _this.roll * (1 - t) + destRoll_1 * t;
819
+ interZoom = _this.zoom * (1 - t) + destZoom_1 * t;
793
820
 
794
821
  _this.setFocalPoint(interFocalPoint);
795
822
 
@@ -797,19 +824,22 @@ function (_super) {
797
824
 
798
825
  _this.setRoll(interRoll);
799
826
 
827
+ _this.setZoom(interZoom);
828
+
800
829
  _this.computeMatrix();
801
830
 
802
831
  _this.triggerUpdate();
803
832
 
804
833
  var dist = vec3.dist(interFocalPoint, destFocalPoint_1) + vec3.dist(interPosition, destPosition_1);
805
834
 
806
- if (dist > 0.01) {//
807
- } else {
808
- _this.setFocalPoint(interFocalPoint);
835
+ if (dist <= epsilon_1) {
836
+ _this.setFocalPoint(destFocalPoint_1);
837
+
838
+ _this.setPosition(destPosition_1);
809
839
 
810
- _this.setPosition(interPosition);
840
+ _this.setRoll(destRoll_1);
811
841
 
812
- _this.setRoll(interRoll);
842
+ _this.setZoom(destZoom_1);
813
843
 
814
844
  _this.computeMatrix(); // this.interactor.connect();
815
845
 
@@ -817,7 +847,7 @@ function (_super) {
817
847
  return;
818
848
  }
819
849
 
820
- if (elapsed < duration) {
850
+ if (elapsed < duration_1) {
821
851
  _this.landmarkAnimationID = _this.canvas.requestAnimationFrame(animate_1);
822
852
  }
823
853
  };
@@ -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
  }
@@ -3,10 +3,7 @@ import { mat4, vec3 } from 'gl-matrix';
3
3
  * 保存相机状态,便于后续在多个 Landmark 间移动
4
4
  */
5
5
 
6
- var Landmark =
7
- /** @class */
8
- function () {
9
- // private zoom = 1;
6
+ var Landmark = function () {
10
7
  function Landmark(name, c) {
11
8
  this.azimuth = 0;
12
9
  this.elevation = 0;
@@ -14,6 +11,7 @@ function () {
14
11
  this.relAzimuth = 0;
15
12
  this.relElevation = 0;
16
13
  this.relRoll = 0;
14
+ this.zoom = 1;
17
15
  this.name = name;
18
16
  this.matrix = mat4.clone(c.matrix);
19
17
  this.right = vec3.clone(c.right);
@@ -29,7 +27,8 @@ function () {
29
27
  this.relElevation = c.relElevation;
30
28
  this.relRoll = c.relRoll;
31
29
  this.dollyingStep = c.dollyingStep;
32
- this.distance = c.distance; // this.zoom = c.zoom;
30
+ this.distance = c.distance;
31
+ this.zoom = c.zoom;
33
32
  }
34
33
 
35
34
  Landmark.prototype.getPosition = function () {
@@ -44,6 +43,10 @@ function () {
44
43
  return this.roll;
45
44
  };
46
45
 
46
+ Landmark.prototype.getZoom = function () {
47
+ return this.zoom;
48
+ };
49
+
47
50
  Landmark.prototype.retrieve = function (c) {
48
51
  c.matrix = mat4.copy(c.matrix, this.matrix);
49
52
  c.right = vec3.copy(c.right, this.right);
@@ -59,7 +62,8 @@ function () {
59
62
  c.relElevation = this.relElevation;
60
63
  c.relRoll = this.relRoll;
61
64
  c.dollyingStep = this.dollyingStep;
62
- c.distance = this.distance; // c.zoom = this.zoom;
65
+ c.distance = this.distance;
66
+ c.zoom = this.zoom;
63
67
  };
64
68
 
65
69
  return Landmark;
@@ -7,9 +7,7 @@ export var Strategy;
7
7
  Strategy[Strategy["Standard"] = 0] = "Standard";
8
8
  })(Strategy || (Strategy = {}));
9
9
 
10
- var Cullable =
11
- /** @class */
12
- function () {
10
+ var Cullable = function () {
13
11
  function Cullable() {
14
12
  this.strategy = Strategy.Standard;
15
13
  this.visibilityPlaneMask = -1;
@@ -1,6 +1,4 @@
1
- var Geometry =
2
- /** @class */
3
- function () {
1
+ var Geometry = function () {
4
2
  function Geometry() {}
5
3
 
6
4
  Geometry.tag = 'c-geometry';
@@ -1,6 +1,4 @@
1
- var Renderable =
2
- /** @class */
3
- function () {
1
+ var Renderable = function () {
4
2
  function Renderable() {
5
3
  this.boundsDirty = true;
6
4
  this.renderBoundsDirty = true;
@@ -1,6 +1,4 @@
1
- var Sortable =
2
- /** @class */
3
- function () {
1
+ var Sortable = function () {
4
2
  function Sortable() {
5
3
  /**
6
4
  * need to re-sort
@@ -3,9 +3,7 @@ import { mat4, quat, vec3 } from 'gl-matrix';
3
3
  * do RTS transformation for 2D/3D
4
4
  */
5
5
 
6
- var Transform =
7
- /** @class */
8
- function () {
6
+ var Transform = function () {
9
7
  function Transform() {
10
8
  this.dirtyFlag = false;
11
9
  this.localDirtyFlag = false;
@@ -10,9 +10,7 @@ import { singleton } from 'mana-syringe';
10
10
  * group.style.display = 'layout(centering)';
11
11
  */
12
12
 
13
- var LayoutRegistry =
14
- /** @class */
15
- function () {
13
+ var LayoutRegistry = function () {
16
14
  function LayoutRegistry() {}
17
15
 
18
16
  LayoutRegistry = __decorate([singleton()], LayoutRegistry);
@@ -407,9 +407,7 @@ export var BUILT_IN_PROPERTIES = [{
407
407
  layoutDependent: true
408
408
  }];
409
409
 
410
- var StyleValueRegistry =
411
- /** @class */
412
- function () {
410
+ var StyleValueRegistry = function () {
413
411
  function StyleValueRegistry() {
414
412
  /**
415
413
  * need recalc later
@@ -6,9 +6,7 @@ import { CSSStyleValue, CSSStyleValueType } from './CSSStyleValue';
6
6
  * @see https://drafts.css-houdini.org/css-typed-om-1/#colorvalue-objects
7
7
  */
8
8
 
9
- var CSSColorValue =
10
- /** @class */
11
- function (_super) {
9
+ var CSSColorValue = function (_super) {
12
10
  __extends(CSSColorValue, _super);
13
11
 
14
12
  function CSSColorValue(colorSpace) {
@@ -9,9 +9,7 @@ export var GradientPatternType;
9
9
  GradientPatternType[GradientPatternType["Pattern"] = 3] = "Pattern";
10
10
  })(GradientPatternType || (GradientPatternType = {}));
11
11
 
12
- var CSSGradientValue =
13
- /** @class */
14
- function (_super) {
12
+ var CSSGradientValue = function (_super) {
15
13
  __extends(CSSGradientValue, _super);
16
14
 
17
15
  function CSSGradientValue(type, value) {
@@ -30,15 +28,15 @@ function (_super) {
30
28
  var text = '';
31
29
 
32
30
  if (this.type === GradientPatternType.LinearGradient) {
33
- text = "linear-gradient(".concat(this.value.steps.map(function (step) {
31
+ text = "linear-gradient(" + this.value.steps.map(function (step) {
34
32
  return step.join(',');
35
- }).join(','), ")");
33
+ }).join(',') + ")";
36
34
  } else if (this.type === GradientPatternType.RadialGradient) {
37
- text = "radial-gradient(".concat(this.value.steps.map(function (step) {
35
+ text = "radial-gradient(" + this.value.steps.map(function (step) {
38
36
  return step.join(',');
39
- }).join(','), ")");
37
+ }).join(',') + ")";
40
38
  } else if (this.type === GradientPatternType.Pattern) {
41
- text = "url(".concat(this.value.src, ")");
39
+ text = "url(" + this.value.src + ")";
42
40
  }
43
41
 
44
42
  return result += text;
@@ -7,9 +7,7 @@ import { CSSStyleValue, CSSStyleValueType } from './CSSStyleValue';
7
7
  * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_keyword_value.idl
8
8
  */
9
9
 
10
- var CSSKeywordValue =
11
- /** @class */
12
- function (_super) {
10
+ var CSSKeywordValue = function (_super) {
13
11
  __extends(CSSKeywordValue, _super);
14
12
 
15
13
  function CSSKeywordValue(value) {
@@ -2,9 +2,7 @@ import { __extends } from "tslib";
2
2
  import { CSSMathValue } from './CSSMathValue';
3
3
  import { CSSNumericValueType, CSSStyleValueType, Nested, ParenLess } from '.';
4
4
 
5
- var CSSMathInvert =
6
- /** @class */
7
- function (_super) {
5
+ var CSSMathInvert = function (_super) {
8
6
  __extends(CSSMathInvert, _super);
9
7
 
10
8
  function CSSMathInvert(value, type) {
@@ -9,9 +9,7 @@ import { CSSMathVariadic } from './CSSMathVariadic';
9
9
  import { Nested, ParenLess, CSSNumericValueType, CSSStyleValueType, typeCheck } from '.'; // Represents the maximum of one or more CSSNumericValues.
10
10
  // @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
11
11
 
12
- var CSSMathMax =
13
- /** @class */
14
- function (_super) {
12
+ var CSSMathMax = function (_super) {
15
13
  __extends(CSSMathMax, _super);
16
14
 
17
15
  function CSSMathMax() {
@@ -10,9 +10,7 @@ import { CSSMathVariadic } from './CSSMathVariadic';
10
10
  import { CSSNumericValueType, CSSStyleValueType, typeCheck, Nested, ParenLess } from '.'; // Represents the minimum of one or more CSSNumericValues.
11
11
  // @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
12
12
 
13
- var CSSMathMin =
14
- /** @class */
15
- function (_super) {
13
+ var CSSMathMin = function (_super) {
16
14
  __extends(CSSMathMin, _super);
17
15
 
18
16
  function CSSMathMin() {
@@ -2,9 +2,7 @@ import { __extends } from "tslib";
2
2
  import { CSSMathValue } from './CSSMathValue';
3
3
  import { Nested, ParenLess, CSSStyleValueType } from '.';
4
4
 
5
- var CSSMathNegate =
6
- /** @class */
7
- function (_super) {
5
+ var CSSMathNegate = function (_super) {
8
6
  __extends(CSSMathNegate, _super);
9
7
 
10
8
  function CSSMathNegate(value, type) {
@@ -7,9 +7,7 @@ import { typeCheck, CSSStyleValueType, CSSNumericValueType, Nested, ParenLess }
7
7
  * @see https://drafts.css-houdini.org/css-typed-om/#cssmathproduct
8
8
  */
9
9
 
10
- var CSSMathProduct =
11
- /** @class */
12
- function (_super) {
10
+ var CSSMathProduct = function (_super) {
13
11
  __extends(CSSMathProduct, _super);
14
12
 
15
13
  function CSSMathProduct() {
@@ -7,9 +7,7 @@ import { typeCheck, CSSStyleValueType, CSSNumericValueType, Nested, ParenLess }
7
7
  * @see https://drafts.css-houdini.org/css-typed-om/#cssmathsum
8
8
  */
9
9
 
10
- var CSSMathSum =
11
- /** @class */
12
- function (_super) {
10
+ var CSSMathSum = function (_super) {
13
11
  __extends(CSSMathSum, _super);
14
12
 
15
13
  function CSSMathSum() {
@@ -7,9 +7,7 @@ import { CSSNumericValue } from './CSSNumericValue';
7
7
  * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_math_value.idl
8
8
  */
9
9
 
10
- var CSSMathValue =
11
- /** @class */
12
- function (_super) {
10
+ var CSSMathValue = function (_super) {
13
11
  __extends(CSSMathValue, _super);
14
12
 
15
13
  function CSSMathValue() {
@@ -12,9 +12,7 @@ export function typeCheck(values, op, error) {
12
12
  return final_type;
13
13
  } // Represents an arithmetic operation with one or more CSSNumericValues.
14
14
 
15
- var CSSMathVariadic =
16
- /** @class */
17
- function (_super) {
15
+ var CSSMathVariadic = function (_super) {
18
16
  __extends(CSSMathVariadic, _super);
19
17
 
20
18
  function CSSMathVariadic(values, type) {
@@ -9,9 +9,7 @@ import { UnitType, CSSStyleValueType, BaseType, baseTypeToString, CSSUnitValue,
9
9
  * @see https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/blink/renderer/core/css/cssom/css_numeric_value.idl
10
10
  */
11
11
 
12
- var CSSNumericValue =
13
- /** @class */
14
- function (_super) {
12
+ var CSSNumericValue = function (_super) {
15
13
  __extends(CSSNumericValue, _super);
16
14
 
17
15
  function CSSNumericValue(type_) {
@@ -10,7 +10,7 @@ export declare enum BaseType {
10
10
  kNumBaseTypes = 7
11
11
  }
12
12
  export declare function unitTypeToBaseType(unit: UnitType): BaseType.kLength | BaseType.kAngle | BaseType.kTime | BaseType.kFrequency | BaseType.kResolution | BaseType.kFlex | BaseType.kPercent;
13
- export declare function baseTypeToString(baseType: BaseType): "" | "percent" | "length" | "angle" | "time" | "frequency" | "resolution" | "flex";
13
+ export declare function baseTypeToString(baseType: BaseType): "" | "time" | "flex" | "percent" | "length" | "angle" | "frequency" | "resolution";
14
14
  export declare class CSSNumericValueType {
15
15
  private exponents;
16
16
  private numNonZeroEntries;
@@ -121,9 +121,7 @@ export function baseTypeToString(baseType) {
121
121
  return '';
122
122
  }
123
123
 
124
- var CSSNumericValueType =
125
- /** @class */
126
- function () {
124
+ var CSSNumericValueType = function () {
127
125
  function CSSNumericValueType(unit, exponent) {
128
126
  if (unit === void 0) {
129
127
  unit = UnitType.kNumber;
@@ -6,9 +6,7 @@ import { CSSColorValue } from './CSSColorValue';
6
6
  * @see https://drafts.css-houdini.org/css-typed-om-1/#cssrgb
7
7
  */
8
8
 
9
- var CSSRGB =
10
- /** @class */
11
- function (_super) {
9
+ var CSSRGB = function (_super) {
12
10
  __extends(CSSRGB, _super);
13
11
 
14
12
  function CSSRGB(r, g, b, alpha,
@@ -39,7 +37,7 @@ function (_super) {
39
37
  };
40
38
 
41
39
  CSSRGB.prototype.buildCSSText = function (n, p, result) {
42
- return result + "rgba(".concat(this.r, ",").concat(this.g, ",").concat(this.b, ",").concat(this.alpha, ")");
40
+ return result + ("rgba(" + this.r + "," + this.g + "," + this.b + "," + this.alpha + ")");
43
41
  };
44
42
 
45
43
  return CSSRGB;
@@ -1,4 +1,4 @@
1
- import { Nested, ParenLess, UnitType, UnitCategory } from '.';
1
+ import { Nested, ParenLess, UnitType, UnitCategory } from './types';
2
2
  export declare enum CSSStyleValueType {
3
3
  kUnknownType = 0,
4
4
  kUnparsedType = 1,
@@ -29,7 +29,7 @@ export declare abstract class CSSStyleValue {
29
29
  static parseAll(propertyName: string, value: string): CSSStyleValue[];
30
30
  static unitFromName(name: string): UnitType;
31
31
  static unitTypeToUnitCategory(type: UnitType): UnitCategory;
32
- static unitTypeToString(type: UnitType): "" | "em" | "px" | "deg" | "rad" | "grad" | "ms" | "s" | "rem" | "turn" | "%";
32
+ static unitTypeToString(type: UnitType): "" | "em" | "s" | "px" | "deg" | "rad" | "grad" | "ms" | "rem" | "turn" | "%";
33
33
  static stringToUnitType(name: string): UnitType;
34
34
  static canonicalUnitTypeForCategory(category: UnitCategory): UnitType.kUnknown | UnitType.kNumber | UnitType.kPixels | UnitType.kDegrees | UnitType.kSeconds | UnitType.kHertz | UnitType.kDotsPerPixel;
35
35
  /**
@@ -1,7 +1,7 @@
1
1
  // import type { CSSValue } from '../CSSValue';
2
2
  // import { CSSPropertyID, cssPropertyID } from '../properties/CSSPropertyNames';
3
3
  // import { fromString } from '../parser/StyleValueFactory';
4
- import { Nested, ParenLess, UnitType, UnitCategory } from '.'; // This file specifies the unit strings used in CSSPrimitiveValues.
4
+ import { Nested, ParenLess, UnitType, UnitCategory } from './types'; // This file specifies the unit strings used in CSSPrimitiveValues.
5
5
 
6
6
  var data = [{
7
7
  name: 'em',
@@ -256,9 +256,7 @@ function parseCSSStyleValue(propertyName, value) {
256
256
  */
257
257
 
258
258
 
259
- var CSSStyleValue =
260
- /** @class */
261
- function () {
259
+ var CSSStyleValue = function () {
262
260
  function CSSStyleValue() {}
263
261
 
264
262
  CSSStyleValue.parse = function (propertyName, value) {