@antv/g 5.0.22-alpha.5 → 5.0.23-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.
- package/dist/index.umd.min.js +30 -0
- package/es/AbstractRenderer.js +8 -1
- package/es/Canvas.d.ts +1 -1
- package/es/Canvas.js +5 -3
- package/es/DisplayObjectPool.js +3 -1
- package/es/camera/Camera.d.ts +105 -66
- package/es/camera/Camera.js +306 -170
- package/es/camera/Landmark.d.ts +18 -25
- package/es/camera/Landmark.js +1 -72
- package/es/canvas-module.js +2 -4
- package/es/components/Cullable.js +3 -1
- package/es/components/Geometry.js +3 -1
- package/es/components/Renderable.js +3 -1
- package/es/components/Sortable.js +3 -1
- package/es/components/Transform.js +3 -1
- package/es/css/LayoutRegistry.js +3 -1
- package/es/css/StyleValueRegistry.d.ts +8 -0
- package/es/css/StyleValueRegistry.js +24 -19
- package/es/css/cssom/CSSColorValue.js +3 -1
- package/es/css/cssom/CSSGradientValue.js +8 -6
- package/es/css/cssom/CSSKeywordValue.js +3 -1
- package/es/css/cssom/CSSMathInvert.js +3 -1
- package/es/css/cssom/CSSMathMax.js +3 -1
- package/es/css/cssom/CSSMathMin.js +3 -1
- package/es/css/cssom/CSSMathNegate.js +3 -1
- package/es/css/cssom/CSSMathProduct.js +3 -1
- package/es/css/cssom/CSSMathSum.js +3 -1
- package/es/css/cssom/CSSMathValue.js +3 -1
- package/es/css/cssom/CSSMathVariadic.js +3 -1
- package/es/css/cssom/CSSNumericValue.js +3 -1
- package/es/css/cssom/CSSNumericValueType.d.ts +1 -1
- package/es/css/cssom/CSSNumericValueType.js +3 -1
- package/es/css/cssom/CSSRGB.js +4 -2
- package/es/css/cssom/CSSStyleValue.d.ts +1 -1
- package/es/css/cssom/CSSStyleValue.js +3 -1
- package/es/css/cssom/CSSTransformComponent.js +3 -1
- package/es/css/cssom/CSSTransformValue.js +3 -1
- package/es/css/cssom/CSSTranslate.js +3 -1
- package/es/css/cssom/CSSUnitValue.js +4 -2
- package/es/css/parser/color.js +2 -2
- package/es/css/parser/dimension.d.ts +1 -1
- package/es/css/parser/dimension.js +2 -3
- package/es/css/parser/numeric.js +1 -1
- package/es/css/parser/path.d.ts +2 -2
- package/es/css/parser/path.js +1 -1
- package/es/css/parser/points.js +1 -1
- package/es/css/parser/transform-origin.js +1 -1
- package/es/css/properties/CSSPropertyAnchor.js +3 -1
- package/es/css/properties/CSSPropertyClipPath.js +3 -1
- package/es/css/properties/CSSPropertyColor.js +3 -1
- package/es/css/properties/CSSPropertyFilter.js +3 -1
- package/es/css/properties/CSSPropertyLengthOrPercentage.js +3 -1
- package/es/css/properties/CSSPropertyLineDash.js +3 -1
- package/es/css/properties/CSSPropertyLocalPosition.js +3 -1
- package/es/css/properties/CSSPropertyOffsetDistance.js +3 -1
- package/es/css/properties/CSSPropertyOffsetPath.js +3 -1
- package/es/css/properties/CSSPropertyOpacity.js +3 -1
- package/es/css/properties/CSSPropertyPath.d.ts +14 -2
- package/es/css/properties/CSSPropertyPath.js +3 -1
- package/es/css/properties/CSSPropertyPoints.js +3 -1
- package/es/css/properties/CSSPropertyShadowBlur.js +3 -1
- package/es/css/properties/CSSPropertyText.d.ts +1 -1
- package/es/css/properties/CSSPropertyText.js +4 -2
- package/es/css/properties/CSSPropertyTextTransform.d.ts +3 -3
- package/es/css/properties/CSSPropertyTextTransform.js +3 -1
- package/es/css/properties/CSSPropertyTransform.js +4 -3
- package/es/css/properties/CSSPropertyTransformOrigin.js +3 -1
- package/es/css/properties/CSSPropertyVisibility.js +3 -1
- package/es/css/properties/CSSPropertyZIndex.js +3 -1
- package/es/display-objects/Circle.js +3 -1
- package/es/display-objects/CustomElement.js +3 -1
- package/es/display-objects/DisplayObject.js +10 -8
- package/es/display-objects/Ellipse.js +3 -1
- package/es/display-objects/Group.js +3 -1
- package/es/display-objects/HTML.js +6 -3
- package/es/display-objects/Image.js +3 -1
- package/es/display-objects/Line.js +3 -1
- package/es/display-objects/Path.d.ts +15 -15
- package/es/display-objects/Path.js +5 -3
- package/es/display-objects/Polygon.d.ts +8 -1
- package/es/display-objects/Polygon.js +3 -1
- package/es/display-objects/Polyline.d.ts +7 -5
- package/es/display-objects/Polyline.js +3 -1
- package/es/display-objects/Rect.js +3 -1
- package/es/display-objects/Text.js +6 -3
- package/es/dom/Animation.js +4 -2
- package/es/dom/AnimationEffectTiming.js +3 -1
- package/es/dom/AnimationEvent.js +3 -1
- package/es/dom/AnimationTimeline.js +3 -1
- package/es/dom/CustomElementRegistry.js +3 -1
- package/es/dom/CustomEvent.js +3 -1
- package/es/dom/Document.js +5 -3
- package/es/dom/Element.js +7 -6
- package/es/dom/EventTarget.js +6 -4
- package/es/dom/FederatedEvent.js +3 -1
- package/es/dom/FederatedMouseEvent.js +3 -1
- package/es/dom/FederatedPointerEvent.js +3 -1
- package/es/dom/FederatedTouchEvent.d.ts +15 -0
- package/es/dom/FederatedTouchEvent.js +19 -0
- package/es/dom/FederatedWheelEvent.js +3 -1
- package/es/dom/KeyframeEffect.js +3 -1
- package/es/dom/KeyframeList.js +1 -1
- package/es/dom/MutationEvent.js +3 -1
- package/es/dom/MutationObserver.js +10 -3
- package/es/dom/MutationRecord.js +3 -1
- package/es/dom/Node.js +4 -2
- package/es/plugins/CullingPlugin.d.ts +0 -1
- package/es/plugins/CullingPlugin.js +6 -9
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/es/plugins/DirtyCheckPlugin.js +12 -9
- package/es/plugins/EventPlugin.d.ts +1 -1
- package/es/plugins/EventPlugin.js +166 -149
- package/es/plugins/FrustumCullingStrategy.js +3 -1
- package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/es/plugins/PrepareRendererPlugin.js +18 -17
- package/es/services/EventService.d.ts +8 -0
- package/es/services/EventService.js +279 -23
- package/es/services/OffscreenCanvasCreator.js +3 -1
- package/es/services/RenderingService.d.ts +17 -16
- package/es/services/RenderingService.js +21 -18
- package/es/services/SceneGraphSelector.js +3 -1
- package/es/services/SceneGraphService.js +4 -2
- package/es/services/TextService.js +5 -3
- package/es/services/aabb/CircleUpdater.js +3 -1
- package/es/services/aabb/EllipseUpdater.js +3 -1
- package/es/services/aabb/LineUpdater.js +3 -1
- package/es/services/aabb/PathUpdater.d.ts +3 -3
- package/es/services/aabb/PathUpdater.js +3 -1
- package/es/services/aabb/PolylineUpdater.d.ts +3 -3
- package/es/services/aabb/PolylineUpdater.js +3 -1
- package/es/services/aabb/RectUpdater.js +4 -2
- package/es/services/aabb/TextUpdater.js +3 -1
- package/es/shapes/AABB.js +3 -1
- package/es/shapes/BoundingSphere.js +3 -1
- package/es/shapes/Frustum.js +3 -1
- package/es/shapes/Plane.js +3 -1
- package/es/shapes/Point.js +3 -1
- package/es/shapes/Ray.js +3 -1
- package/es/shapes/Rectangle.js +3 -1
- package/es/types.d.ts +9 -3
- package/es/utils/assert.d.ts +6 -0
- package/es/utils/assert.js +18 -0
- package/es/utils/custom-easing.js +1 -1
- package/es/utils/event.d.ts +18 -16
- package/es/utils/hooks.d.ts +280 -0
- package/es/utils/hooks.js +753 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/math.d.ts +2 -2
- package/es/utils/math.js +22 -6
- package/es/utils/path.d.ts +1 -1
- package/es/utils/path.js +3 -3
- package/es/utils/string.d.ts +1 -0
- package/es/utils/string.js +8 -0
- package/es/utils/text.js +5 -4
- package/lib/AbstractRenderer.js +8 -1
- package/lib/Canvas.d.ts +1 -1
- package/lib/Canvas.js +5 -3
- package/lib/DisplayObjectPool.js +3 -1
- package/lib/camera/Camera.d.ts +105 -66
- package/lib/camera/Camera.js +313 -178
- package/lib/camera/Landmark.d.ts +18 -25
- package/lib/camera/Landmark.js +1 -75
- package/lib/canvas-module.js +1 -3
- package/lib/components/Cullable.js +4 -2
- package/lib/components/Geometry.js +3 -1
- package/lib/components/Renderable.js +3 -1
- package/lib/components/Sortable.js +3 -1
- package/lib/components/Transform.js +3 -1
- package/lib/css/LayoutRegistry.js +3 -1
- package/lib/css/StyleValueRegistry.d.ts +8 -0
- package/lib/css/StyleValueRegistry.js +27 -20
- package/lib/css/cssom/CSSColorValue.js +3 -1
- package/lib/css/cssom/CSSGradientValue.js +9 -7
- package/lib/css/cssom/CSSKeywordValue.js +3 -1
- package/lib/css/cssom/CSSMathInvert.js +3 -1
- package/lib/css/cssom/CSSMathMax.js +3 -1
- package/lib/css/cssom/CSSMathMin.js +3 -1
- package/lib/css/cssom/CSSMathNegate.js +3 -1
- package/lib/css/cssom/CSSMathOperator.js +1 -1
- package/lib/css/cssom/CSSMathProduct.js +3 -1
- package/lib/css/cssom/CSSMathSum.js +3 -1
- package/lib/css/cssom/CSSMathValue.js +3 -1
- package/lib/css/cssom/CSSMathVariadic.js +4 -2
- package/lib/css/cssom/CSSNumericValue.js +3 -1
- package/lib/css/cssom/CSSNumericValueType.d.ts +1 -1
- package/lib/css/cssom/CSSNumericValueType.js +5 -3
- package/lib/css/cssom/CSSRGB.js +4 -2
- package/lib/css/cssom/CSSStyleValue.d.ts +1 -1
- package/lib/css/cssom/CSSStyleValue.js +4 -2
- package/lib/css/cssom/CSSTransformComponent.js +4 -2
- package/lib/css/cssom/CSSTransformValue.js +3 -1
- package/lib/css/cssom/CSSTranslate.js +3 -1
- package/lib/css/cssom/CSSUnitValue.js +4 -2
- package/lib/css/cssom/types.js +1 -1
- package/lib/css/parser/color.js +8 -8
- package/lib/css/parser/dimension.d.ts +1 -1
- package/lib/css/parser/dimension.js +8 -9
- package/lib/css/parser/numeric.js +6 -6
- package/lib/css/parser/path.d.ts +2 -2
- package/lib/css/parser/path.js +5 -5
- package/lib/css/parser/points.js +2 -2
- package/lib/css/parser/transform-origin.js +2 -2
- package/lib/css/parser/transform.js +2 -2
- package/lib/css/properties/CSSPropertyAnchor.js +3 -1
- package/lib/css/properties/CSSPropertyClipPath.js +3 -1
- package/lib/css/properties/CSSPropertyColor.js +3 -1
- package/lib/css/properties/CSSPropertyFilter.js +3 -1
- package/lib/css/properties/CSSPropertyLengthOrPercentage.js +3 -1
- package/lib/css/properties/CSSPropertyLineDash.js +3 -1
- package/lib/css/properties/CSSPropertyLocalPosition.js +3 -1
- package/lib/css/properties/CSSPropertyOffsetDistance.js +3 -1
- package/lib/css/properties/CSSPropertyOffsetPath.js +3 -1
- package/lib/css/properties/CSSPropertyOpacity.js +3 -1
- package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
- package/lib/css/properties/CSSPropertyPath.js +3 -1
- package/lib/css/properties/CSSPropertyPoints.js +3 -1
- package/lib/css/properties/CSSPropertyShadowBlur.js +3 -1
- package/lib/css/properties/CSSPropertyText.d.ts +1 -1
- package/lib/css/properties/CSSPropertyText.js +4 -2
- package/lib/css/properties/CSSPropertyTextTransform.d.ts +3 -3
- package/lib/css/properties/CSSPropertyTextTransform.js +3 -1
- package/lib/css/properties/CSSPropertyTransform.js +3 -3
- package/lib/css/properties/CSSPropertyTransformOrigin.js +3 -1
- package/lib/css/properties/CSSPropertyVisibility.js +3 -1
- package/lib/css/properties/CSSPropertyZIndex.js +3 -1
- package/lib/display-objects/Circle.js +3 -1
- package/lib/display-objects/CustomElement.js +3 -1
- package/lib/display-objects/DisplayObject.js +13 -12
- package/lib/display-objects/Ellipse.js +3 -1
- package/lib/display-objects/Group.js +3 -1
- package/lib/display-objects/HTML.js +6 -4
- package/lib/display-objects/Image.js +3 -1
- package/lib/display-objects/Line.js +3 -1
- package/lib/display-objects/Path.d.ts +15 -15
- package/lib/display-objects/Path.js +7 -5
- package/lib/display-objects/Polygon.d.ts +8 -1
- package/lib/display-objects/Polygon.js +3 -1
- package/lib/display-objects/Polyline.d.ts +7 -5
- package/lib/display-objects/Polyline.js +3 -1
- package/lib/display-objects/Rect.js +3 -1
- package/lib/display-objects/Text.js +6 -4
- package/lib/dom/Animation.js +4 -2
- package/lib/dom/AnimationEffectTiming.js +3 -1
- package/lib/dom/AnimationEvent.js +3 -1
- package/lib/dom/AnimationTimeline.js +4 -2
- package/lib/dom/CustomElementRegistry.js +3 -1
- package/lib/dom/CustomEvent.js +3 -1
- package/lib/dom/Document.js +5 -3
- package/lib/dom/Element.js +7 -7
- package/lib/dom/EventTarget.js +14 -12
- package/lib/dom/FederatedEvent.js +3 -1
- package/lib/dom/FederatedMouseEvent.js +3 -1
- package/lib/dom/FederatedPointerEvent.js +3 -1
- package/lib/dom/FederatedTouchEvent.d.ts +15 -0
- package/lib/dom/FederatedTouchEvent.js +27 -0
- package/lib/dom/FederatedWheelEvent.js +3 -1
- package/lib/dom/KeyframeEffect.js +4 -2
- package/lib/dom/KeyframeList.js +1 -1
- package/lib/dom/MutationEvent.js +3 -1
- package/lib/dom/MutationObserver.js +11 -4
- package/lib/dom/MutationRecord.js +3 -1
- package/lib/dom/Node.js +4 -2
- package/lib/index.js +1 -1
- package/lib/plugins/CullingPlugin.d.ts +0 -1
- package/lib/plugins/CullingPlugin.js +7 -9
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/lib/plugins/DirtyCheckPlugin.js +13 -9
- package/lib/plugins/EventPlugin.d.ts +1 -1
- package/lib/plugins/EventPlugin.js +175 -157
- package/lib/plugins/FrustumCullingStrategy.js +3 -1
- package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/lib/plugins/PrepareRendererPlugin.js +17 -15
- package/lib/services/EventService.d.ts +8 -0
- package/lib/services/EventService.js +279 -22
- package/lib/services/OffscreenCanvasCreator.js +3 -1
- package/lib/services/RenderingService.d.ts +17 -16
- package/lib/services/RenderingService.js +22 -19
- package/lib/services/SceneGraphSelector.js +4 -2
- package/lib/services/SceneGraphService.js +8 -6
- package/lib/services/TextService.js +5 -3
- package/lib/services/aabb/CircleUpdater.js +3 -1
- package/lib/services/aabb/EllipseUpdater.js +3 -1
- package/lib/services/aabb/LineUpdater.js +3 -1
- package/lib/services/aabb/PathUpdater.d.ts +3 -3
- package/lib/services/aabb/PathUpdater.js +3 -1
- package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
- package/lib/services/aabb/PolylineUpdater.js +3 -1
- package/lib/services/aabb/RectUpdater.js +6 -4
- package/lib/services/aabb/TextUpdater.js +3 -1
- package/lib/services/aabb/index.js +10 -10
- package/lib/services/aabb/interfaces.js +1 -1
- package/lib/shapes/AABB.js +3 -1
- package/lib/shapes/BoundingSphere.js +3 -1
- package/lib/shapes/Frustum.js +4 -2
- package/lib/shapes/Plane.js +3 -1
- package/lib/shapes/Point.js +3 -1
- package/lib/shapes/Ray.js +3 -1
- package/lib/shapes/Rectangle.js +3 -1
- package/lib/types.d.ts +9 -3
- package/lib/types.js +1 -1
- package/lib/utils/animation.js +3 -2
- package/lib/utils/assert.d.ts +6 -0
- package/lib/utils/assert.js +30 -0
- package/lib/utils/bezier-easing.js +1 -1
- package/lib/utils/custom-easing.js +2 -2
- package/lib/utils/event.d.ts +18 -16
- package/lib/utils/hooks.d.ts +280 -0
- package/lib/utils/hooks.js +759 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/math.d.ts +2 -2
- package/lib/utils/math.js +34 -18
- package/lib/utils/path.d.ts +1 -1
- package/lib/utils/path.js +6 -6
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +11 -0
- package/lib/utils/text.js +7 -5
- package/package.json +5 -6
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -106,4 +106,17 @@ Object.keys(_canvas).forEach(function (key) {
|
|
|
106
106
|
return _canvas[key];
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
var _hooks = require("./hooks");
|
|
112
|
+
|
|
113
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
114
|
+
if (key === "default" || key === "__esModule") return;
|
|
115
|
+
if (key in exports && exports[key] === _hooks[key]) return;
|
|
116
|
+
Object.defineProperty(exports, key, {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function get() {
|
|
119
|
+
return _hooks[key];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
109
122
|
});
|
package/lib/utils/math.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { quat, vec2, vec4 } from 'gl-matrix';
|
|
2
2
|
import { mat3, mat4, vec3 } from 'gl-matrix';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function clamp(number: number, boundOne: number, boundTwo: number): number;
|
|
4
|
+
export declare function getAngle(angle?: number): number;
|
|
4
5
|
export declare function createVec3(x: number | vec2 | vec3 | vec4, y?: number, z?: number): vec3;
|
|
5
6
|
export declare function deg2rad(deg: number): number;
|
|
6
7
|
export declare function rad2deg(rad: number): number;
|
|
@@ -25,5 +26,4 @@ export declare function getRotationInRadians(mat: mat3): number;
|
|
|
25
26
|
export declare function getEuler(out: vec3, quat: quat | mat4): vec3;
|
|
26
27
|
export declare function fromRotationTranslationScale(rotation: number, x: number, y: number, scaleX: number, scaleY: number): mat3;
|
|
27
28
|
export declare function makePerspective(out: mat4, left: number, right: number, top: number, bottom: number, near: number, far: number): mat4;
|
|
28
|
-
export declare function blend(from: number, to: number, progress: number): number;
|
|
29
29
|
export declare function decompose(mat: mat3): number[];
|
package/lib/utils/math.js
CHANGED
|
@@ -3,28 +3,40 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.clamp = clamp;
|
|
7
7
|
exports.createVec3 = createVec3;
|
|
8
|
+
exports.decompose = decompose;
|
|
8
9
|
exports.deg2rad = deg2rad;
|
|
9
|
-
exports.rad2deg = rad2deg;
|
|
10
|
-
exports.grad2deg = grad2deg;
|
|
11
10
|
exports.deg2turn = deg2turn;
|
|
12
|
-
exports.
|
|
11
|
+
exports.fromRotationTranslationScale = fromRotationTranslationScale;
|
|
12
|
+
exports.getAngle = getAngle;
|
|
13
|
+
exports.getEuler = getEuler;
|
|
14
|
+
exports.getRotationInRadians = getRotationInRadians;
|
|
13
15
|
exports.getScaling = getScaling;
|
|
14
16
|
exports.getTranslation = getTranslation;
|
|
15
|
-
exports.
|
|
16
|
-
exports.getEuler = getEuler;
|
|
17
|
-
exports.fromRotationTranslationScale = fromRotationTranslationScale;
|
|
17
|
+
exports.grad2deg = grad2deg;
|
|
18
18
|
exports.makePerspective = makePerspective;
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
19
|
+
exports.rad2deg = rad2deg;
|
|
20
|
+
exports.turn2deg = turn2deg;
|
|
21
21
|
|
|
22
22
|
var _tslib = require("tslib");
|
|
23
23
|
|
|
24
|
-
var _util = require("@antv/util");
|
|
25
|
-
|
|
26
24
|
var _glMatrix = require("gl-matrix");
|
|
27
25
|
|
|
26
|
+
var _assert = require("./assert");
|
|
27
|
+
|
|
28
|
+
function clamp(number, boundOne, boundTwo) {
|
|
29
|
+
if (!boundTwo) {
|
|
30
|
+
return Math.max(number, boundOne) === boundOne ? number : boundOne;
|
|
31
|
+
} else if (Math.min(number, boundOne) === number) {
|
|
32
|
+
return boundOne;
|
|
33
|
+
} else if (Math.max(number, boundTwo) === number) {
|
|
34
|
+
return boundTwo;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return number;
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
function getAngle(angle) {
|
|
29
41
|
if (angle === undefined) {
|
|
30
42
|
return 0;
|
|
@@ -36,15 +48,23 @@ function getAngle(angle) {
|
|
|
36
48
|
}
|
|
37
49
|
|
|
38
50
|
function createVec3(x, y, z) {
|
|
39
|
-
if (
|
|
51
|
+
if (y === void 0) {
|
|
52
|
+
y = 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (z === void 0) {
|
|
56
|
+
z = 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if ((0, _assert.isNumber)(x)) {
|
|
40
60
|
return _glMatrix.vec3.fromValues(x, y, z);
|
|
41
61
|
}
|
|
42
62
|
|
|
43
|
-
if (x.length === 3) {
|
|
63
|
+
if (Array.isArray(x) && x.length === 3) {
|
|
44
64
|
return _glMatrix.vec3.clone(x);
|
|
45
65
|
}
|
|
46
66
|
|
|
47
|
-
return _glMatrix.vec3.fromValues(x[0], x[1], x[2] ||
|
|
67
|
+
return _glMatrix.vec3.fromValues(x[0], x[1] || y, x[2] || z);
|
|
48
68
|
}
|
|
49
69
|
|
|
50
70
|
function deg2rad(deg) {
|
|
@@ -214,10 +234,6 @@ function makePerspective(out, left, right, top, bottom, near, far) {
|
|
|
214
234
|
return out;
|
|
215
235
|
}
|
|
216
236
|
|
|
217
|
-
function blend(from, to, progress) {
|
|
218
|
-
return from + (to - from) * progress;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
237
|
function decompose(mat) {
|
|
222
238
|
var row0x = mat[0];
|
|
223
239
|
var row0y = mat[3];
|
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;
|
|
6
8
|
exports.equalizeSegments = equalizeSegments;
|
|
7
9
|
exports.getDrawDirection = getDrawDirection;
|
|
8
10
|
exports.getPathArea = getPathArea;
|
|
9
|
-
exports.reverseCurve = reverseCurve;
|
|
10
|
-
exports.clonePath = clonePath;
|
|
11
11
|
exports.getRotatedCurve = getRotatedCurve;
|
|
12
|
-
exports.
|
|
12
|
+
exports.reverseCurve = reverseCurve;
|
|
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 = "".concat(cur[0]).concat(p[0], ",").concat(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 = "".concat(cur[0]).concat(p1[0], ",").concat(p1[1], ",").concat(p2[0], ",").concat(p2[1], ",").concat(p3[0], ",").concat(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 = "".concat(cur[0]).concat(cur[1], ",").concat(cur[2], ",").concat(cur[3], ",").concat(cur[4], ",").concat(cur[5], ",").concat(c[0], ",").concat(c[1]);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
return prev += path;
|
package/lib/utils/string.d.ts
CHANGED
package/lib/utils/string.js
CHANGED
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.camelCase = camelCase;
|
|
7
|
+
exports.isString = isString;
|
|
8
|
+
|
|
9
|
+
var _assert = require("./assert");
|
|
7
10
|
|
|
8
11
|
function camelCase(str) {
|
|
9
12
|
if (str === void 0) {
|
|
@@ -13,4 +16,12 @@ function camelCase(str) {
|
|
|
13
16
|
return str.replace(/-([a-z])/g, function (g) {
|
|
14
17
|
return g[1].toUpperCase();
|
|
15
18
|
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function isString(str) {
|
|
22
|
+
if (!(0, _assert.isNil)(str) && typeof str === 'string') {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return false;
|
|
16
27
|
}
|
package/lib/utils/text.js
CHANGED
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.toFontString = toFontString;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _assert = require("./assert");
|
|
9
|
+
|
|
10
|
+
var _string = require("./string");
|
|
9
11
|
|
|
10
12
|
var genericFontFamilies = ['serif', 'sans-serif', 'monospace', 'cursive', 'fantasy', 'system-ui'];
|
|
11
13
|
|
|
@@ -16,22 +18,22 @@ function toFontString(attributes) {
|
|
|
16
18
|
fontVariant = attributes.fontVariant,
|
|
17
19
|
fontWeight = attributes.fontWeight; // build canvas api font setting from individual components. Convert a numeric this.fontSize to px
|
|
18
20
|
|
|
19
|
-
var fontSizeString = (0,
|
|
21
|
+
var fontSizeString = (0, _assert.isNumber)(fontSize) ? "".concat(fontSize, "px") : fontSize.toString(); // Clean-up fontFamily property by quoting each font name
|
|
20
22
|
// this will support font names with spaces
|
|
21
23
|
// @ts-ignore
|
|
22
24
|
|
|
23
|
-
var fontFamilies = (0,
|
|
25
|
+
var fontFamilies = (0, _string.isString)(fontFamily) ? fontFamily.split(',') : [fontFamily.value];
|
|
24
26
|
|
|
25
27
|
for (var i = fontFamilies.length - 1; i >= 0; i--) {
|
|
26
28
|
// Trim any extra white-space
|
|
27
29
|
var fontFamily_1 = fontFamilies[i].trim(); // Check if font already contains strings
|
|
28
30
|
|
|
29
31
|
if (!/([\"\'])[^\'\"]+\1/.test(fontFamily_1) && genericFontFamilies.indexOf(fontFamily_1) < 0) {
|
|
30
|
-
fontFamily_1 = "\""
|
|
32
|
+
fontFamily_1 = "\"".concat(fontFamily_1, "\"");
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
fontFamilies[i] = fontFamily_1;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
return fontStyle
|
|
38
|
+
return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
|
|
37
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.23-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",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"url": "https://github.com/antvis/g/issues"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
+
"@types/d3-color": "^3.0.2",
|
|
35
36
|
"@types/gl-matrix": "^2.4.5",
|
|
36
37
|
"@types/offscreencanvas": "^2019.6.1"
|
|
37
38
|
},
|
|
38
39
|
"homepage": "https://github.com/antvis/g#readme",
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@antv/g-math": "^1.0.
|
|
41
|
-
"@antv/
|
|
42
|
-
"@antv/util": "^2.0.13",
|
|
41
|
+
"@antv/g-math": "^1.0.20-alpha.0",
|
|
42
|
+
"@antv/util": "^3.0.0",
|
|
43
43
|
"@types/offscreencanvas": "^2019.6.4",
|
|
44
44
|
"d3-color": "^1.4.0",
|
|
45
45
|
"eventemitter3": "^4.0.0",
|
|
@@ -47,11 +47,10 @@
|
|
|
47
47
|
"mana-syringe": "^0.3.0",
|
|
48
48
|
"reflect-metadata": "^0.1.13",
|
|
49
49
|
"request-animation-frame-polyfill": "^1.1.2",
|
|
50
|
-
"tapable": "^2.2.1",
|
|
51
50
|
"tslib": "^2.3.1"
|
|
52
51
|
},
|
|
53
52
|
"scripts": {
|
|
54
53
|
"umd": "webpack"
|
|
55
54
|
},
|
|
56
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b382a7445d9fa350107dba29d20eb7e6d6da9e79"
|
|
57
56
|
}
|