@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.
- package/es/AbstractRenderer.js +1 -3
- package/es/Canvas.js +7 -11
- package/es/DisplayObjectPool.js +1 -3
- package/es/camera/Camera.d.ts +12 -7
- package/es/camera/Camera.js +54 -24
- package/es/camera/Landmark.d.ts +2 -0
- package/es/camera/Landmark.js +10 -6
- package/es/components/Cullable.js +1 -3
- package/es/components/Geometry.js +1 -3
- package/es/components/Renderable.js +1 -3
- package/es/components/Sortable.js +1 -3
- package/es/components/Transform.js +1 -3
- package/es/css/LayoutRegistry.js +1 -3
- package/es/css/StyleValueRegistry.js +1 -3
- package/es/css/cssom/CSSColorValue.js +1 -3
- package/es/css/cssom/CSSGradientValue.js +6 -8
- package/es/css/cssom/CSSKeywordValue.js +1 -3
- package/es/css/cssom/CSSMathInvert.js +1 -3
- package/es/css/cssom/CSSMathMax.js +1 -3
- package/es/css/cssom/CSSMathMin.js +1 -3
- package/es/css/cssom/CSSMathNegate.js +1 -3
- package/es/css/cssom/CSSMathProduct.js +1 -3
- package/es/css/cssom/CSSMathSum.js +1 -3
- package/es/css/cssom/CSSMathValue.js +1 -3
- package/es/css/cssom/CSSMathVariadic.js +1 -3
- package/es/css/cssom/CSSNumericValue.js +1 -3
- package/es/css/cssom/CSSNumericValueType.d.ts +1 -1
- package/es/css/cssom/CSSNumericValueType.js +1 -3
- package/es/css/cssom/CSSRGB.js +2 -4
- package/es/css/cssom/CSSStyleValue.d.ts +2 -2
- package/es/css/cssom/CSSStyleValue.js +2 -4
- package/es/css/cssom/CSSTransformComponent.js +1 -3
- package/es/css/cssom/CSSTransformValue.js +1 -3
- package/es/css/cssom/CSSTranslate.js +1 -3
- package/es/css/cssom/CSSUnitValue.js +2 -4
- package/es/css/parser/color.js +1 -1
- package/es/css/parser/dimension.js +1 -1
- package/es/css/parser/transform.d.ts +1 -1
- package/es/css/parser/transform.js +2 -2
- package/es/css/properties/CSSPropertyAnchor.js +1 -3
- package/es/css/properties/CSSPropertyClipPath.js +1 -3
- package/es/css/properties/CSSPropertyColor.js +1 -3
- package/es/css/properties/CSSPropertyFilter.js +1 -3
- package/es/css/properties/CSSPropertyLengthOrPercentage.js +1 -3
- package/es/css/properties/CSSPropertyLineDash.js +1 -3
- package/es/css/properties/CSSPropertyLocalPosition.js +1 -3
- package/es/css/properties/CSSPropertyOffsetDistance.js +1 -3
- package/es/css/properties/CSSPropertyOffsetPath.js +1 -3
- package/es/css/properties/CSSPropertyOpacity.js +1 -3
- package/es/css/properties/CSSPropertyPath.js +1 -3
- package/es/css/properties/CSSPropertyPoints.js +1 -3
- package/es/css/properties/CSSPropertyShadowBlur.js +1 -3
- package/es/css/properties/CSSPropertyText.js +2 -4
- package/es/css/properties/CSSPropertyTextTransform.js +1 -3
- package/es/css/properties/CSSPropertyTransform.js +1 -3
- package/es/css/properties/CSSPropertyTransformOrigin.js +1 -3
- package/es/css/properties/CSSPropertyVisibility.js +1 -3
- package/es/css/properties/CSSPropertyZIndex.js +1 -3
- package/es/display-objects/Circle.js +1 -3
- package/es/display-objects/CustomElement.js +1 -3
- package/es/display-objects/DisplayObject.js +10 -8
- package/es/display-objects/Ellipse.js +1 -3
- package/es/display-objects/Group.js +1 -3
- package/es/display-objects/HTML.js +3 -6
- package/es/display-objects/Image.js +1 -3
- package/es/display-objects/Line.js +1 -3
- package/es/display-objects/Path.js +1 -3
- package/es/display-objects/Polygon.js +1 -3
- package/es/display-objects/Polyline.js +1 -3
- package/es/display-objects/Rect.js +1 -3
- package/es/display-objects/Text.js +3 -6
- package/es/dom/Animation.js +2 -4
- package/es/dom/AnimationEffectTiming.js +1 -3
- package/es/dom/AnimationEvent.js +1 -3
- package/es/dom/AnimationTimeline.js +1 -3
- package/es/dom/CustomElementRegistry.js +1 -3
- package/es/dom/CustomEvent.js +1 -3
- package/es/dom/Document.js +1 -3
- package/es/dom/Element.js +4 -6
- package/es/dom/EventTarget.js +3 -5
- package/es/dom/FederatedEvent.js +1 -3
- package/es/dom/FederatedMouseEvent.js +1 -3
- package/es/dom/FederatedPointerEvent.js +1 -3
- package/es/dom/FederatedWheelEvent.js +1 -3
- package/es/dom/KeyframeEffect.js +1 -3
- package/es/dom/KeyframeList.js +1 -1
- package/es/dom/MutationEvent.js +1 -3
- package/es/dom/MutationObserver.js +3 -10
- package/es/dom/MutationRecord.js +1 -3
- package/es/dom/Node.js +2 -4
- package/es/plugins/CullingPlugin.js +1 -3
- package/es/plugins/DirtyCheckPlugin.js +1 -3
- package/es/plugins/EventPlugin.js +5 -4
- package/es/plugins/FrustumCullingStrategy.js +1 -3
- package/es/plugins/PrepareRendererPlugin.js +1 -3
- package/es/services/EventService.js +26 -7
- package/es/services/OffscreenCanvasCreator.js +1 -3
- package/es/services/RenderingContext.d.ts +2 -1
- package/es/services/RenderingContext.js +3 -1
- package/es/services/RenderingService.js +1 -3
- package/es/services/SceneGraphSelector.js +1 -3
- package/es/services/SceneGraphService.d.ts +2 -1
- package/es/services/SceneGraphService.js +3 -5
- package/es/services/TextService.js +3 -5
- package/es/services/aabb/CircleUpdater.js +1 -3
- package/es/services/aabb/EllipseUpdater.js +1 -3
- package/es/services/aabb/LineUpdater.js +1 -3
- package/es/services/aabb/PathUpdater.js +1 -3
- package/es/services/aabb/PolylineUpdater.js +1 -3
- package/es/services/aabb/RectUpdater.js +1 -3
- package/es/services/aabb/TextUpdater.js +1 -3
- package/es/services/aabb/interfaces.d.ts +3 -2
- package/es/services/aabb/interfaces.js +3 -2
- package/es/shapes/AABB.js +1 -3
- package/es/shapes/BoundingSphere.js +1 -3
- package/es/shapes/Frustum.js +1 -3
- package/es/shapes/Plane.js +1 -3
- package/es/shapes/Point.js +1 -3
- package/es/shapes/Ray.js +1 -3
- package/es/shapes/Rectangle.js +1 -3
- package/es/types.d.ts +2 -1
- package/es/types.js +2 -1
- package/es/utils/custom-easing.d.ts +0 -9
- package/es/utils/custom-easing.js +38 -54
- package/es/utils/path.d.ts +1 -1
- package/es/utils/path.js +3 -3
- package/es/utils/text.js +3 -3
- package/lib/AbstractRenderer.js +1 -3
- package/lib/Canvas.js +8 -12
- package/lib/DisplayObjectPool.js +1 -3
- package/lib/camera/Camera.d.ts +12 -7
- package/lib/camera/Camera.js +59 -25
- package/lib/camera/Landmark.d.ts +2 -0
- package/lib/camera/Landmark.js +10 -6
- package/lib/components/Cullable.js +2 -4
- package/lib/components/Geometry.js +1 -3
- package/lib/components/Renderable.js +1 -3
- package/lib/components/Sortable.js +1 -3
- package/lib/components/Transform.js +1 -3
- package/lib/css/LayoutRegistry.js +1 -3
- package/lib/css/StyleValueRegistry.js +1 -3
- package/lib/css/cssom/CSSColorValue.js +1 -3
- package/lib/css/cssom/CSSGradientValue.js +7 -9
- package/lib/css/cssom/CSSKeywordValue.js +1 -3
- package/lib/css/cssom/CSSMathInvert.js +1 -3
- package/lib/css/cssom/CSSMathMax.js +1 -3
- package/lib/css/cssom/CSSMathMin.js +1 -3
- package/lib/css/cssom/CSSMathNegate.js +1 -3
- package/lib/css/cssom/CSSMathOperator.js +1 -1
- package/lib/css/cssom/CSSMathProduct.js +1 -3
- package/lib/css/cssom/CSSMathSum.js +1 -3
- package/lib/css/cssom/CSSMathValue.js +1 -3
- package/lib/css/cssom/CSSMathVariadic.js +2 -4
- package/lib/css/cssom/CSSNumericValue.js +1 -3
- package/lib/css/cssom/CSSNumericValueType.d.ts +1 -1
- package/lib/css/cssom/CSSNumericValueType.js +3 -5
- package/lib/css/cssom/CSSRGB.js +2 -4
- package/lib/css/cssom/CSSStyleValue.d.ts +2 -2
- package/lib/css/cssom/CSSStyleValue.js +108 -110
- package/lib/css/cssom/CSSTransformComponent.js +2 -4
- package/lib/css/cssom/CSSTransformValue.js +1 -3
- package/lib/css/cssom/CSSTranslate.js +1 -3
- package/lib/css/cssom/CSSUnitValue.js +2 -4
- package/lib/css/cssom/types.js +1 -1
- package/lib/css/parser/color.js +3 -3
- package/lib/css/parser/dimension.js +6 -7
- package/lib/css/parser/numeric.js +3 -3
- package/lib/css/parser/path.js +1 -1
- package/lib/css/parser/transform.d.ts +1 -1
- package/lib/css/parser/transform.js +11 -11
- package/lib/css/properties/CSSPropertyAnchor.js +1 -3
- package/lib/css/properties/CSSPropertyClipPath.js +1 -3
- package/lib/css/properties/CSSPropertyColor.js +1 -3
- package/lib/css/properties/CSSPropertyFilter.js +1 -3
- package/lib/css/properties/CSSPropertyLengthOrPercentage.js +1 -3
- package/lib/css/properties/CSSPropertyLineDash.js +1 -3
- package/lib/css/properties/CSSPropertyLocalPosition.js +1 -3
- package/lib/css/properties/CSSPropertyOffsetDistance.js +1 -3
- package/lib/css/properties/CSSPropertyOffsetPath.js +1 -3
- package/lib/css/properties/CSSPropertyOpacity.js +1 -3
- package/lib/css/properties/CSSPropertyPath.js +1 -3
- package/lib/css/properties/CSSPropertyPoints.js +1 -3
- package/lib/css/properties/CSSPropertyShadowBlur.js +1 -3
- package/lib/css/properties/CSSPropertyText.js +2 -4
- package/lib/css/properties/CSSPropertyTextTransform.js +1 -3
- package/lib/css/properties/CSSPropertyTransform.js +1 -3
- package/lib/css/properties/CSSPropertyTransformOrigin.js +1 -3
- package/lib/css/properties/CSSPropertyVisibility.js +1 -3
- package/lib/css/properties/CSSPropertyZIndex.js +1 -3
- package/lib/display-objects/Circle.js +1 -3
- package/lib/display-objects/CustomElement.js +1 -3
- package/lib/display-objects/DisplayObject.js +9 -7
- package/lib/display-objects/Ellipse.js +1 -3
- package/lib/display-objects/Group.js +1 -3
- package/lib/display-objects/HTML.js +4 -6
- package/lib/display-objects/Image.js +1 -3
- package/lib/display-objects/Line.js +1 -3
- package/lib/display-objects/Path.js +1 -3
- package/lib/display-objects/Polygon.js +1 -3
- package/lib/display-objects/Polyline.js +1 -3
- package/lib/display-objects/Rect.js +1 -3
- package/lib/display-objects/Text.js +4 -6
- package/lib/dom/Animation.js +2 -4
- package/lib/dom/AnimationEffectTiming.js +1 -3
- package/lib/dom/AnimationEvent.js +1 -3
- package/lib/dom/AnimationTimeline.js +2 -4
- package/lib/dom/CustomElementRegistry.js +1 -3
- package/lib/dom/CustomEvent.js +1 -3
- package/lib/dom/Document.js +1 -3
- package/lib/dom/Element.js +4 -6
- package/lib/dom/EventTarget.js +3 -5
- package/lib/dom/FederatedEvent.js +1 -3
- package/lib/dom/FederatedMouseEvent.js +1 -3
- package/lib/dom/FederatedPointerEvent.js +1 -3
- package/lib/dom/FederatedWheelEvent.js +1 -3
- package/lib/dom/KeyframeEffect.js +2 -4
- package/lib/dom/KeyframeList.js +1 -1
- package/lib/dom/MutationEvent.js +1 -3
- package/lib/dom/MutationObserver.js +4 -11
- package/lib/dom/MutationRecord.js +1 -3
- package/lib/dom/Node.js +2 -4
- package/lib/index.js +1 -1
- package/lib/plugins/CullingPlugin.js +2 -4
- package/lib/plugins/DirtyCheckPlugin.js +1 -3
- package/lib/plugins/EventPlugin.js +5 -4
- package/lib/plugins/FrustumCullingStrategy.js +1 -3
- package/lib/plugins/PrepareRendererPlugin.js +1 -3
- package/lib/services/EventService.js +26 -7
- package/lib/services/OffscreenCanvasCreator.js +1 -3
- package/lib/services/RenderingContext.d.ts +2 -1
- package/lib/services/RenderingContext.js +4 -1
- package/lib/services/RenderingService.js +1 -3
- package/lib/services/SceneGraphSelector.js +2 -4
- package/lib/services/SceneGraphService.d.ts +2 -1
- package/lib/services/SceneGraphService.js +5 -6
- package/lib/services/TextService.js +3 -5
- package/lib/services/aabb/CircleUpdater.js +1 -3
- package/lib/services/aabb/EllipseUpdater.js +1 -3
- package/lib/services/aabb/LineUpdater.js +1 -3
- package/lib/services/aabb/PathUpdater.js +1 -3
- package/lib/services/aabb/PolylineUpdater.js +1 -3
- package/lib/services/aabb/RectUpdater.js +1 -3
- package/lib/services/aabb/TextUpdater.js +1 -3
- package/lib/services/aabb/index.js +10 -10
- package/lib/services/aabb/interfaces.d.ts +3 -2
- package/lib/services/aabb/interfaces.js +9 -3
- package/lib/shapes/AABB.js +1 -3
- package/lib/shapes/BoundingSphere.js +1 -3
- package/lib/shapes/Frustum.js +2 -4
- package/lib/shapes/Plane.js +1 -3
- package/lib/shapes/Point.js +1 -3
- package/lib/shapes/Ray.js +1 -3
- package/lib/shapes/Rectangle.js +1 -3
- package/lib/types.d.ts +2 -1
- package/lib/types.js +6 -2
- package/lib/utils/animation.js +2 -3
- package/lib/utils/bezier-easing.js +1 -1
- package/lib/utils/custom-easing.d.ts +0 -9
- package/lib/utils/custom-easing.js +42 -66
- package/lib/utils/math.js +9 -9
- package/lib/utils/path.d.ts +1 -1
- package/lib/utils/path.js +6 -6
- package/lib/utils/text.js +3 -3
- package/package.json +3 -3
- package/dist/index.umd.min.js +0 -30
package/lib/shapes/Ray.js
CHANGED
|
@@ -24,9 +24,7 @@ var tmpVecE = _glMatrix.vec3.create();
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var Ray =
|
|
28
|
-
/** @class */
|
|
29
|
-
function () {
|
|
27
|
+
var Ray = function () {
|
|
30
28
|
function Ray(origin, direction) {
|
|
31
29
|
this.origin = origin || _glMatrix.vec3.create();
|
|
32
30
|
this.direction = direction || _glMatrix.vec3.fromValues(0, 0, -1);
|
package/lib/shapes/Rectangle.js
CHANGED
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
|
|
213
|
+
export declare const CanvasConfig: Syringe.DefinedToken;
|
|
213
214
|
export interface CanvasConfig {
|
|
214
215
|
/**
|
|
215
216
|
* Renderer
|
package/lib/types.js
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.CanvasConfig = exports.TextAlign = exports.TextTransform = exports.LineJoin = exports.LineCap = exports.Shape = 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;
|
package/lib/utils/animation.js
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.parseEasingFunction = parseEasingFunction;
|
|
7
7
|
exports.calculateActiveDuration = calculateActiveDuration;
|
|
8
8
|
exports.calculateIterationProgress = calculateIterationProgress;
|
|
9
|
-
exports.
|
|
10
|
-
exports.parseEasingFunction = parseEasingFunction;
|
|
9
|
+
exports.getEase = exports.EasingKeys = exports.EASINGS = exports.linear = void 0;
|
|
11
10
|
|
|
12
11
|
var _tslib = require("tslib");
|
|
13
12
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.bezier = exports.newtonRaphsonIterate = exports.binarySubdivide = exports.getSlope = exports.calcBezier = exports.C = exports.B = exports.A = exports.float32ArraySupported = exports.kSampleStepSize = exports.kSplineTableSize = exports.SUBDIVISION_MAX_ITERATIONS = exports.SUBDIVISION_PRECISION = exports.NEWTON_MIN_SLOPE = exports.NEWTON_ITERATIONS = void 0;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* https://github.com/gre/bezier-easing
|
|
@@ -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.
|
|
6
|
+
exports.getEasingFunction = exports.complexEasingSyntax = exports.EasingFunctions = exports.EaseOutIn = exports.EaseInOut = exports.EaseOut = exports.easein = exports.Bezier = exports.Steps = exports.parseEasingParameters = exports.INTINITE_LOOP_LIMIT = exports.EasingDurationCache = exports.Spring = exports.Elastic = exports.Bounce = exports.Back = exports.Circ = exports.Sine = exports.Expo = exports.Quint = exports.Quart = exports.Cubic = exports.Quad = exports.limit = exports.convertToDash = void 0;
|
|
7
7
|
|
|
8
8
|
var _tslib = require("tslib");
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ var _bezierEasing = require("./bezier-easing");
|
|
|
14
14
|
*/
|
|
15
15
|
var convertToDash = function convertToDash(str) {
|
|
16
16
|
str = str.replace(/([A-Z])/g, function (letter) {
|
|
17
|
-
return "-"
|
|
17
|
+
return "-" + letter.toLowerCase();
|
|
18
18
|
}); // Remove first dash
|
|
19
19
|
|
|
20
20
|
return str.charAt(0) === '-' ? str.substr(1) : str;
|
|
@@ -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.
|
|
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
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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/lib/utils/math.js
CHANGED
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getAngle = getAngle;
|
|
7
7
|
exports.createVec3 = createVec3;
|
|
8
|
-
exports.decompose = decompose;
|
|
9
8
|
exports.deg2rad = deg2rad;
|
|
9
|
+
exports.rad2deg = rad2deg;
|
|
10
|
+
exports.grad2deg = grad2deg;
|
|
10
11
|
exports.deg2turn = deg2turn;
|
|
11
|
-
exports.
|
|
12
|
-
exports.getAngle = getAngle;
|
|
13
|
-
exports.getEuler = getEuler;
|
|
14
|
-
exports.getRotationInRadians = getRotationInRadians;
|
|
12
|
+
exports.turn2deg = turn2deg;
|
|
15
13
|
exports.getScaling = getScaling;
|
|
16
14
|
exports.getTranslation = getTranslation;
|
|
17
|
-
exports.
|
|
15
|
+
exports.getRotationInRadians = getRotationInRadians;
|
|
16
|
+
exports.getEuler = getEuler;
|
|
17
|
+
exports.fromRotationTranslationScale = fromRotationTranslationScale;
|
|
18
18
|
exports.makePerspective = makePerspective;
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
19
|
+
exports.blend = blend;
|
|
20
|
+
exports.decompose = decompose;
|
|
21
21
|
|
|
22
22
|
var _tslib = require("tslib");
|
|
23
23
|
|
package/lib/utils/path.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function getDrawDirection(pathArray: PathCommand[]): boolean;
|
|
|
5
5
|
export declare function getPathArea(pathArray: PathCommand[]): number;
|
|
6
6
|
export declare function reverseCurve(pathArray: PathCommand[]): PathCommand[];
|
|
7
7
|
export declare function clonePath(pathArray: PathCommand[]): PathCommand[];
|
|
8
|
-
export declare function getRotatedCurve(a: PathCommand[], b: PathCommand[]): (string[] | ["a" | "A", number, number, number, number, number, number, number] | ["
|
|
8
|
+
export declare function getRotatedCurve(a: PathCommand[], b: PathCommand[]): (string[] | ["a" | "A", number, number, number, number, number, number, number] | ["c" | "C", number, number, number, number, number, number] | ["o" | "O", number, number] | ["h" | "H", number] | ["l" | "L", number, number] | ["m" | "M", number, number] | ["r" | "R", number, number, number, number] | ["Q" | "q", number, number, number, number] | ["s" | "S", number, number, number, number, number, number, number] | ["t" | "T", number, number] | ["v" | "V", number] | ["u" | "U", number, number, number])[];
|
|
9
9
|
/**
|
|
10
10
|
* convert object to path, should account for:
|
|
11
11
|
* * transform & origin
|
package/lib/utils/path.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.clonePath = clonePath;
|
|
7
|
-
exports.convertToPath = convertToPath;
|
|
8
6
|
exports.equalizeSegments = equalizeSegments;
|
|
9
7
|
exports.getDrawDirection = getDrawDirection;
|
|
10
8
|
exports.getPathArea = getPathArea;
|
|
11
|
-
exports.getRotatedCurve = getRotatedCurve;
|
|
12
9
|
exports.reverseCurve = reverseCurve;
|
|
10
|
+
exports.clonePath = clonePath;
|
|
11
|
+
exports.getRotatedCurve = getRotatedCurve;
|
|
12
|
+
exports.convertToPath = convertToPath;
|
|
13
13
|
|
|
14
14
|
var _tslib = require("tslib");
|
|
15
15
|
|
|
@@ -236,7 +236,7 @@ function commandsToPathString(commands, localTransform, anchor, parsedStyle) {
|
|
|
236
236
|
|
|
237
237
|
_glMatrix.vec3.transformMat4(p, p, localTransform);
|
|
238
238
|
|
|
239
|
-
path = ""
|
|
239
|
+
path = "" + cur[0] + p[0] + "," + p[1];
|
|
240
240
|
} else if (cur[0] === 'Z') {
|
|
241
241
|
path = cur[0];
|
|
242
242
|
} else if (cur[0] === 'C') {
|
|
@@ -252,13 +252,13 @@ function commandsToPathString(commands, localTransform, anchor, parsedStyle) {
|
|
|
252
252
|
|
|
253
253
|
_glMatrix.vec3.transformMat4(p3, p3, localTransform);
|
|
254
254
|
|
|
255
|
-
path = ""
|
|
255
|
+
path = "" + cur[0] + p1[0] + "," + p1[1] + "," + p2[0] + "," + p2[1] + "," + p3[0] + "," + p3[1];
|
|
256
256
|
} else if (cur[0] === 'A') {
|
|
257
257
|
var c = _glMatrix.vec3.fromValues(cur[6] - defX, cur[7] - defY, 0);
|
|
258
258
|
|
|
259
259
|
_glMatrix.vec3.transformMat4(c, c, localTransform);
|
|
260
260
|
|
|
261
|
-
path = ""
|
|
261
|
+
path = "" + cur[0] + cur[1] + "," + cur[2] + "," + cur[3] + "," + cur[4] + "," + cur[5] + "," + c[0] + "," + c[1];
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
return prev += path;
|
package/lib/utils/text.js
CHANGED
|
@@ -16,7 +16,7 @@ function toFontString(attributes) {
|
|
|
16
16
|
fontVariant = attributes.fontVariant,
|
|
17
17
|
fontWeight = attributes.fontWeight; // build canvas api font setting from individual components. Convert a numeric this.fontSize to px
|
|
18
18
|
|
|
19
|
-
var fontSizeString = (0, _util.isNumber)(fontSize) ?
|
|
19
|
+
var fontSizeString = (0, _util.isNumber)(fontSize) ? fontSize + "px" : fontSize.toString(); // Clean-up fontFamily property by quoting each font name
|
|
20
20
|
// this will support font names with spaces
|
|
21
21
|
// @ts-ignore
|
|
22
22
|
|
|
@@ -27,11 +27,11 @@ function toFontString(attributes) {
|
|
|
27
27
|
var fontFamily_1 = fontFamilies[i].trim(); // Check if font already contains strings
|
|
28
28
|
|
|
29
29
|
if (!/([\"\'])[^\'\"]+\1/.test(fontFamily_1) && genericFontFamilies.indexOf(fontFamily_1) < 0) {
|
|
30
|
-
fontFamily_1 = "\""
|
|
30
|
+
fontFamily_1 = "\"" + fontFamily_1 + "\"";
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
fontFamilies[i] = fontFamily_1;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
return
|
|
36
|
+
return fontStyle + " " + fontVariant + " " + fontWeight + " " + fontSizeString + " " + fontFamilies.join(',');
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.22-alpha.2",
|
|
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.
|
|
40
|
+
"@antv/g-math": "^1.0.19-alpha.1",
|
|
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": "
|
|
56
|
+
"gitHead": "9d0916ad32f477c1d687c2085e7f5ab37d171649"
|
|
57
57
|
}
|