@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
|
@@ -27,8 +27,8 @@ var _globalModule = require("../global-module");
|
|
|
27
27
|
|
|
28
28
|
var _services = require("../services");
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
var _MutationEvent = require("../dom/MutationEvent");
|
|
31
|
+
|
|
32
32
|
var DEFAULT_STYLE_PROPS = {
|
|
33
33
|
anchor: [0, 0, 0],
|
|
34
34
|
origin: [0, 0, 0],
|
|
@@ -60,22 +60,18 @@ var DEFAULT_STYLE_PROPS = {
|
|
|
60
60
|
var DisplayObject =
|
|
61
61
|
/** @class */
|
|
62
62
|
function (_super) {
|
|
63
|
-
(0, _tslib.__extends)(DisplayObject, _super);
|
|
64
|
-
// <Key extends keyof StyleProps>(stylePropertyName: Key) => StylePropertyUpdater<any>[]
|
|
65
|
-
// >(StylePropertyUpdaterFactory);
|
|
66
|
-
// stylePropertyParserFactory = globalContainer.get<
|
|
67
|
-
// <Key extends keyof ParsedStyleProps>(stylePropertyName: Key) => StylePropertyParser<any, any>
|
|
68
|
-
// >(StylePropertyParserFactory);
|
|
63
|
+
(0, _tslib.__extends)(DisplayObject, _super);
|
|
69
64
|
|
|
70
65
|
function DisplayObject(config) {
|
|
66
|
+
var _this = this;
|
|
67
|
+
|
|
71
68
|
var _a, _b, _c;
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
_this = _super.call(this) || this;
|
|
74
71
|
/**
|
|
75
72
|
* push to active animations after calling `animate()`
|
|
76
73
|
*/
|
|
77
74
|
|
|
78
|
-
|
|
79
75
|
_this.activeAnimations = []; // assign name, id to config
|
|
80
76
|
// eg. group.get('name')
|
|
81
77
|
|
|
@@ -85,17 +81,38 @@ function (_super) {
|
|
|
85
81
|
|
|
86
82
|
_this.id = _this.config.id || '';
|
|
87
83
|
_this.name = _this.config.name || '';
|
|
88
|
-
|
|
84
|
+
|
|
85
|
+
if (_this.config.className || _this.config.class) {
|
|
86
|
+
_this.className = _this.config.className || _this.config.class;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
89
|
_this.interactive = (_b = _this.config.interactive) !== null && _b !== void 0 ? _b : true;
|
|
90
|
-
_this.nodeName = _this.config.type || _types.
|
|
90
|
+
_this.nodeName = _this.config.type || _types.Shape.GROUP; // compatible with G 3.0
|
|
91
91
|
|
|
92
92
|
_this.config.style = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, DEFAULT_STYLE_PROPS), {
|
|
93
93
|
zIndex: (_c = _this.config.zIndex) !== null && _c !== void 0 ? _c : 0,
|
|
94
94
|
visibility: _this.config.visible === false ? 'hidden' : 'visible'
|
|
95
95
|
}), _this.config.style), _this.config.attrs);
|
|
96
|
-
_this.style = new Proxy(_this.attributes, {
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
_this.style = new Proxy((0, _tslib.__assign)((0, _tslib.__assign)({}, _this.attributes), {
|
|
97
|
+
setProperty: function setProperty(propertyName, value) {
|
|
98
|
+
_this.setAttribute(propertyName, value);
|
|
99
|
+
},
|
|
100
|
+
getPropertyValue: function getPropertyValue(propertyName) {
|
|
101
|
+
return _this.getAttribute(propertyName);
|
|
102
|
+
},
|
|
103
|
+
removeProperty: function removeProperty(propertyName) {
|
|
104
|
+
_this.removeAttribute(propertyName);
|
|
105
|
+
},
|
|
106
|
+
item: function item() {
|
|
107
|
+
return '';
|
|
108
|
+
}
|
|
109
|
+
}), {
|
|
110
|
+
get: function get(target, name) {
|
|
111
|
+
if (name in target) {
|
|
112
|
+
return target[name];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return _this.getAttribute(name);
|
|
99
116
|
},
|
|
100
117
|
set: function set(_, prop, value) {
|
|
101
118
|
_this.setAttribute(prop, value);
|
|
@@ -132,7 +149,7 @@ function (_super) {
|
|
|
132
149
|
name: this.name,
|
|
133
150
|
className: this.name,
|
|
134
151
|
interactive: this.interactive,
|
|
135
|
-
style: (0, _tslib.__assign)({}, this.
|
|
152
|
+
style: (0, _tslib.__assign)({}, this.attributes)
|
|
136
153
|
});
|
|
137
154
|
|
|
138
155
|
if (deep) {
|
|
@@ -155,51 +172,62 @@ function (_super) {
|
|
|
155
172
|
var renderable = this.renderable; // parse attributes first
|
|
156
173
|
|
|
157
174
|
for (var attributeName in attributes) {
|
|
158
|
-
var
|
|
159
|
-
|
|
175
|
+
var _a = (0, _tslib.__read)((0, _utils.formatAttribute)(attributeName, attributes[attributeName]), 2),
|
|
176
|
+
name_1 = _a[0],
|
|
177
|
+
value = _a[1];
|
|
178
|
+
|
|
179
|
+
this.attributes[name_1] = value; // @ts-ignore
|
|
160
180
|
|
|
161
|
-
this.parseStyleProperty(
|
|
181
|
+
this.parseStyleProperty(name_1, value);
|
|
162
182
|
}
|
|
163
183
|
|
|
164
184
|
var priorities = {
|
|
165
|
-
x:
|
|
166
|
-
y:
|
|
185
|
+
x: Infinity,
|
|
186
|
+
y: Infinity
|
|
167
187
|
}; // update x, y at last
|
|
168
188
|
|
|
169
189
|
var sortedNames = Object.keys(attributes).sort(function (a, b) {
|
|
170
190
|
return (priorities[a] || 0) - (priorities[b] || 0);
|
|
171
191
|
});
|
|
172
192
|
sortedNames.forEach(function (attributeName) {
|
|
173
|
-
|
|
174
|
-
|
|
193
|
+
var _a = (0, _tslib.__read)((0, _utils.formatAttribute)(attributeName, ''), 1),
|
|
194
|
+
name = _a[0]; // @ts-ignore
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
_this.updateStyleProperty(name, undefined, _this.parsedStyle[name]);
|
|
175
198
|
}); // redraw at next frame
|
|
176
199
|
|
|
177
200
|
renderable.dirty = true;
|
|
178
201
|
};
|
|
179
202
|
|
|
180
|
-
DisplayObject.prototype.setAttribute = function (
|
|
203
|
+
DisplayObject.prototype.setAttribute = function (name, value, force) {
|
|
181
204
|
if (force === void 0) {
|
|
182
205
|
force = false;
|
|
183
206
|
}
|
|
184
207
|
|
|
185
|
-
|
|
208
|
+
var _a = (0, _tslib.__read)((0, _utils.formatAttribute)(name, value), 2),
|
|
209
|
+
attributeName = _a[0],
|
|
210
|
+
attributeValue = _a[1];
|
|
211
|
+
|
|
212
|
+
if (force || !(0, _util.isEqual)(attributeValue, this.attributes[attributeName]) || attributeName === 'transformOrigin' || attributeName === 'visibility' // will affect children
|
|
186
213
|
) {
|
|
187
214
|
if (attributeName === 'visibility') {
|
|
188
215
|
// set value cascade
|
|
189
216
|
this.forEach(function (object) {
|
|
190
|
-
object.changeAttribute(attributeName,
|
|
217
|
+
object.changeAttribute(attributeName, attributeValue);
|
|
191
218
|
});
|
|
192
219
|
} else {
|
|
193
|
-
this.changeAttribute(attributeName,
|
|
220
|
+
this.changeAttribute(attributeName, attributeValue);
|
|
194
221
|
}
|
|
195
222
|
|
|
196
|
-
_super.prototype.setAttribute.call(this, attributeName,
|
|
223
|
+
_super.prototype.setAttribute.call(this, attributeName, attributeValue);
|
|
197
224
|
}
|
|
198
225
|
};
|
|
199
226
|
/**
|
|
200
227
|
* parse property, eg.
|
|
201
228
|
* * fill: 'red' => [1, 0, 0, 1]
|
|
202
229
|
* * translateX: '10px' => { unit: 'px', value: 10 }
|
|
230
|
+
* * fontSize: '2em' => { unit: 'px', value: 32 }
|
|
203
231
|
*/
|
|
204
232
|
|
|
205
233
|
|
|
@@ -209,16 +237,14 @@ function (_super) {
|
|
|
209
237
|
|
|
210
238
|
if (stylePropertyParser) {
|
|
211
239
|
// @ts-ignore
|
|
212
|
-
this.parsedStyle[name] = stylePropertyParser(value, this);
|
|
240
|
+
this.parsedStyle[name] = stylePropertyParser(value, this, name);
|
|
213
241
|
} else {
|
|
214
242
|
this.parsedStyle[name] = value;
|
|
215
243
|
}
|
|
216
244
|
};
|
|
217
245
|
|
|
218
246
|
DisplayObject.prototype.updateStyleProperty = function (name, oldParsedValue, newParsedValue) {
|
|
219
|
-
var _this = this; //
|
|
220
|
-
// @ts-ignore
|
|
221
|
-
// const stylePropertyUpdaters = this.stylePropertyUpdaterFactory(name);
|
|
247
|
+
var _this = this; // @ts-ignore
|
|
222
248
|
|
|
223
249
|
|
|
224
250
|
var stylePropertyUpdaters = _globalModule.stylePropertyUpdaterFactory[name];
|
|
@@ -226,7 +252,7 @@ function (_super) {
|
|
|
226
252
|
if (stylePropertyUpdaters) {
|
|
227
253
|
stylePropertyUpdaters.forEach(function (updater) {
|
|
228
254
|
// @ts-ignore
|
|
229
|
-
updater(oldParsedValue, newParsedValue, _this, _this.sceneGraphService);
|
|
255
|
+
updater(oldParsedValue, newParsedValue, _this, _this.sceneGraphService, name);
|
|
230
256
|
});
|
|
231
257
|
}
|
|
232
258
|
};
|
|
@@ -247,26 +273,33 @@ function (_super) {
|
|
|
247
273
|
|
|
248
274
|
this.parseStyleProperty(name, value); // @ts-ignore
|
|
249
275
|
|
|
250
|
-
|
|
276
|
+
var newParsedValue = this.parsedStyle[name]; // @ts-ignore
|
|
277
|
+
|
|
278
|
+
this.updateStyleProperty(name, oldParsedValue, newParsedValue); // inform clip path targets
|
|
251
279
|
|
|
252
280
|
if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
|
|
253
281
|
this.attributes.clipPathTargets.forEach(function (target) {
|
|
254
|
-
(0, _services.dirtifyToRoot)(target);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
282
|
+
(0, _services.dirtifyToRoot)(target); // target.emit(ElementEvent.ATTR_MODIFIED, {
|
|
283
|
+
// attributeName: 'clipPath',
|
|
284
|
+
// oldValue: this,
|
|
285
|
+
// newValue: this,
|
|
286
|
+
// });
|
|
287
|
+
|
|
288
|
+
target.dispatchEvent(new _MutationEvent.MutationEvent(_interfaces.ElementEvent.ATTR_MODIFIED, target, _this, _this, 'clipPath', _MutationEvent.MutationEvent.MODIFICATION, _this, _this));
|
|
260
289
|
});
|
|
261
290
|
} // redraw at next frame
|
|
262
291
|
|
|
263
292
|
|
|
264
293
|
renderable.dirty = true;
|
|
265
|
-
this.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
294
|
+
this.dispatchEvent(new _MutationEvent.MutationEvent(_interfaces.ElementEvent.ATTR_MODIFIED, this, oldValue, value, name, _MutationEvent.MutationEvent.MODIFICATION, oldParsedValue, newParsedValue)); // this.emit(ElementEvent.ATTR_MODIFIED, {
|
|
295
|
+
// attrName: name,
|
|
296
|
+
// attributeName: name,
|
|
297
|
+
// prevValue: oldValue,
|
|
298
|
+
// oldValue,
|
|
299
|
+
// newValue: value,
|
|
300
|
+
// oldParsedValue,
|
|
301
|
+
// newParsedValue,
|
|
302
|
+
// });
|
|
270
303
|
}; // #region transformable
|
|
271
304
|
|
|
272
305
|
|
|
@@ -590,7 +623,7 @@ function (_super) {
|
|
|
590
623
|
|
|
591
624
|
DisplayObject.prototype.isVisible = function () {
|
|
592
625
|
var cullable = this.cullable;
|
|
593
|
-
return this.
|
|
626
|
+
return this.getAttribute('visibility') === 'visible' && (!cullable || cullable && !cullable.isCulled());
|
|
594
627
|
};
|
|
595
628
|
/**
|
|
596
629
|
* 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
|
}
|
|
@@ -17,14 +17,19 @@ function (_super) {
|
|
|
17
17
|
(0, _tslib.__extends)(Ellipse, _super);
|
|
18
18
|
|
|
19
19
|
function Ellipse(_a) {
|
|
20
|
+
if (_a === void 0) {
|
|
21
|
+
_a = {};
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
var style = _a.style,
|
|
21
25
|
rest = (0, _tslib.__rest)(_a, ["style"]);
|
|
22
26
|
return _super.call(this, (0, _tslib.__assign)({
|
|
23
|
-
type: _types.
|
|
27
|
+
type: _types.Shape.ELLIPSE,
|
|
24
28
|
style: (0, _tslib.__assign)({
|
|
25
29
|
rx: 0,
|
|
26
30
|
ry: 0,
|
|
27
|
-
anchor: [0.5, 0.5]
|
|
31
|
+
anchor: [0.5, 0.5],
|
|
32
|
+
lineWidth: 0
|
|
28
33
|
}, style)
|
|
29
34
|
}, rest)) || this;
|
|
30
35
|
}
|
|
@@ -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
|
}
|
|
@@ -16,18 +16,22 @@ var Group =
|
|
|
16
16
|
function (_super) {
|
|
17
17
|
(0, _tslib.__extends)(Group, _super);
|
|
18
18
|
|
|
19
|
-
function Group(
|
|
20
|
-
|
|
19
|
+
function Group(_a) {
|
|
20
|
+
if (_a === void 0) {
|
|
21
|
+
_a = {};
|
|
22
|
+
}
|
|
21
23
|
|
|
22
|
-
var
|
|
23
|
-
style = _a.style,
|
|
24
|
+
var style = _a.style,
|
|
24
25
|
rest = (0, _tslib.__rest)(_a, ["style"]);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
return _super.call(this, (0, _tslib.__assign)({
|
|
27
|
+
type: _types.Shape.GROUP,
|
|
28
|
+
style: (0, _tslib.__assign)({
|
|
29
|
+
width: 'auto',
|
|
30
|
+
height: 'auto',
|
|
31
|
+
textAlign: 'inherit',
|
|
32
|
+
fontSize: 'inherit'
|
|
33
|
+
}, style)
|
|
29
34
|
}, rest)) || this;
|
|
30
|
-
return _this;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
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
|
|
@@ -25,18 +25,22 @@ function (_super) {
|
|
|
25
25
|
(0, _tslib.__extends)(HTML, _super);
|
|
26
26
|
|
|
27
27
|
function HTML(_a) {
|
|
28
|
+
if (_a === void 0) {
|
|
29
|
+
_a = {};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var _this = this;
|
|
33
|
+
|
|
28
34
|
var style = _a.style,
|
|
29
35
|
rest = (0, _tslib.__rest)(_a, ["style"]);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: _types.SHAPE.HTML,
|
|
36
|
+
_this = _super.call(this, (0, _tslib.__assign)({
|
|
37
|
+
type: _types.Shape.HTML,
|
|
33
38
|
style: (0, _tslib.__assign)({
|
|
34
39
|
innerHTML: '',
|
|
35
40
|
className: '',
|
|
36
41
|
style: ''
|
|
37
42
|
}, style)
|
|
38
43
|
}, rest)) || this;
|
|
39
|
-
|
|
40
44
|
_this.cullable.enable = false;
|
|
41
45
|
return _this;
|
|
42
46
|
}
|
|
@@ -89,7 +93,7 @@ function (_super) {
|
|
|
89
93
|
|
|
90
94
|
var bounds = this.getBounds();
|
|
91
95
|
|
|
92
|
-
if (bounds) {
|
|
96
|
+
if (!_shapes.AABB.isEmpty(bounds)) {
|
|
93
97
|
var localBounds = new _shapes.AABB();
|
|
94
98
|
localBounds.setFromTransformedAABB(bounds, parentInvert);
|
|
95
99
|
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
|
}
|
|
@@ -17,12 +17,19 @@ function (_super) {
|
|
|
17
17
|
(0, _tslib.__extends)(Image, _super);
|
|
18
18
|
|
|
19
19
|
function Image(_a) {
|
|
20
|
+
if (_a === void 0) {
|
|
21
|
+
_a = {};
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
var style = _a.style,
|
|
21
25
|
rest = (0, _tslib.__rest)(_a, ["style"]);
|
|
22
26
|
return _super.call(this, (0, _tslib.__assign)({
|
|
23
|
-
type: _types.
|
|
27
|
+
type: _types.Shape.IMAGE,
|
|
24
28
|
style: (0, _tslib.__assign)({
|
|
25
|
-
img: ''
|
|
29
|
+
img: '',
|
|
30
|
+
width: 'auto',
|
|
31
|
+
height: 'auto',
|
|
32
|
+
lineWidth: 0
|
|
26
33
|
}, style)
|
|
27
34
|
}, rest)) || this;
|
|
28
35
|
}
|
|
@@ -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
|
}
|
|
@@ -21,10 +21,14 @@ function (_super) {
|
|
|
21
21
|
(0, _tslib.__extends)(Line, _super);
|
|
22
22
|
|
|
23
23
|
function Line(_a) {
|
|
24
|
+
if (_a === void 0) {
|
|
25
|
+
_a = {};
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
var style = _a.style,
|
|
25
29
|
rest = (0, _tslib.__rest)(_a, ["style"]);
|
|
26
30
|
return _super.call(this, (0, _tslib.__assign)({
|
|
27
|
-
type: _types.
|
|
31
|
+
type: _types.Shape.LINE,
|
|
28
32
|
style: (0, _tslib.__assign)({
|
|
29
33
|
x1: 0,
|
|
30
34
|
y1: 0,
|
|
@@ -32,8 +36,12 @@ function (_super) {
|
|
|
32
36
|
y2: 0,
|
|
33
37
|
z1: 0,
|
|
34
38
|
z2: 0,
|
|
35
|
-
lineJoin: _types.
|
|
36
|
-
lineCap: _types.
|
|
39
|
+
lineJoin: _types.LineJoin.MITER,
|
|
40
|
+
lineCap: _types.LineCap.BUTT,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/stroke-width
|
|
44
|
+
*/
|
|
37
45
|
lineWidth: 1,
|
|
38
46
|
isBillboard: false
|
|
39
47
|
}, 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
|
|
@@ -23,15 +23,20 @@ function (_super) {
|
|
|
23
23
|
(0, _tslib.__extends)(Path, _super);
|
|
24
24
|
|
|
25
25
|
function Path(_a) {
|
|
26
|
+
if (_a === void 0) {
|
|
27
|
+
_a = {};
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
var style = _a.style,
|
|
27
31
|
rest = (0, _tslib.__rest)(_a, ["style"]);
|
|
28
32
|
return _super.call(this, (0, _tslib.__assign)({
|
|
29
|
-
type: _types.
|
|
33
|
+
type: _types.Shape.PATH,
|
|
30
34
|
style: (0, _tslib.__assign)({
|
|
31
35
|
path: '',
|
|
32
|
-
lineJoin: _types.
|
|
33
|
-
lineCap: _types.
|
|
34
|
-
lineWidth: 1
|
|
36
|
+
lineJoin: _types.LineJoin.MITER,
|
|
37
|
+
lineCap: _types.LineCap.BUTT,
|
|
38
|
+
lineWidth: 1,
|
|
39
|
+
miterLimit: 4
|
|
35
40
|
}, style)
|
|
36
41
|
}, rest)) || this;
|
|
37
42
|
}
|
|
@@ -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
|
}
|
|
@@ -17,12 +17,18 @@ function (_super) {
|
|
|
17
17
|
(0, _tslib.__extends)(Polygon, _super);
|
|
18
18
|
|
|
19
19
|
function Polygon(_a) {
|
|
20
|
+
if (_a === void 0) {
|
|
21
|
+
_a = {};
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
var style = _a.style,
|
|
21
25
|
rest = (0, _tslib.__rest)(_a, ["style"]);
|
|
22
26
|
return _super.call(this, (0, _tslib.__assign)({
|
|
23
|
-
type: _types.
|
|
27
|
+
type: _types.Shape.POLYGON,
|
|
24
28
|
style: (0, _tslib.__assign)({
|
|
25
|
-
points: []
|
|
29
|
+
points: [],
|
|
30
|
+
miterLimit: 4,
|
|
31
|
+
lineWidth: 1
|
|
26
32
|
}, style)
|
|
27
33
|
}, rest)) || this;
|
|
28
34
|
}
|
|
@@ -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[][];
|
|
@@ -21,15 +21,20 @@ function (_super) {
|
|
|
21
21
|
(0, _tslib.__extends)(Polyline, _super);
|
|
22
22
|
|
|
23
23
|
function Polyline(_a) {
|
|
24
|
+
if (_a === void 0) {
|
|
25
|
+
_a = {};
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
var style = _a.style,
|
|
25
29
|
rest = (0, _tslib.__rest)(_a, ["style"]);
|
|
26
30
|
return _super.call(this, (0, _tslib.__assign)({
|
|
27
|
-
type: _types.
|
|
31
|
+
type: _types.Shape.POLYLINE,
|
|
28
32
|
style: (0, _tslib.__assign)({
|
|
29
33
|
points: [],
|
|
30
|
-
lineJoin: _types.
|
|
31
|
-
lineCap: _types.
|
|
32
|
-
lineWidth: 1
|
|
34
|
+
lineJoin: _types.LineJoin.MITER,
|
|
35
|
+
lineCap: _types.LineCap.BUTT,
|
|
36
|
+
lineWidth: 1,
|
|
37
|
+
miterLimit: 4
|
|
33
38
|
}, style)
|
|
34
39
|
}, rest)) || this;
|
|
35
40
|
}
|
|
@@ -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
|
}
|