@antv/g 5.0.13 → 5.0.16
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 +18 -2
- package/es/Canvas.d.ts +3 -0
- package/es/Canvas.js +9 -9
- package/es/camera/Camera.d.ts +3 -2
- package/es/camera/Camera.js +16 -8
- package/es/canvas-module.js +11 -17
- package/es/components/Transform.d.ts +0 -1
- package/es/components/Transform.js +0 -1
- package/es/display-objects/Circle.d.ts +4 -2
- package/es/display-objects/Circle.js +8 -3
- package/es/display-objects/CustomElement.d.ts +3 -2
- package/es/display-objects/CustomElement.js +9 -6
- package/es/display-objects/DisplayObject.d.ts +4 -3
- package/es/display-objects/DisplayObject.js +80 -49
- package/es/display-objects/Ellipse.d.ts +6 -3
- package/es/display-objects/Ellipse.js +8 -3
- package/es/display-objects/Group.d.ts +18 -2
- package/es/display-objects/Group.js +14 -9
- package/es/display-objects/HTML.d.ts +6 -1
- package/es/display-objects/HTML.js +10 -5
- package/es/display-objects/Image.d.ts +12 -7
- package/es/display-objects/Image.js +10 -3
- package/es/display-objects/Line.d.ts +1 -1
- package/es/display-objects/Line.js +12 -4
- package/es/display-objects/Path.d.ts +3 -2
- package/es/display-objects/Path.js +10 -5
- package/es/display-objects/Polygon.d.ts +1 -1
- package/es/display-objects/Polygon.js +9 -3
- package/es/display-objects/Polyline.d.ts +1 -1
- package/es/display-objects/Polyline.js +10 -5
- package/es/display-objects/Rect.d.ts +8 -5
- package/es/display-objects/Rect.js +9 -4
- package/es/display-objects/Text.d.ts +9 -6
- package/es/display-objects/Text.js +15 -10
- package/es/dom/Animation.js +1 -1
- package/es/dom/AnimationTimeline.js +1 -2
- package/es/dom/CustomElementRegistry.js +12 -12
- package/es/dom/Document.d.ts +1 -0
- package/es/dom/Document.js +21 -1
- package/es/dom/Element.d.ts +14 -9
- package/es/dom/Element.js +41 -14
- package/es/dom/EventTarget.d.ts +2 -2
- package/es/dom/EventTarget.js +4 -3
- package/es/dom/KeyframeList.js +1 -1
- package/es/dom/MutationEvent.d.ts +15 -0
- package/es/dom/MutationEvent.js +29 -0
- package/es/dom/MutationObserver.d.ts +36 -0
- package/es/dom/MutationObserver.js +413 -0
- package/es/dom/MutationRecord.d.ts +14 -0
- package/es/dom/MutationRecord.js +31 -0
- package/es/dom/Node.d.ts +35 -3
- package/es/dom/Node.js +184 -17
- package/es/dom/index.d.ts +3 -0
- package/es/dom/index.js +3 -0
- package/es/dom/interfaces.d.ts +36 -8
- package/es/dom/interfaces.js +23 -5
- package/es/global-module.d.ts +4 -1
- package/es/global-module.js +38 -80
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/plugins/CullingPlugin.d.ts +0 -2
- package/es/plugins/CullingPlugin.js +3 -24
- package/es/plugins/DirtyCheckPlugin.js +2 -2
- package/es/plugins/FrustumCullingStrategy.d.ts +1 -0
- package/es/plugins/FrustumCullingStrategy.js +40 -33
- package/es/plugins/PrepareRendererPlugin.js +21 -5
- package/es/property-handlers/aabb.js +22 -24
- package/es/property-handlers/anchor.js +2 -1
- package/es/property-handlers/color.js +5 -2
- package/es/property-handlers/dimension.d.ts +15 -2
- package/es/property-handlers/dimension.js +77 -8
- package/es/property-handlers/index.d.ts +3 -0
- package/es/property-handlers/index.js +4 -1
- package/es/property-handlers/inherit.d.ts +6 -0
- package/es/property-handlers/inherit.js +25 -0
- package/es/property-handlers/interfaces.d.ts +2 -2
- package/es/property-handlers/lineDash.d.ts +6 -1
- package/es/property-handlers/lineDash.js +23 -4
- package/es/property-handlers/offsetDistance.js +2 -2
- package/es/property-handlers/path.d.ts +1 -1
- package/es/property-handlers/text.d.ts +2 -0
- package/es/property-handlers/text.js +3 -0
- package/es/property-handlers/textTransform.d.ts +6 -0
- package/es/property-handlers/textTransform.js +19 -0
- package/es/services/EventService.js +3 -5
- package/es/services/RenderingContext.d.ts +5 -8
- package/es/services/RenderingContext.js +6 -7
- package/es/services/RenderingService.js +2 -8
- package/es/services/SceneGraphSelector.d.ts +3 -2
- package/es/services/SceneGraphSelector.js +8 -4
- package/es/services/SceneGraphService.d.ts +7 -14
- package/es/services/SceneGraphService.js +14 -82
- package/es/services/aabb/CircleUpdater.d.ts +2 -2
- package/es/services/aabb/CircleUpdater.js +21 -11
- package/es/services/aabb/EllipseUpdater.d.ts +2 -2
- package/es/services/aabb/EllipseUpdater.js +28 -13
- package/es/services/aabb/LineUpdater.js +2 -2
- package/es/services/aabb/PathUpdater.js +2 -2
- package/es/services/aabb/PolylineUpdater.js +3 -3
- package/es/services/aabb/RectUpdater.d.ts +2 -2
- package/es/services/aabb/RectUpdater.js +33 -17
- package/es/services/aabb/TextUpdater.js +19 -10
- package/es/services/aabb/interfaces.d.ts +1 -1
- package/es/services/aabb/interfaces.js +1 -1
- package/es/services/text/index.js +19 -21
- package/es/shapes/AABB.d.ts +1 -0
- package/es/shapes/AABB.js +8 -0
- package/es/types.d.ts +48 -27
- package/es/types.js +50 -31
- package/es/utils/custom-easing.js +1 -1
- package/es/utils/event.js +5 -3
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/interpolation.d.ts +1 -0
- package/es/utils/interpolation.js +41 -8
- package/es/utils/path.d.ts +1 -1
- package/es/utils/path.js +16 -16
- package/es/utils/raf.d.ts +1 -1
- package/es/utils/raf.js +0 -2
- package/es/utils/string.d.ts +1 -0
- package/es/utils/string.js +9 -0
- package/es/utils/text.js +3 -3
- package/lib/Canvas.d.ts +3 -0
- package/lib/Canvas.js +7 -7
- package/lib/camera/Camera.d.ts +3 -2
- package/lib/camera/Camera.js +20 -10
- package/lib/canvas-module.js +10 -15
- package/lib/components/Transform.d.ts +0 -1
- package/lib/components/Transform.js +0 -1
- package/lib/display-objects/Circle.d.ts +4 -2
- package/lib/display-objects/Circle.js +7 -2
- package/lib/display-objects/CustomElement.d.ts +3 -2
- package/lib/display-objects/CustomElement.js +9 -6
- package/lib/display-objects/DisplayObject.d.ts +4 -3
- package/lib/display-objects/DisplayObject.js +79 -46
- package/lib/display-objects/Ellipse.d.ts +6 -3
- package/lib/display-objects/Ellipse.js +7 -2
- package/lib/display-objects/Group.d.ts +18 -2
- package/lib/display-objects/Group.js +13 -9
- package/lib/display-objects/HTML.d.ts +6 -1
- package/lib/display-objects/HTML.js +9 -5
- package/lib/display-objects/Image.d.ts +12 -7
- package/lib/display-objects/Image.js +9 -2
- package/lib/display-objects/Line.d.ts +1 -1
- package/lib/display-objects/Line.js +11 -3
- package/lib/display-objects/Path.d.ts +3 -2
- package/lib/display-objects/Path.js +9 -4
- package/lib/display-objects/Polygon.d.ts +1 -1
- package/lib/display-objects/Polygon.js +8 -2
- package/lib/display-objects/Polyline.d.ts +1 -1
- package/lib/display-objects/Polyline.js +9 -4
- package/lib/display-objects/Rect.d.ts +8 -5
- package/lib/display-objects/Rect.js +8 -3
- package/lib/display-objects/Text.d.ts +9 -6
- package/lib/display-objects/Text.js +14 -9
- package/lib/dom/Animation.js +1 -1
- package/lib/dom/AnimationTimeline.js +1 -2
- package/lib/dom/CustomElementRegistry.js +11 -11
- package/lib/dom/Document.d.ts +1 -0
- package/lib/dom/Document.js +22 -1
- package/lib/dom/Element.d.ts +14 -9
- package/lib/dom/Element.js +43 -14
- package/lib/dom/EventTarget.d.ts +2 -2
- package/lib/dom/EventTarget.js +4 -3
- package/lib/dom/KeyframeList.js +1 -1
- package/lib/dom/MutationEvent.d.ts +15 -0
- package/lib/dom/MutationEvent.js +37 -0
- package/lib/dom/MutationObserver.d.ts +36 -0
- package/lib/dom/MutationObserver.js +424 -0
- package/lib/dom/MutationRecord.d.ts +14 -0
- package/lib/dom/MutationRecord.js +38 -0
- package/lib/dom/Node.d.ts +35 -3
- package/lib/dom/Node.js +185 -16
- package/lib/dom/index.d.ts +3 -0
- package/lib/dom/index.js +39 -0
- package/lib/dom/interfaces.d.ts +36 -8
- package/lib/dom/interfaces.js +23 -5
- package/lib/global-module.d.ts +4 -1
- package/lib/global-module.js +44 -76
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/plugins/CullingPlugin.d.ts +0 -2
- package/lib/plugins/CullingPlugin.js +2 -23
- package/lib/plugins/DirtyCheckPlugin.js +1 -1
- package/lib/plugins/FrustumCullingStrategy.d.ts +1 -0
- package/lib/plugins/FrustumCullingStrategy.js +41 -33
- package/lib/plugins/PrepareRendererPlugin.js +24 -4
- package/lib/property-handlers/aabb.js +21 -23
- package/lib/property-handlers/anchor.js +3 -1
- package/lib/property-handlers/color.js +6 -3
- package/lib/property-handlers/dimension.d.ts +15 -2
- package/lib/property-handlers/dimension.js +80 -7
- package/lib/property-handlers/index.d.ts +3 -0
- package/lib/property-handlers/index.js +39 -0
- package/lib/property-handlers/inherit.d.ts +6 -0
- package/lib/property-handlers/inherit.js +34 -0
- package/lib/property-handlers/interfaces.d.ts +2 -2
- package/lib/property-handlers/lineDash.d.ts +6 -1
- package/lib/property-handlers/lineDash.js +25 -4
- package/lib/property-handlers/offsetDistance.js +1 -1
- package/lib/property-handlers/path.d.ts +1 -1
- package/lib/property-handlers/text.d.ts +2 -0
- package/lib/property-handlers/text.js +10 -0
- package/lib/property-handlers/textTransform.d.ts +6 -0
- package/lib/property-handlers/textTransform.js +27 -0
- package/lib/services/EventService.js +3 -5
- package/lib/services/RenderingContext.d.ts +5 -8
- package/lib/services/RenderingContext.js +8 -9
- package/lib/services/RenderingService.js +1 -7
- package/lib/services/SceneGraphSelector.d.ts +3 -2
- package/lib/services/SceneGraphSelector.js +10 -3
- package/lib/services/SceneGraphService.d.ts +7 -14
- package/lib/services/SceneGraphService.js +15 -82
- package/lib/services/aabb/CircleUpdater.d.ts +2 -2
- package/lib/services/aabb/CircleUpdater.js +20 -10
- package/lib/services/aabb/EllipseUpdater.d.ts +2 -2
- package/lib/services/aabb/EllipseUpdater.js +27 -12
- package/lib/services/aabb/LineUpdater.js +1 -1
- package/lib/services/aabb/PathUpdater.js +1 -1
- package/lib/services/aabb/PolylineUpdater.js +2 -2
- package/lib/services/aabb/RectUpdater.d.ts +2 -2
- package/lib/services/aabb/RectUpdater.js +32 -16
- package/lib/services/aabb/TextUpdater.js +18 -9
- package/lib/services/aabb/interfaces.d.ts +1 -1
- package/lib/services/aabb/interfaces.js +1 -1
- package/lib/services/text/index.js +19 -21
- package/lib/shapes/AABB.d.ts +1 -0
- package/lib/shapes/AABB.js +8 -0
- package/lib/types.d.ts +48 -27
- package/lib/types.js +56 -35
- package/lib/utils/custom-easing.js +1 -1
- package/lib/utils/event.js +5 -3
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/interpolation.d.ts +1 -0
- package/lib/utils/interpolation.js +43 -7
- package/lib/utils/path.d.ts +1 -1
- package/lib/utils/path.js +15 -15
- package/lib/utils/raf.d.ts +1 -1
- package/lib/utils/raf.js +0 -2
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +16 -0
- package/lib/utils/text.js +3 -3
- package/package.json +6 -4
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import type { BaseStyleProps } from '../types';
|
|
1
|
+
import type { BaseStyleProps, ParsedBaseStyleProps, TextAlign } from '../types';
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
3
|
import type { DisplayObjectConfig } from '../dom';
|
|
4
|
+
import type { ParsedElement } from '../property-handlers';
|
|
5
|
+
export interface GroupStyleProps extends BaseStyleProps {
|
|
6
|
+
width?: number | string;
|
|
7
|
+
height?: number | string;
|
|
8
|
+
textAlign?: TextAlign | 'inherit';
|
|
9
|
+
fontSize?: number | string | 'inherit';
|
|
10
|
+
fontFamily?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ParsedGroupStyleProps extends ParsedBaseStyleProps {
|
|
13
|
+
width?: ParsedElement;
|
|
14
|
+
height?: ParsedElement;
|
|
15
|
+
widthInPixels?: number;
|
|
16
|
+
heightInPixels?: number;
|
|
17
|
+
textAlign?: TextAlign;
|
|
18
|
+
fontSize?: ParsedElement;
|
|
19
|
+
}
|
|
4
20
|
export declare class Group extends DisplayObject {
|
|
5
|
-
constructor(
|
|
21
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<GroupStyleProps>);
|
|
6
22
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
5
|
var Group =
|
|
@@ -7,18 +7,23 @@ var Group =
|
|
|
7
7
|
function (_super) {
|
|
8
8
|
__extends(Group, _super);
|
|
9
9
|
|
|
10
|
-
function Group(
|
|
11
|
-
|
|
10
|
+
function Group(_a) {
|
|
11
|
+
if (_a === void 0) {
|
|
12
|
+
_a = {};
|
|
13
|
+
}
|
|
12
14
|
|
|
13
|
-
var
|
|
14
|
-
style = _a.style,
|
|
15
|
+
var style = _a.style,
|
|
15
16
|
rest = __rest(_a, ["style"]);
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
type:
|
|
19
|
-
style: __assign({
|
|
18
|
+
return _super.call(this, __assign({
|
|
19
|
+
type: Shape.GROUP,
|
|
20
|
+
style: __assign({
|
|
21
|
+
width: 'auto',
|
|
22
|
+
height: 'auto',
|
|
23
|
+
textAlign: 'inherit',
|
|
24
|
+
fontSize: 'inherit'
|
|
25
|
+
}, style)
|
|
20
26
|
}, rest)) || this;
|
|
21
|
-
return _this;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
return Group;
|
|
@@ -2,14 +2,19 @@ import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
3
|
import type { DisplayObjectConfig } from '../dom';
|
|
4
4
|
import { AABB } from '../shapes';
|
|
5
|
+
import type { ParsedElement } from '../property-handlers';
|
|
5
6
|
export interface HTMLStyleProps extends BaseStyleProps {
|
|
6
7
|
innerHTML: string | HTMLElement;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
7
10
|
className?: string | string[];
|
|
8
11
|
style?: string;
|
|
9
12
|
}
|
|
10
13
|
export interface ParsedHTMLStyleProps extends ParsedBaseStyleProps {
|
|
11
14
|
$el: HTMLElement;
|
|
12
15
|
innerHTML: string | HTMLElement;
|
|
16
|
+
width: ParsedElement;
|
|
17
|
+
height: ParsedElement;
|
|
13
18
|
className?: string | string[];
|
|
14
19
|
style?: string;
|
|
15
20
|
}
|
|
@@ -18,7 +23,7 @@ export interface ParsedHTMLStyleProps extends ParsedBaseStyleProps {
|
|
|
18
23
|
* @see https://github.com/pmndrs/drei#html
|
|
19
24
|
*/
|
|
20
25
|
export declare class HTML extends DisplayObject<HTMLStyleProps, ParsedHTMLStyleProps> {
|
|
21
|
-
constructor({ style, ...rest }
|
|
26
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<HTMLStyleProps>);
|
|
22
27
|
/**
|
|
23
28
|
* return wrapper HTMLElement
|
|
24
29
|
* * <div> in g-webgl/canvas
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
import { AABB } from '../shapes';
|
|
5
5
|
import { mat4, vec3 } from 'gl-matrix';
|
|
@@ -14,18 +14,23 @@ function (_super) {
|
|
|
14
14
|
__extends(HTML, _super);
|
|
15
15
|
|
|
16
16
|
function HTML(_a) {
|
|
17
|
+
if (_a === void 0) {
|
|
18
|
+
_a = {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var _this = this;
|
|
22
|
+
|
|
17
23
|
var style = _a.style,
|
|
18
24
|
rest = __rest(_a, ["style"]);
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
type:
|
|
26
|
+
_this = _super.call(this, __assign({
|
|
27
|
+
type: Shape.HTML,
|
|
22
28
|
style: __assign({
|
|
23
29
|
innerHTML: '',
|
|
24
30
|
className: '',
|
|
25
31
|
style: ''
|
|
26
32
|
}, style)
|
|
27
33
|
}, rest)) || this;
|
|
28
|
-
|
|
29
34
|
_this.cullable.enable = false;
|
|
30
35
|
return _this;
|
|
31
36
|
}
|
|
@@ -77,7 +82,7 @@ function (_super) {
|
|
|
77
82
|
var parentInvert = mat4.invert(mat4.create(), this.parentNode.getWorldTransform());
|
|
78
83
|
var bounds = this.getBounds();
|
|
79
84
|
|
|
80
|
-
if (bounds) {
|
|
85
|
+
if (!AABB.isEmpty(bounds)) {
|
|
81
86
|
var localBounds = new AABB();
|
|
82
87
|
localBounds.setFromTransformedAABB(bounds, parentInvert);
|
|
83
88
|
return localBounds;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
3
|
import type { DisplayObjectConfig } from '../dom';
|
|
4
|
+
import type { ParsedElement } from '../property-handlers';
|
|
4
5
|
export interface ImageStyleProps extends BaseStyleProps {
|
|
5
|
-
img
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
img?: string | HTMLImageElement;
|
|
7
|
+
src?: string | HTMLImageElement;
|
|
8
|
+
width?: number | string;
|
|
9
|
+
height?: number | string;
|
|
8
10
|
}
|
|
9
11
|
export interface ParsedImageStyleProps extends ParsedBaseStyleProps {
|
|
10
|
-
img
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
img?: string | HTMLImageElement;
|
|
13
|
+
src?: string | HTMLImageElement;
|
|
14
|
+
width?: ParsedElement;
|
|
15
|
+
height?: ParsedElement;
|
|
16
|
+
widthInPixels?: number;
|
|
17
|
+
heightInPixels?: number;
|
|
13
18
|
}
|
|
14
19
|
export declare class Image extends DisplayObject<ImageStyleProps, ParsedImageStyleProps> {
|
|
15
|
-
constructor({ style, ...rest }
|
|
20
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<ImageStyleProps>);
|
|
16
21
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
5
|
var Image =
|
|
@@ -8,13 +8,20 @@ function (_super) {
|
|
|
8
8
|
__extends(Image, _super);
|
|
9
9
|
|
|
10
10
|
function Image(_a) {
|
|
11
|
+
if (_a === void 0) {
|
|
12
|
+
_a = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
var style = _a.style,
|
|
12
16
|
rest = __rest(_a, ["style"]);
|
|
13
17
|
|
|
14
18
|
return _super.call(this, __assign({
|
|
15
|
-
type:
|
|
19
|
+
type: Shape.IMAGE,
|
|
16
20
|
style: __assign({
|
|
17
|
-
img: ''
|
|
21
|
+
img: '',
|
|
22
|
+
width: 'auto',
|
|
23
|
+
height: 'auto',
|
|
24
|
+
lineWidth: 0
|
|
18
25
|
}, style)
|
|
19
26
|
}, rest)) || this;
|
|
20
27
|
}
|
|
@@ -23,7 +23,7 @@ export interface ParsedLineStyleProps extends ParsedBaseStyleProps {
|
|
|
23
23
|
isBillboard?: boolean;
|
|
24
24
|
}
|
|
25
25
|
export declare class Line extends DisplayObject<LineStyleProps, ParsedLineStyleProps> {
|
|
26
|
-
constructor({ style, ...rest }
|
|
26
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<LineStyleProps>);
|
|
27
27
|
getPoint(ratio: number): Point;
|
|
28
28
|
getTotalLength(): number;
|
|
29
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
2
|
import { Line as LineUtil } from '@antv/g-math';
|
|
3
|
-
import {
|
|
3
|
+
import { Shape, LineCap, LineJoin } from '../types';
|
|
4
4
|
import { DisplayObject } from './DisplayObject';
|
|
5
5
|
import { Point } from '../shapes';
|
|
6
6
|
|
|
@@ -10,11 +10,15 @@ function (_super) {
|
|
|
10
10
|
__extends(Line, _super);
|
|
11
11
|
|
|
12
12
|
function Line(_a) {
|
|
13
|
+
if (_a === void 0) {
|
|
14
|
+
_a = {};
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
var style = _a.style,
|
|
14
18
|
rest = __rest(_a, ["style"]);
|
|
15
19
|
|
|
16
20
|
return _super.call(this, __assign({
|
|
17
|
-
type:
|
|
21
|
+
type: Shape.LINE,
|
|
18
22
|
style: __assign({
|
|
19
23
|
x1: 0,
|
|
20
24
|
y1: 0,
|
|
@@ -22,8 +26,12 @@ function (_super) {
|
|
|
22
26
|
y2: 0,
|
|
23
27
|
z1: 0,
|
|
24
28
|
z2: 0,
|
|
25
|
-
lineJoin:
|
|
26
|
-
lineCap:
|
|
29
|
+
lineJoin: LineJoin.MITER,
|
|
30
|
+
lineCap: LineCap.BUTT,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/stroke-width
|
|
34
|
+
*/
|
|
27
35
|
lineWidth: 1,
|
|
28
36
|
isBillboard: false
|
|
29
37
|
}, style)
|
|
@@ -4,7 +4,8 @@ import type { DisplayObjectConfig } from '../dom';
|
|
|
4
4
|
import { Point } from '../shapes';
|
|
5
5
|
import type { Rect } from '../shapes/Rect';
|
|
6
6
|
export interface PathStyleProps extends BaseStyleProps {
|
|
7
|
-
path
|
|
7
|
+
path?: string | PathCommand[];
|
|
8
|
+
d?: string | PathCommand[];
|
|
8
9
|
}
|
|
9
10
|
export interface PathSegment {
|
|
10
11
|
command: PathCommand[0];
|
|
@@ -30,7 +31,7 @@ export interface ParsedPathStyleProps {
|
|
|
30
31
|
export declare class Path extends DisplayObject<PathStyleProps, {
|
|
31
32
|
path: ParsedPathStyleProps;
|
|
32
33
|
}> {
|
|
33
|
-
constructor({ style, ...rest }
|
|
34
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<PathStyleProps>);
|
|
34
35
|
getTotalLength(): number;
|
|
35
36
|
/**
|
|
36
37
|
* Get point according to ratio
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape, LineCap, LineJoin } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
import { Point } from '../shapes';
|
|
5
5
|
import { Cubic as CubicUtil } from '@antv/g-math';
|
|
@@ -11,16 +11,21 @@ function (_super) {
|
|
|
11
11
|
__extends(Path, _super);
|
|
12
12
|
|
|
13
13
|
function Path(_a) {
|
|
14
|
+
if (_a === void 0) {
|
|
15
|
+
_a = {};
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
var style = _a.style,
|
|
15
19
|
rest = __rest(_a, ["style"]);
|
|
16
20
|
|
|
17
21
|
return _super.call(this, __assign({
|
|
18
|
-
type:
|
|
22
|
+
type: Shape.PATH,
|
|
19
23
|
style: __assign({
|
|
20
24
|
path: '',
|
|
21
|
-
lineJoin:
|
|
22
|
-
lineCap:
|
|
23
|
-
lineWidth: 1
|
|
25
|
+
lineJoin: LineJoin.MITER,
|
|
26
|
+
lineCap: LineCap.BUTT,
|
|
27
|
+
lineWidth: 1,
|
|
28
|
+
miterLimit: 4
|
|
24
29
|
}, style)
|
|
25
30
|
}, rest)) || this;
|
|
26
31
|
}
|
|
@@ -5,5 +5,5 @@ export interface PolygonStyleProps extends BaseStyleProps {
|
|
|
5
5
|
points: [number, number][];
|
|
6
6
|
}
|
|
7
7
|
export declare class Polygon extends DisplayObject<PolygonStyleProps, ParsedBaseStyleProps> {
|
|
8
|
-
constructor({ style, ...rest }
|
|
8
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<PolygonStyleProps>);
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
5
|
var Polygon =
|
|
@@ -8,13 +8,19 @@ function (_super) {
|
|
|
8
8
|
__extends(Polygon, _super);
|
|
9
9
|
|
|
10
10
|
function Polygon(_a) {
|
|
11
|
+
if (_a === void 0) {
|
|
12
|
+
_a = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
var style = _a.style,
|
|
12
16
|
rest = __rest(_a, ["style"]);
|
|
13
17
|
|
|
14
18
|
return _super.call(this, __assign({
|
|
15
|
-
type:
|
|
19
|
+
type: Shape.POLYGON,
|
|
16
20
|
style: __assign({
|
|
17
|
-
points: []
|
|
21
|
+
points: [],
|
|
22
|
+
miterLimit: 4,
|
|
23
|
+
lineWidth: 1
|
|
18
24
|
}, style)
|
|
19
25
|
}, rest)) || this;
|
|
20
26
|
}
|
|
@@ -11,7 +11,7 @@ export interface ParsedPolylineStyleProps {
|
|
|
11
11
|
totalLength: number;
|
|
12
12
|
}
|
|
13
13
|
export declare class Polyline extends DisplayObject<PolylineStyleProps, ParsedBaseStyleProps> {
|
|
14
|
-
constructor({ style, ...rest }
|
|
14
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<PolylineStyleProps>);
|
|
15
15
|
getTotalLength(): number;
|
|
16
16
|
getPoint(ratio: number): Point;
|
|
17
17
|
getStartTangent(): number[][];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
2
|
import { Line as LineUtil } from '@antv/g-math';
|
|
3
|
-
import {
|
|
3
|
+
import { Shape, LineCap, LineJoin } from '../types';
|
|
4
4
|
import { DisplayObject } from './DisplayObject';
|
|
5
5
|
import { Point } from '../shapes';
|
|
6
6
|
|
|
@@ -10,16 +10,21 @@ function (_super) {
|
|
|
10
10
|
__extends(Polyline, _super);
|
|
11
11
|
|
|
12
12
|
function Polyline(_a) {
|
|
13
|
+
if (_a === void 0) {
|
|
14
|
+
_a = {};
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
var style = _a.style,
|
|
14
18
|
rest = __rest(_a, ["style"]);
|
|
15
19
|
|
|
16
20
|
return _super.call(this, __assign({
|
|
17
|
-
type:
|
|
21
|
+
type: Shape.POLYLINE,
|
|
18
22
|
style: __assign({
|
|
19
23
|
points: [],
|
|
20
|
-
lineJoin:
|
|
21
|
-
lineCap:
|
|
22
|
-
lineWidth: 1
|
|
24
|
+
lineJoin: LineJoin.MITER,
|
|
25
|
+
lineCap: LineCap.BUTT,
|
|
26
|
+
lineWidth: 1,
|
|
27
|
+
miterLimit: 4
|
|
23
28
|
}, style)
|
|
24
29
|
}, rest)) || this;
|
|
25
30
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
2
2
|
import { DisplayObject } from './DisplayObject';
|
|
3
3
|
import type { DisplayObjectConfig } from '../dom';
|
|
4
|
+
import type { ParsedElement } from '../property-handlers';
|
|
4
5
|
export interface RectStyleProps extends BaseStyleProps {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
6
|
+
width: number | string;
|
|
7
|
+
height: number | string;
|
|
7
8
|
radius?: number;
|
|
8
9
|
}
|
|
9
10
|
export interface ParsedRectStyleProps extends ParsedBaseStyleProps {
|
|
10
|
-
width:
|
|
11
|
-
height:
|
|
11
|
+
width: ParsedElement;
|
|
12
|
+
height: ParsedElement;
|
|
13
|
+
widthInPixels: number;
|
|
14
|
+
heightInPixels: number;
|
|
12
15
|
radius?: number;
|
|
13
16
|
}
|
|
14
17
|
export declare class Rect extends DisplayObject<RectStyleProps, ParsedRectStyleProps> {
|
|
15
|
-
constructor({ style, ...rest }
|
|
18
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<RectStyleProps>);
|
|
16
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
5
|
var Rect =
|
|
@@ -8,14 +8,19 @@ function (_super) {
|
|
|
8
8
|
__extends(Rect, _super);
|
|
9
9
|
|
|
10
10
|
function Rect(_a) {
|
|
11
|
+
if (_a === void 0) {
|
|
12
|
+
_a = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
var style = _a.style,
|
|
12
16
|
rest = __rest(_a, ["style"]);
|
|
13
17
|
|
|
14
18
|
return _super.call(this, __assign({
|
|
15
|
-
type:
|
|
19
|
+
type: Shape.RECT,
|
|
16
20
|
style: __assign({
|
|
17
|
-
width:
|
|
18
|
-
height:
|
|
21
|
+
width: 'auto',
|
|
22
|
+
height: 'auto',
|
|
23
|
+
lineWidth: 0
|
|
19
24
|
}, style)
|
|
20
25
|
}, rest)) || this;
|
|
21
26
|
}
|
|
@@ -2,16 +2,17 @@ import type { TextMetrics } from '../services/text';
|
|
|
2
2
|
import type { DisplayObjectConfig } from '../dom/interfaces';
|
|
3
3
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
4
4
|
import { DisplayObject } from './DisplayObject';
|
|
5
|
+
import type { ParsedElement } from '../property-handlers';
|
|
5
6
|
export interface TextStyleProps extends BaseStyleProps {
|
|
6
7
|
text: string;
|
|
7
8
|
/** 设置文本内容的当前对齐方式 */
|
|
8
|
-
textAlign?: 'start' | 'center' | 'end' | 'left' | 'right';
|
|
9
|
+
textAlign?: 'inherit' | 'start' | 'center' | 'end' | 'left' | 'right';
|
|
9
10
|
/** 设置在绘制文本时使用的当前文本基线 */
|
|
10
11
|
textBaseline?: 'top' | 'hanging' | 'middle' | 'alphabetic' | 'ideographic' | 'bottom';
|
|
11
12
|
/** 字体样式 */
|
|
12
13
|
fontStyle?: 'normal' | 'italic' | 'oblique';
|
|
13
14
|
/** 文本字体大小 */
|
|
14
|
-
fontSize?: number;
|
|
15
|
+
fontSize?: number | string;
|
|
15
16
|
/** 文本字体 */
|
|
16
17
|
fontFamily?: string;
|
|
17
18
|
/** 文本粗细 */
|
|
@@ -22,13 +23,14 @@ export interface TextStyleProps extends BaseStyleProps {
|
|
|
22
23
|
lineHeight?: number;
|
|
23
24
|
letterSpacing?: number;
|
|
24
25
|
miterLimit?: number;
|
|
25
|
-
padding?: number;
|
|
26
26
|
whiteSpace?: 'pre';
|
|
27
27
|
leading?: number;
|
|
28
28
|
wordWrap?: boolean;
|
|
29
29
|
wordWrapWidth?: number;
|
|
30
30
|
dropShadow?: boolean;
|
|
31
31
|
dropShadowDistance?: number;
|
|
32
|
+
dx?: number | string;
|
|
33
|
+
dy?: number | string;
|
|
32
34
|
}
|
|
33
35
|
export interface ParsedTextStyleProps extends ParsedBaseStyleProps {
|
|
34
36
|
text: string;
|
|
@@ -39,7 +41,7 @@ export interface ParsedTextStyleProps extends ParsedBaseStyleProps {
|
|
|
39
41
|
/** 字体样式 */
|
|
40
42
|
fontStyle?: 'normal' | 'italic' | 'oblique';
|
|
41
43
|
/** 文本字体大小 */
|
|
42
|
-
fontSize?:
|
|
44
|
+
fontSize?: ParsedElement;
|
|
43
45
|
/** 文本字体 */
|
|
44
46
|
fontFamily?: string;
|
|
45
47
|
/** 文本粗细 */
|
|
@@ -50,7 +52,6 @@ export interface ParsedTextStyleProps extends ParsedBaseStyleProps {
|
|
|
50
52
|
lineHeight?: number;
|
|
51
53
|
letterSpacing?: number;
|
|
52
54
|
miterLimit?: number;
|
|
53
|
-
padding?: number;
|
|
54
55
|
whiteSpace?: 'pre';
|
|
55
56
|
leading?: number;
|
|
56
57
|
wordWrap?: boolean;
|
|
@@ -58,8 +59,10 @@ export interface ParsedTextStyleProps extends ParsedBaseStyleProps {
|
|
|
58
59
|
dropShadow?: boolean;
|
|
59
60
|
dropShadowDistance?: number;
|
|
60
61
|
metrics?: TextMetrics;
|
|
62
|
+
dx?: ParsedElement;
|
|
63
|
+
dy?: ParsedElement;
|
|
61
64
|
}
|
|
62
65
|
export declare class Text extends DisplayObject<TextStyleProps, ParsedTextStyleProps> {
|
|
63
|
-
constructor({ style, ...rest }
|
|
66
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<TextStyleProps>);
|
|
64
67
|
getLineBoundingRects(): import("..").Rectangle[];
|
|
65
68
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape, LineJoin, LineCap } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
5
|
var Text =
|
|
@@ -8,19 +8,23 @@ function (_super) {
|
|
|
8
8
|
__extends(Text, _super);
|
|
9
9
|
|
|
10
10
|
function Text(_a) {
|
|
11
|
+
if (_a === void 0) {
|
|
12
|
+
_a = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
var style = _a.style,
|
|
12
16
|
rest = __rest(_a, ["style"]);
|
|
13
17
|
|
|
14
18
|
return _super.call(this, __assign({
|
|
15
|
-
type:
|
|
19
|
+
type: Shape.TEXT,
|
|
16
20
|
style: __assign({
|
|
17
21
|
text: '',
|
|
18
|
-
fontSize:
|
|
19
|
-
fontFamily: '
|
|
22
|
+
fontSize: 'inherit',
|
|
23
|
+
fontFamily: 'inherit',
|
|
20
24
|
fontStyle: 'normal',
|
|
21
25
|
fontWeight: 'normal',
|
|
22
26
|
fontVariant: 'normal',
|
|
23
|
-
textAlign: '
|
|
27
|
+
textAlign: 'inherit',
|
|
24
28
|
textBaseline: 'alphabetic',
|
|
25
29
|
dropShadow: false,
|
|
26
30
|
// dropShadowAlpha: 1,
|
|
@@ -31,16 +35,17 @@ function (_super) {
|
|
|
31
35
|
fill: '#000',
|
|
32
36
|
letterSpacing: 0,
|
|
33
37
|
lineHeight: 0,
|
|
34
|
-
lineJoin:
|
|
35
|
-
lineCap:
|
|
38
|
+
lineJoin: LineJoin.MITER,
|
|
39
|
+
lineCap: LineCap.BUTT,
|
|
36
40
|
lineWidth: 0,
|
|
37
41
|
miterLimit: 10,
|
|
38
|
-
padding: 0,
|
|
39
42
|
stroke: '#000',
|
|
40
43
|
whiteSpace: 'pre',
|
|
41
44
|
wordWrap: false,
|
|
42
|
-
wordWrapWidth:
|
|
43
|
-
leading: 0
|
|
45
|
+
wordWrapWidth: 0,
|
|
46
|
+
leading: 0,
|
|
47
|
+
dx: 0,
|
|
48
|
+
dy: 0
|
|
44
49
|
}, style)
|
|
45
50
|
}, rest)) || this;
|
|
46
51
|
}
|
package/es/dom/Animation.js
CHANGED
|
@@ -23,7 +23,7 @@ function () {
|
|
|
23
23
|
this.effect = effect;
|
|
24
24
|
effect.animation = this;
|
|
25
25
|
this.timeline = timeline;
|
|
26
|
-
this.id = ""
|
|
26
|
+
this.id = "".concat(sequenceNumber++);
|
|
27
27
|
this._inEffect = !!this.effect.update(0);
|
|
28
28
|
this._holdTime = 0;
|
|
29
29
|
this._paused = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Shape } from '../types';
|
|
2
2
|
import { Ellipse, Circle, Rect, Image, Line, Path, Group, Polygon, Polyline, Text, HTML } from '../display-objects';
|
|
3
3
|
/**
|
|
4
4
|
* canvas.customElements
|
|
@@ -11,17 +11,17 @@ var CustomElementRegistry =
|
|
|
11
11
|
function () {
|
|
12
12
|
function CustomElementRegistry() {
|
|
13
13
|
this.registry = {};
|
|
14
|
-
this.define(
|
|
15
|
-
this.define(
|
|
16
|
-
this.define(
|
|
17
|
-
this.define(
|
|
18
|
-
this.define(
|
|
19
|
-
this.define(
|
|
20
|
-
this.define(
|
|
21
|
-
this.define(
|
|
22
|
-
this.define(
|
|
23
|
-
this.define(
|
|
24
|
-
this.define(
|
|
14
|
+
this.define(Shape.CIRCLE, Circle);
|
|
15
|
+
this.define(Shape.ELLIPSE, Ellipse);
|
|
16
|
+
this.define(Shape.RECT, Rect);
|
|
17
|
+
this.define(Shape.IMAGE, Image);
|
|
18
|
+
this.define(Shape.LINE, Line);
|
|
19
|
+
this.define(Shape.GROUP, Group);
|
|
20
|
+
this.define(Shape.PATH, Path);
|
|
21
|
+
this.define(Shape.POLYGON, Polygon);
|
|
22
|
+
this.define(Shape.POLYLINE, Polyline);
|
|
23
|
+
this.define(Shape.TEXT, Text);
|
|
24
|
+
this.define(Shape.HTML, HTML);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
CustomElementRegistry.prototype.define = function (name, constructor) {
|
package/es/dom/Document.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare class Document extends Node implements IDocument {
|
|
|
34
34
|
* @example const circle = document.createElement('circle', { style: { r: 10 } });
|
|
35
35
|
*/
|
|
36
36
|
createElement<T extends DisplayObject<StyleProps>, StyleProps extends BaseStyleProps>(tagName: string, options: DisplayObjectConfig<StyleProps>): T;
|
|
37
|
+
createElementNS<T extends DisplayObject<StyleProps>, StyleProps extends BaseStyleProps>(namespaceURI: string, tagName: string, options: DisplayObjectConfig<StyleProps>): T;
|
|
37
38
|
cloneNode(deep?: boolean): this;
|
|
38
39
|
destroy(): void;
|
|
39
40
|
/**
|