@antv/g 5.0.14 → 5.0.17
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.d.ts +3 -0
- package/es/Canvas.js +10 -12
- package/es/DisplayObjectPool.js +1 -3
- package/es/camera/Camera.d.ts +3 -2
- package/es/camera/Camera.js +17 -11
- package/es/camera/Landmark.js +1 -3
- package/es/canvas-module.js +11 -17
- 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.d.ts +0 -1
- package/es/components/Transform.js +1 -4
- package/es/display-objects/Circle.d.ts +4 -2
- package/es/display-objects/Circle.js +9 -6
- package/es/display-objects/CustomElement.d.ts +3 -2
- package/es/display-objects/CustomElement.js +10 -9
- package/es/display-objects/DisplayObject.d.ts +9 -3
- package/es/display-objects/DisplayObject.js +98 -50
- package/es/display-objects/Ellipse.d.ts +6 -3
- package/es/display-objects/Ellipse.js +9 -6
- package/es/display-objects/Group.d.ts +18 -2
- package/es/display-objects/Group.js +15 -12
- package/es/display-objects/HTML.d.ts +6 -1
- package/es/display-objects/HTML.js +8 -6
- package/es/display-objects/Image.d.ts +12 -7
- package/es/display-objects/Image.js +11 -6
- package/es/display-objects/Line.d.ts +1 -1
- package/es/display-objects/Line.js +13 -7
- package/es/display-objects/Path.d.ts +3 -2
- package/es/display-objects/Path.js +11 -8
- package/es/display-objects/Polygon.d.ts +1 -1
- package/es/display-objects/Polygon.js +10 -6
- package/es/display-objects/Polyline.d.ts +1 -1
- package/es/display-objects/Polyline.js +11 -8
- package/es/display-objects/Rect.d.ts +8 -5
- package/es/display-objects/Rect.js +10 -7
- package/es/display-objects/TSpan.d.ts +1 -0
- package/es/display-objects/TSpan.js +0 -0
- package/es/display-objects/Text.d.ts +32 -4
- package/es/display-objects/Text.js +71 -14
- 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 +2 -5
- package/es/dom/CustomElementRegistry.js +13 -15
- package/es/dom/CustomEvent.js +1 -3
- package/es/dom/Document.d.ts +2 -1
- package/es/dom/Document.js +23 -5
- package/es/dom/Element.d.ts +36 -9
- package/es/dom/Element.js +103 -15
- package/es/dom/EventTarget.d.ts +2 -2
- package/es/dom/EventTarget.js +3 -4
- package/es/dom/FederatedEvent.d.ts +5 -2
- 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/MutationEvent.d.ts +15 -0
- package/es/dom/MutationEvent.js +27 -0
- package/es/dom/MutationObserver.d.ts +36 -0
- package/es/dom/MutationObserver.js +406 -0
- package/es/dom/MutationRecord.d.ts +14 -0
- package/es/dom/MutationRecord.js +29 -0
- package/es/dom/Node.d.ts +35 -3
- package/es/dom/Node.js +185 -20
- 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 +36 -79
- 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 +4 -27
- package/es/plugins/DirtyCheckPlugin.js +3 -5
- package/es/plugins/EventPlugin.d.ts +2 -1
- package/es/plugins/EventPlugin.js +16 -8
- package/es/plugins/FrustumCullingStrategy.d.ts +1 -0
- package/es/plugins/FrustumCullingStrategy.js +40 -35
- package/es/plugins/PrepareRendererPlugin.js +22 -8
- package/es/property-handlers/aabb.js +22 -24
- package/es/property-handlers/anchor.js +2 -1
- package/es/property-handlers/color.js +3 -0
- 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 +2 -6
- package/es/services/RenderingContext.d.ts +5 -8
- package/es/services/RenderingContext.js +6 -7
- package/es/services/RenderingService.js +3 -11
- package/es/services/SceneGraphSelector.d.ts +3 -2
- package/es/services/SceneGraphSelector.js +9 -7
- package/es/services/SceneGraphService.d.ts +7 -14
- package/es/services/SceneGraphService.js +15 -85
- package/es/services/aabb/CircleUpdater.d.ts +2 -2
- package/es/services/aabb/CircleUpdater.js +22 -14
- package/es/services/aabb/EllipseUpdater.d.ts +2 -2
- package/es/services/aabb/EllipseUpdater.js +29 -16
- package/es/services/aabb/LineUpdater.js +3 -5
- package/es/services/aabb/PathUpdater.js +3 -5
- package/es/services/aabb/PolylineUpdater.js +4 -6
- package/es/services/aabb/RectUpdater.d.ts +2 -2
- package/es/services/aabb/RectUpdater.js +32 -21
- package/es/services/aabb/TextUpdater.js +20 -13
- package/es/services/text/OffscreenCanvasCreator.js +1 -3
- package/es/services/text/index.js +18 -22
- package/es/shapes/AABB.d.ts +1 -0
- package/es/shapes/AABB.js +9 -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/Polygon.js +1 -3
- package/es/shapes/Ray.js +1 -3
- package/es/shapes/Rect.js +1 -3
- package/es/shapes/Rectangle.js +1 -3
- package/es/types.d.ts +48 -26
- package/es/types.js +50 -31
- package/es/utils/animation.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 +13 -13
- 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 +1 -1
- package/lib/AbstractRenderer.js +1 -3
- package/lib/Canvas.d.ts +3 -0
- package/lib/Canvas.js +9 -11
- package/lib/DisplayObjectPool.js +1 -3
- package/lib/camera/Camera.d.ts +3 -2
- package/lib/camera/Camera.js +21 -13
- package/lib/camera/Landmark.js +1 -3
- package/lib/canvas-module.js +10 -15
- 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.d.ts +0 -1
- package/lib/components/Transform.js +1 -4
- package/lib/display-objects/Circle.d.ts +4 -2
- package/lib/display-objects/Circle.js +8 -5
- package/lib/display-objects/CustomElement.d.ts +3 -2
- package/lib/display-objects/CustomElement.js +10 -9
- package/lib/display-objects/DisplayObject.d.ts +9 -3
- package/lib/display-objects/DisplayObject.js +98 -47
- package/lib/display-objects/Ellipse.d.ts +6 -3
- package/lib/display-objects/Ellipse.js +8 -5
- package/lib/display-objects/Group.d.ts +18 -2
- package/lib/display-objects/Group.js +14 -12
- package/lib/display-objects/HTML.d.ts +6 -1
- package/lib/display-objects/HTML.js +7 -5
- package/lib/display-objects/Image.d.ts +12 -7
- package/lib/display-objects/Image.js +10 -5
- package/lib/display-objects/Line.d.ts +1 -1
- package/lib/display-objects/Line.js +12 -6
- package/lib/display-objects/Path.d.ts +3 -2
- package/lib/display-objects/Path.js +10 -7
- package/lib/display-objects/Polygon.d.ts +1 -1
- package/lib/display-objects/Polygon.js +9 -5
- package/lib/display-objects/Polyline.d.ts +1 -1
- package/lib/display-objects/Polyline.js +10 -7
- package/lib/display-objects/Rect.d.ts +8 -5
- package/lib/display-objects/Rect.js +9 -6
- package/lib/display-objects/TSpan.d.ts +1 -0
- package/lib/display-objects/TSpan.js +1 -0
- package/lib/display-objects/Text.d.ts +32 -4
- package/lib/display-objects/Text.js +71 -13
- 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 +3 -6
- package/lib/dom/CustomElementRegistry.js +12 -14
- package/lib/dom/CustomEvent.js +1 -3
- package/lib/dom/Document.d.ts +2 -1
- package/lib/dom/Document.js +25 -6
- package/lib/dom/Element.d.ts +36 -9
- package/lib/dom/Element.js +105 -15
- package/lib/dom/EventTarget.d.ts +2 -2
- package/lib/dom/EventTarget.js +3 -4
- package/lib/dom/FederatedEvent.d.ts +5 -2
- 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/MutationEvent.d.ts +15 -0
- package/lib/dom/MutationEvent.js +35 -0
- package/lib/dom/MutationObserver.d.ts +36 -0
- package/lib/dom/MutationObserver.js +417 -0
- package/lib/dom/MutationRecord.d.ts +14 -0
- package/lib/dom/MutationRecord.js +36 -0
- package/lib/dom/Node.d.ts +35 -3
- package/lib/dom/Node.js +186 -19
- 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 +42 -76
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/plugins/CullingPlugin.d.ts +0 -2
- package/lib/plugins/CullingPlugin.js +4 -27
- package/lib/plugins/DirtyCheckPlugin.js +2 -4
- package/lib/plugins/EventPlugin.d.ts +2 -1
- package/lib/plugins/EventPlugin.js +14 -8
- package/lib/plugins/FrustumCullingStrategy.d.ts +1 -0
- package/lib/plugins/FrustumCullingStrategy.js +41 -35
- package/lib/plugins/PrepareRendererPlugin.js +25 -7
- package/lib/property-handlers/aabb.js +21 -23
- package/lib/property-handlers/anchor.js +3 -1
- package/lib/property-handlers/color.js +5 -2
- package/lib/property-handlers/dimension.d.ts +15 -2
- package/lib/property-handlers/dimension.js +84 -12
- 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/interfaces.js +1 -1
- package/lib/property-handlers/lineDash.d.ts +6 -1
- package/lib/property-handlers/lineDash.js +25 -4
- package/lib/property-handlers/numeric.js +3 -3
- package/lib/property-handlers/offsetDistance.js +1 -1
- package/lib/property-handlers/path.d.ts +1 -1
- package/lib/property-handlers/path.js +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/property-handlers/transform.js +1 -1
- package/lib/services/EventService.js +2 -6
- package/lib/services/RenderingContext.d.ts +5 -8
- package/lib/services/RenderingContext.js +8 -9
- package/lib/services/RenderingService.js +2 -10
- package/lib/services/SceneGraphSelector.d.ts +3 -2
- package/lib/services/SceneGraphSelector.js +12 -7
- package/lib/services/SceneGraphService.d.ts +7 -14
- package/lib/services/SceneGraphService.js +18 -87
- package/lib/services/aabb/CircleUpdater.d.ts +2 -2
- package/lib/services/aabb/CircleUpdater.js +21 -13
- package/lib/services/aabb/EllipseUpdater.d.ts +2 -2
- package/lib/services/aabb/EllipseUpdater.js +28 -15
- package/lib/services/aabb/LineUpdater.js +2 -4
- package/lib/services/aabb/PathUpdater.js +2 -4
- package/lib/services/aabb/PolylineUpdater.js +3 -5
- package/lib/services/aabb/RectUpdater.d.ts +2 -2
- package/lib/services/aabb/RectUpdater.js +31 -20
- package/lib/services/aabb/TextUpdater.js +19 -12
- package/lib/services/aabb/index.js +10 -10
- package/lib/services/aabb/interfaces.js +1 -1
- package/lib/services/text/OffscreenCanvasCreator.js +1 -3
- package/lib/services/text/index.js +18 -22
- package/lib/shapes/AABB.d.ts +1 -0
- package/lib/shapes/AABB.js +9 -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/Polygon.js +1 -3
- package/lib/shapes/Ray.js +1 -3
- package/lib/shapes/Rect.js +1 -3
- package/lib/shapes/Rectangle.js +1 -3
- package/lib/types.d.ts +48 -26
- package/lib/types.js +56 -35
- package/lib/utils/animation.js +3 -4
- package/lib/utils/bezier-easing.js +1 -1
- package/lib/utils/custom-easing.js +1 -1
- package/lib/utils/event.js +7 -6
- 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/math.js +5 -5
- 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 +1 -4
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +16 -0
- package/lib/utils/text.js +1 -1
- package/package.json +6 -4
- package/dist/index.umd.min.js +0 -15
|
@@ -5,12 +5,12 @@ import { DisplayObjectPool } from '../DisplayObjectPool';
|
|
|
5
5
|
import { KeyframeEffect } from '../dom/KeyframeEffect';
|
|
6
6
|
import { Element } from '../dom/Element';
|
|
7
7
|
import { ElementEvent } from '../dom/interfaces';
|
|
8
|
-
import {
|
|
9
|
-
import { createVec3, fromRotationTranslationScale, getEuler, rad2deg } from '../utils';
|
|
10
|
-
// import { StylePropertyParserFactory, StylePropertyUpdaterFactory } from '../property-handlers';
|
|
11
|
-
|
|
8
|
+
import { Shape } from '../types';
|
|
9
|
+
import { createVec3, formatAttribute, fromRotationTranslationScale, getEuler, rad2deg } from '../utils';
|
|
12
10
|
import { globalContainer, stylePropertyParserFactory, stylePropertyUpdaterFactory } from '../global-module';
|
|
13
11
|
import { dirtifyToRoot } from '../services';
|
|
12
|
+
import { MutationEvent } from '../dom/MutationEvent';
|
|
13
|
+
import { Rectangle } from '../shapes';
|
|
14
14
|
var DEFAULT_STYLE_PROPS = {
|
|
15
15
|
anchor: [0, 0, 0],
|
|
16
16
|
origin: [0, 0, 0],
|
|
@@ -39,16 +39,8 @@ var DEFAULT_STYLE_PROPS = {
|
|
|
39
39
|
* * attributeChanged
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
|
-
var DisplayObject =
|
|
43
|
-
|
|
44
|
-
function (_super) {
|
|
45
|
-
__extends(DisplayObject, _super); // stylePropertyUpdaterFactory = globalContainer.get<
|
|
46
|
-
// <Key extends keyof StyleProps>(stylePropertyName: Key) => StylePropertyUpdater<any>[]
|
|
47
|
-
// >(StylePropertyUpdaterFactory);
|
|
48
|
-
// stylePropertyParserFactory = globalContainer.get<
|
|
49
|
-
// <Key extends keyof ParsedStyleProps>(stylePropertyName: Key) => StylePropertyParser<any, any>
|
|
50
|
-
// >(StylePropertyParserFactory);
|
|
51
|
-
|
|
42
|
+
var DisplayObject = function (_super) {
|
|
43
|
+
__extends(DisplayObject, _super);
|
|
52
44
|
|
|
53
45
|
function DisplayObject(config) {
|
|
54
46
|
var _a, _b, _c;
|
|
@@ -68,17 +60,38 @@ function (_super) {
|
|
|
68
60
|
|
|
69
61
|
_this.id = _this.config.id || '';
|
|
70
62
|
_this.name = _this.config.name || '';
|
|
71
|
-
|
|
63
|
+
|
|
64
|
+
if (_this.config.className || _this.config.class) {
|
|
65
|
+
_this.className = _this.config.className || _this.config.class;
|
|
66
|
+
}
|
|
67
|
+
|
|
72
68
|
_this.interactive = (_b = _this.config.interactive) !== null && _b !== void 0 ? _b : true;
|
|
73
|
-
_this.nodeName = _this.config.type ||
|
|
69
|
+
_this.nodeName = _this.config.type || Shape.GROUP; // compatible with G 3.0
|
|
74
70
|
|
|
75
71
|
_this.config.style = __assign(__assign(__assign(__assign({}, DEFAULT_STYLE_PROPS), {
|
|
76
72
|
zIndex: (_c = _this.config.zIndex) !== null && _c !== void 0 ? _c : 0,
|
|
77
73
|
visibility: _this.config.visible === false ? 'hidden' : 'visible'
|
|
78
74
|
}), _this.config.style), _this.config.attrs);
|
|
79
|
-
_this.style = new Proxy(_this.attributes, {
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
_this.style = new Proxy(__assign(__assign({}, _this.attributes), {
|
|
76
|
+
setProperty: function setProperty(propertyName, value) {
|
|
77
|
+
_this.setAttribute(propertyName, value);
|
|
78
|
+
},
|
|
79
|
+
getPropertyValue: function getPropertyValue(propertyName) {
|
|
80
|
+
return _this.getAttribute(propertyName);
|
|
81
|
+
},
|
|
82
|
+
removeProperty: function removeProperty(propertyName) {
|
|
83
|
+
_this.removeAttribute(propertyName);
|
|
84
|
+
},
|
|
85
|
+
item: function item() {
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
}), {
|
|
89
|
+
get: function get(target, name) {
|
|
90
|
+
if (name in target) {
|
|
91
|
+
return target[name];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return _this.getAttribute(name);
|
|
82
95
|
},
|
|
83
96
|
set: function set(_, prop, value) {
|
|
84
97
|
_this.setAttribute(prop, value);
|
|
@@ -113,7 +126,7 @@ function (_super) {
|
|
|
113
126
|
name: this.name,
|
|
114
127
|
className: this.name,
|
|
115
128
|
interactive: this.interactive,
|
|
116
|
-
style: __assign({}, this.
|
|
129
|
+
style: __assign({}, this.attributes)
|
|
117
130
|
});
|
|
118
131
|
|
|
119
132
|
if (deep) {
|
|
@@ -136,51 +149,62 @@ function (_super) {
|
|
|
136
149
|
var renderable = this.renderable; // parse attributes first
|
|
137
150
|
|
|
138
151
|
for (var attributeName in attributes) {
|
|
139
|
-
var
|
|
140
|
-
|
|
152
|
+
var _a = __read(formatAttribute(attributeName, attributes[attributeName]), 2),
|
|
153
|
+
name_1 = _a[0],
|
|
154
|
+
value = _a[1];
|
|
155
|
+
|
|
156
|
+
this.attributes[name_1] = value; // @ts-ignore
|
|
141
157
|
|
|
142
|
-
this.parseStyleProperty(
|
|
158
|
+
this.parseStyleProperty(name_1, value);
|
|
143
159
|
}
|
|
144
160
|
|
|
145
161
|
var priorities = {
|
|
146
|
-
x:
|
|
147
|
-
y:
|
|
162
|
+
x: Infinity,
|
|
163
|
+
y: Infinity
|
|
148
164
|
}; // update x, y at last
|
|
149
165
|
|
|
150
166
|
var sortedNames = Object.keys(attributes).sort(function (a, b) {
|
|
151
167
|
return (priorities[a] || 0) - (priorities[b] || 0);
|
|
152
168
|
});
|
|
153
169
|
sortedNames.forEach(function (attributeName) {
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
var _a = __read(formatAttribute(attributeName, ''), 1),
|
|
171
|
+
name = _a[0]; // @ts-ignore
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
_this.updateStyleProperty(name, undefined, _this.parsedStyle[name]);
|
|
156
175
|
}); // redraw at next frame
|
|
157
176
|
|
|
158
177
|
renderable.dirty = true;
|
|
159
178
|
};
|
|
160
179
|
|
|
161
|
-
DisplayObject.prototype.setAttribute = function (
|
|
180
|
+
DisplayObject.prototype.setAttribute = function (name, value, force) {
|
|
162
181
|
if (force === void 0) {
|
|
163
182
|
force = false;
|
|
164
183
|
}
|
|
165
184
|
|
|
166
|
-
|
|
185
|
+
var _a = __read(formatAttribute(name, value), 2),
|
|
186
|
+
attributeName = _a[0],
|
|
187
|
+
attributeValue = _a[1];
|
|
188
|
+
|
|
189
|
+
if (force || !isEqual(attributeValue, this.attributes[attributeName]) || attributeName === 'transformOrigin' || attributeName === 'visibility' // will affect children
|
|
167
190
|
) {
|
|
168
191
|
if (attributeName === 'visibility') {
|
|
169
192
|
// set value cascade
|
|
170
193
|
this.forEach(function (object) {
|
|
171
|
-
object.changeAttribute(attributeName,
|
|
194
|
+
object.changeAttribute(attributeName, attributeValue);
|
|
172
195
|
});
|
|
173
196
|
} else {
|
|
174
|
-
this.changeAttribute(attributeName,
|
|
197
|
+
this.changeAttribute(attributeName, attributeValue);
|
|
175
198
|
}
|
|
176
199
|
|
|
177
|
-
_super.prototype.setAttribute.call(this, attributeName,
|
|
200
|
+
_super.prototype.setAttribute.call(this, attributeName, attributeValue);
|
|
178
201
|
}
|
|
179
202
|
};
|
|
180
203
|
/**
|
|
181
204
|
* parse property, eg.
|
|
182
205
|
* * fill: 'red' => [1, 0, 0, 1]
|
|
183
206
|
* * translateX: '10px' => { unit: 'px', value: 10 }
|
|
207
|
+
* * fontSize: '2em' => { unit: 'px', value: 32 }
|
|
184
208
|
*/
|
|
185
209
|
|
|
186
210
|
|
|
@@ -190,16 +214,14 @@ function (_super) {
|
|
|
190
214
|
|
|
191
215
|
if (stylePropertyParser) {
|
|
192
216
|
// @ts-ignore
|
|
193
|
-
this.parsedStyle[name] = stylePropertyParser(value, this);
|
|
217
|
+
this.parsedStyle[name] = stylePropertyParser(value, this, name);
|
|
194
218
|
} else {
|
|
195
219
|
this.parsedStyle[name] = value;
|
|
196
220
|
}
|
|
197
221
|
};
|
|
198
222
|
|
|
199
223
|
DisplayObject.prototype.updateStyleProperty = function (name, oldParsedValue, newParsedValue) {
|
|
200
|
-
var _this = this; //
|
|
201
|
-
// @ts-ignore
|
|
202
|
-
// const stylePropertyUpdaters = this.stylePropertyUpdaterFactory(name);
|
|
224
|
+
var _this = this; // @ts-ignore
|
|
203
225
|
|
|
204
226
|
|
|
205
227
|
var stylePropertyUpdaters = stylePropertyUpdaterFactory[name];
|
|
@@ -207,7 +229,7 @@ function (_super) {
|
|
|
207
229
|
if (stylePropertyUpdaters) {
|
|
208
230
|
stylePropertyUpdaters.forEach(function (updater) {
|
|
209
231
|
// @ts-ignore
|
|
210
|
-
updater(oldParsedValue, newParsedValue, _this, _this.sceneGraphService);
|
|
232
|
+
updater(oldParsedValue, newParsedValue, _this, _this.sceneGraphService, name);
|
|
211
233
|
});
|
|
212
234
|
}
|
|
213
235
|
};
|
|
@@ -228,28 +250,54 @@ function (_super) {
|
|
|
228
250
|
|
|
229
251
|
this.parseStyleProperty(name, value); // @ts-ignore
|
|
230
252
|
|
|
231
|
-
|
|
253
|
+
var newParsedValue = this.parsedStyle[name]; // @ts-ignore
|
|
254
|
+
|
|
255
|
+
this.updateStyleProperty(name, oldParsedValue, newParsedValue); // inform clip path targets
|
|
232
256
|
|
|
233
257
|
if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
|
|
234
258
|
this.attributes.clipPathTargets.forEach(function (target) {
|
|
235
|
-
dirtifyToRoot(target);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
259
|
+
dirtifyToRoot(target); // target.emit(ElementEvent.ATTR_MODIFIED, {
|
|
260
|
+
// attributeName: 'clipPath',
|
|
261
|
+
// oldValue: this,
|
|
262
|
+
// newValue: this,
|
|
263
|
+
// });
|
|
264
|
+
|
|
265
|
+
target.dispatchEvent(new MutationEvent(ElementEvent.ATTR_MODIFIED, target, _this, _this, 'clipPath', MutationEvent.MODIFICATION, _this, _this));
|
|
241
266
|
});
|
|
242
267
|
} // redraw at next frame
|
|
243
268
|
|
|
244
269
|
|
|
245
270
|
renderable.dirty = true;
|
|
246
|
-
this.emit(ElementEvent.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
271
|
+
this.dispatchEvent(new MutationEvent(ElementEvent.ATTR_MODIFIED, this, oldValue, value, name, MutationEvent.MODIFICATION, oldParsedValue, newParsedValue)); // this.emit(ElementEvent.ATTR_MODIFIED, {
|
|
272
|
+
// attrName: name,
|
|
273
|
+
// attributeName: name,
|
|
274
|
+
// prevValue: oldValue,
|
|
275
|
+
// oldValue,
|
|
276
|
+
// newValue: value,
|
|
277
|
+
// oldParsedValue,
|
|
278
|
+
// newParsedValue,
|
|
279
|
+
// });
|
|
251
280
|
}; // #region transformable
|
|
252
281
|
|
|
282
|
+
/**
|
|
283
|
+
* returns different values than getBoundingClientRect(), as the latter returns value relative to the viewport
|
|
284
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox
|
|
285
|
+
*/
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
DisplayObject.prototype.getBBox = function () {
|
|
289
|
+
var aabb = this.getBounds();
|
|
290
|
+
|
|
291
|
+
var _a = __read(aabb.getMin(), 2),
|
|
292
|
+
left = _a[0],
|
|
293
|
+
top = _a[1];
|
|
294
|
+
|
|
295
|
+
var _b = __read(aabb.getMax(), 2),
|
|
296
|
+
right = _b[0],
|
|
297
|
+
bottom = _b[1];
|
|
298
|
+
|
|
299
|
+
return new Rectangle(left, top, right - left, bottom - top);
|
|
300
|
+
};
|
|
253
301
|
|
|
254
302
|
DisplayObject.prototype.setOrigin = function (position, y, z) {
|
|
255
303
|
if (y === void 0) {
|
|
@@ -571,7 +619,7 @@ function (_super) {
|
|
|
571
619
|
|
|
572
620
|
DisplayObject.prototype.isVisible = function () {
|
|
573
621
|
var cullable = this.cullable;
|
|
574
|
-
return this.
|
|
622
|
+
return this.getAttribute('visibility') === 'visible' && (!cullable || cullable && !cullable.isCulled());
|
|
575
623
|
};
|
|
576
624
|
/**
|
|
577
625
|
* bring to front in current group
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { DisplayObjectConfig } from '../dom/interfaces';
|
|
2
2
|
import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
|
+
import type { ParsedElement } from '../property-handlers';
|
|
4
5
|
export interface EllipseStyleProps extends BaseStyleProps {
|
|
5
6
|
rx: number;
|
|
6
7
|
ry: number;
|
|
7
8
|
}
|
|
8
9
|
export interface ParsedEllipseStyleProps extends ParsedBaseStyleProps {
|
|
9
|
-
rx:
|
|
10
|
-
ry:
|
|
10
|
+
rx: ParsedElement;
|
|
11
|
+
ry: ParsedElement;
|
|
12
|
+
rxInPixels: number;
|
|
13
|
+
ryInPixels: number;
|
|
11
14
|
}
|
|
12
15
|
export declare class Ellipse extends DisplayObject<EllipseStyleProps, ParsedEllipseStyleProps> {
|
|
13
|
-
constructor({ style, ...rest }
|
|
16
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<EllipseStyleProps>);
|
|
14
17
|
}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
|
-
var Ellipse =
|
|
6
|
-
/** @class */
|
|
7
|
-
function (_super) {
|
|
5
|
+
var Ellipse = function (_super) {
|
|
8
6
|
__extends(Ellipse, _super);
|
|
9
7
|
|
|
10
8
|
function Ellipse(_a) {
|
|
9
|
+
if (_a === void 0) {
|
|
10
|
+
_a = {};
|
|
11
|
+
}
|
|
12
|
+
|
|
11
13
|
var style = _a.style,
|
|
12
14
|
rest = __rest(_a, ["style"]);
|
|
13
15
|
|
|
14
16
|
return _super.call(this, __assign({
|
|
15
|
-
type:
|
|
17
|
+
type: Shape.ELLIPSE,
|
|
16
18
|
style: __assign({
|
|
17
19
|
rx: 0,
|
|
18
20
|
ry: 0,
|
|
19
|
-
anchor: [0.5, 0.5]
|
|
21
|
+
anchor: [0.5, 0.5],
|
|
22
|
+
lineWidth: 0
|
|
20
23
|
}, style)
|
|
21
24
|
}, rest)) || this;
|
|
22
25
|
}
|
|
@@ -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,24 +1,27 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
|
-
var Group =
|
|
6
|
-
/** @class */
|
|
7
|
-
function (_super) {
|
|
5
|
+
var Group = function (_super) {
|
|
8
6
|
__extends(Group, _super);
|
|
9
7
|
|
|
10
|
-
function Group(
|
|
11
|
-
|
|
8
|
+
function Group(_a) {
|
|
9
|
+
if (_a === void 0) {
|
|
10
|
+
_a = {};
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
var
|
|
14
|
-
style = _a.style,
|
|
13
|
+
var style = _a.style,
|
|
15
14
|
rest = __rest(_a, ["style"]);
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
type:
|
|
19
|
-
style: __assign({
|
|
16
|
+
return _super.call(this, __assign({
|
|
17
|
+
type: Shape.GROUP,
|
|
18
|
+
style: __assign({
|
|
19
|
+
width: 'auto',
|
|
20
|
+
height: 'auto',
|
|
21
|
+
textAlign: 'inherit',
|
|
22
|
+
fontSize: 'inherit'
|
|
23
|
+
}, style)
|
|
20
24
|
}, rest)) || this;
|
|
21
|
-
return _this;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
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';
|
|
@@ -8,17 +8,19 @@ import { mat4, vec3 } from 'gl-matrix';
|
|
|
8
8
|
* @see https://github.com/pmndrs/drei#html
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
var HTML =
|
|
12
|
-
/** @class */
|
|
13
|
-
function (_super) {
|
|
11
|
+
var HTML = function (_super) {
|
|
14
12
|
__extends(HTML, _super);
|
|
15
13
|
|
|
16
14
|
function HTML(_a) {
|
|
15
|
+
if (_a === void 0) {
|
|
16
|
+
_a = {};
|
|
17
|
+
}
|
|
18
|
+
|
|
17
19
|
var style = _a.style,
|
|
18
20
|
rest = __rest(_a, ["style"]);
|
|
19
21
|
|
|
20
22
|
var _this = _super.call(this, __assign({
|
|
21
|
-
type:
|
|
23
|
+
type: Shape.HTML,
|
|
22
24
|
style: __assign({
|
|
23
25
|
innerHTML: '',
|
|
24
26
|
className: '',
|
|
@@ -77,7 +79,7 @@ function (_super) {
|
|
|
77
79
|
var parentInvert = mat4.invert(mat4.create(), this.parentNode.getWorldTransform());
|
|
78
80
|
var bounds = this.getBounds();
|
|
79
81
|
|
|
80
|
-
if (bounds) {
|
|
82
|
+
if (!AABB.isEmpty(bounds)) {
|
|
81
83
|
var localBounds = new AABB();
|
|
82
84
|
localBounds.setFromTransformedAABB(bounds, parentInvert);
|
|
83
85
|
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,20 +1,25 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
|
-
var Image =
|
|
6
|
-
/** @class */
|
|
7
|
-
function (_super) {
|
|
5
|
+
var Image = function (_super) {
|
|
8
6
|
__extends(Image, _super);
|
|
9
7
|
|
|
10
8
|
function Image(_a) {
|
|
9
|
+
if (_a === void 0) {
|
|
10
|
+
_a = {};
|
|
11
|
+
}
|
|
12
|
+
|
|
11
13
|
var style = _a.style,
|
|
12
14
|
rest = __rest(_a, ["style"]);
|
|
13
15
|
|
|
14
16
|
return _super.call(this, __assign({
|
|
15
|
-
type:
|
|
17
|
+
type: Shape.IMAGE,
|
|
16
18
|
style: __assign({
|
|
17
|
-
img: ''
|
|
19
|
+
img: '',
|
|
20
|
+
width: 'auto',
|
|
21
|
+
height: 'auto',
|
|
22
|
+
lineWidth: 0
|
|
18
23
|
}, style)
|
|
19
24
|
}, rest)) || this;
|
|
20
25
|
}
|
|
@@ -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,20 +1,22 @@
|
|
|
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
|
|
|
7
|
-
var Line =
|
|
8
|
-
/** @class */
|
|
9
|
-
function (_super) {
|
|
7
|
+
var Line = function (_super) {
|
|
10
8
|
__extends(Line, _super);
|
|
11
9
|
|
|
12
10
|
function Line(_a) {
|
|
11
|
+
if (_a === void 0) {
|
|
12
|
+
_a = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
13
15
|
var style = _a.style,
|
|
14
16
|
rest = __rest(_a, ["style"]);
|
|
15
17
|
|
|
16
18
|
return _super.call(this, __assign({
|
|
17
|
-
type:
|
|
19
|
+
type: Shape.LINE,
|
|
18
20
|
style: __assign({
|
|
19
21
|
x1: 0,
|
|
20
22
|
y1: 0,
|
|
@@ -22,8 +24,12 @@ function (_super) {
|
|
|
22
24
|
y2: 0,
|
|
23
25
|
z1: 0,
|
|
24
26
|
z2: 0,
|
|
25
|
-
lineJoin:
|
|
26
|
-
lineCap:
|
|
27
|
+
lineJoin: LineJoin.MITER,
|
|
28
|
+
lineCap: LineCap.BUTT,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/stroke-width
|
|
32
|
+
*/
|
|
27
33
|
lineWidth: 1,
|
|
28
34
|
isBillboard: false
|
|
29
35
|
}, 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,26 +1,29 @@
|
|
|
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';
|
|
6
6
|
import { isNil } from '@antv/util';
|
|
7
7
|
|
|
8
|
-
var Path =
|
|
9
|
-
/** @class */
|
|
10
|
-
function (_super) {
|
|
8
|
+
var Path = function (_super) {
|
|
11
9
|
__extends(Path, _super);
|
|
12
10
|
|
|
13
11
|
function Path(_a) {
|
|
12
|
+
if (_a === void 0) {
|
|
13
|
+
_a = {};
|
|
14
|
+
}
|
|
15
|
+
|
|
14
16
|
var style = _a.style,
|
|
15
17
|
rest = __rest(_a, ["style"]);
|
|
16
18
|
|
|
17
19
|
return _super.call(this, __assign({
|
|
18
|
-
type:
|
|
20
|
+
type: Shape.PATH,
|
|
19
21
|
style: __assign({
|
|
20
22
|
path: '',
|
|
21
|
-
lineJoin:
|
|
22
|
-
lineCap:
|
|
23
|
-
lineWidth: 1
|
|
23
|
+
lineJoin: LineJoin.MITER,
|
|
24
|
+
lineCap: LineCap.BUTT,
|
|
25
|
+
lineWidth: 1,
|
|
26
|
+
miterLimit: 4
|
|
24
27
|
}, style)
|
|
25
28
|
}, rest)) || this;
|
|
26
29
|
}
|
|
@@ -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,20 +1,24 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
|
-
var Polygon =
|
|
6
|
-
/** @class */
|
|
7
|
-
function (_super) {
|
|
5
|
+
var Polygon = function (_super) {
|
|
8
6
|
__extends(Polygon, _super);
|
|
9
7
|
|
|
10
8
|
function Polygon(_a) {
|
|
9
|
+
if (_a === void 0) {
|
|
10
|
+
_a = {};
|
|
11
|
+
}
|
|
12
|
+
|
|
11
13
|
var style = _a.style,
|
|
12
14
|
rest = __rest(_a, ["style"]);
|
|
13
15
|
|
|
14
16
|
return _super.call(this, __assign({
|
|
15
|
-
type:
|
|
17
|
+
type: Shape.POLYGON,
|
|
16
18
|
style: __assign({
|
|
17
|
-
points: []
|
|
19
|
+
points: [],
|
|
20
|
+
miterLimit: 4,
|
|
21
|
+
lineWidth: 1
|
|
18
22
|
}, style)
|
|
19
23
|
}, rest)) || this;
|
|
20
24
|
}
|