@antv/g 5.0.15 → 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 +8 -9
- package/es/camera/Camera.d.ts +3 -2
- package/es/camera/Camera.js +16 -8
- package/es/canvas-module.js +4 -2
- package/es/components/Transform.d.ts +0 -1
- package/es/components/Transform.js +0 -1
- package/es/display-objects/Circle.d.ts +1 -1
- 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 +77 -50
- package/es/display-objects/Ellipse.d.ts +1 -1
- package/es/display-objects/Ellipse.js +8 -3
- package/es/display-objects/Group.d.ts +18 -2
- package/es/display-objects/Group.js +11 -9
- package/es/display-objects/HTML.d.ts +1 -1
- package/es/display-objects/HTML.js +9 -4
- package/es/display-objects/Image.d.ts +5 -3
- package/es/display-objects/Image.js +8 -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 +1 -1
- package/es/display-objects/Rect.js +8 -3
- package/es/display-objects/Text.d.ts +9 -4
- package/es/display-objects/Text.js +14 -9
- 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 +10 -5
- package/es/dom/Element.js +41 -15
- 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 +1 -0
- package/es/global-module.js +11 -13
- 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 +19 -20
- package/es/property-handlers/color.js +5 -2
- package/es/property-handlers/dimension.d.ts +15 -3
- package/es/property-handlers/dimension.js +50 -9
- 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/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 +0 -7
- package/es/services/SceneGraphService.js +9 -77
- package/es/services/aabb/CircleUpdater.js +3 -3
- package/es/services/aabb/EllipseUpdater.js +2 -2
- 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.js +4 -4
- package/es/services/aabb/TextUpdater.js +19 -10
- package/es/services/text/index.js +19 -21
- package/es/types.d.ts +48 -24
- 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.js +11 -11
- 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 +6 -7
- package/lib/camera/Camera.d.ts +3 -2
- package/lib/camera/Camera.js +20 -10
- package/lib/canvas-module.js +3 -1
- package/lib/components/Transform.d.ts +0 -1
- package/lib/components/Transform.js +0 -1
- package/lib/display-objects/Circle.d.ts +1 -1
- 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 +76 -47
- package/lib/display-objects/Ellipse.d.ts +1 -1
- package/lib/display-objects/Ellipse.js +7 -2
- package/lib/display-objects/Group.d.ts +18 -2
- package/lib/display-objects/Group.js +10 -9
- package/lib/display-objects/HTML.d.ts +1 -1
- package/lib/display-objects/HTML.js +8 -4
- package/lib/display-objects/Image.d.ts +5 -3
- package/lib/display-objects/Image.js +7 -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 +1 -1
- package/lib/display-objects/Rect.js +7 -2
- package/lib/display-objects/Text.d.ts +9 -4
- package/lib/display-objects/Text.js +13 -8
- 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 +10 -5
- package/lib/dom/Element.js +43 -15
- 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 +1 -0
- package/lib/global-module.js +12 -8
- 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 +18 -19
- package/lib/property-handlers/color.js +6 -3
- package/lib/property-handlers/dimension.d.ts +15 -3
- package/lib/property-handlers/dimension.js +50 -8
- 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/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 +0 -7
- package/lib/services/SceneGraphService.js +10 -77
- package/lib/services/aabb/CircleUpdater.js +2 -2
- package/lib/services/aabb/EllipseUpdater.js +1 -1
- 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.js +3 -3
- package/lib/services/aabb/TextUpdater.js +18 -9
- package/lib/services/text/index.js +19 -21
- package/lib/types.d.ts +48 -24
- 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.js +10 -10
- 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 +5 -3
package/lib/types.js
CHANGED
|
@@ -3,41 +3,62 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
(function (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})(
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
exports.
|
|
26
|
-
|
|
27
|
-
(function (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})(
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
exports.
|
|
35
|
-
|
|
36
|
-
(function (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})(
|
|
6
|
+
exports.TextTransform = exports.TextAlign = exports.Shape = exports.LineJoin = exports.LineCap = exports.CanvasConfig = void 0;
|
|
7
|
+
var Shape;
|
|
8
|
+
exports.Shape = Shape;
|
|
9
|
+
|
|
10
|
+
(function (Shape) {
|
|
11
|
+
Shape["GROUP"] = "g";
|
|
12
|
+
Shape["CIRCLE"] = "circle";
|
|
13
|
+
Shape["ELLIPSE"] = "ellipse";
|
|
14
|
+
Shape["IMAGE"] = "image";
|
|
15
|
+
Shape["RECT"] = "rect";
|
|
16
|
+
Shape["LINE"] = "line";
|
|
17
|
+
Shape["POLYLINE"] = "polyline";
|
|
18
|
+
Shape["POLYGON"] = "polygon";
|
|
19
|
+
Shape["TEXT"] = "text";
|
|
20
|
+
Shape["PATH"] = "path";
|
|
21
|
+
Shape["HTML"] = "html";
|
|
22
|
+
})(Shape || (exports.Shape = Shape = {}));
|
|
23
|
+
|
|
24
|
+
var LineCap;
|
|
25
|
+
exports.LineCap = LineCap;
|
|
26
|
+
|
|
27
|
+
(function (LineCap) {
|
|
28
|
+
LineCap["BUTT"] = "butt";
|
|
29
|
+
LineCap["ROUND"] = "round";
|
|
30
|
+
LineCap["SQUARE"] = "square";
|
|
31
|
+
})(LineCap || (exports.LineCap = LineCap = {}));
|
|
32
|
+
|
|
33
|
+
var LineJoin;
|
|
34
|
+
exports.LineJoin = LineJoin;
|
|
35
|
+
|
|
36
|
+
(function (LineJoin) {
|
|
37
|
+
LineJoin["BEVEL"] = "bevel";
|
|
38
|
+
LineJoin["ROUND"] = "round";
|
|
39
|
+
LineJoin["MITER"] = "miter";
|
|
40
|
+
})(LineJoin || (exports.LineJoin = LineJoin = {}));
|
|
41
|
+
|
|
42
|
+
var TextTransform;
|
|
43
|
+
exports.TextTransform = TextTransform;
|
|
44
|
+
|
|
45
|
+
(function (TextTransform) {
|
|
46
|
+
TextTransform["CAPITALIZE"] = "capitalize";
|
|
47
|
+
TextTransform["UPPERCASE"] = "uppercase";
|
|
48
|
+
TextTransform["LOWERCASE"] = "lowercase";
|
|
49
|
+
TextTransform["NONE"] = "none";
|
|
50
|
+
})(TextTransform || (exports.TextTransform = TextTransform = {}));
|
|
51
|
+
|
|
52
|
+
var TextAlign;
|
|
53
|
+
exports.TextAlign = TextAlign;
|
|
54
|
+
|
|
55
|
+
(function (TextAlign) {
|
|
56
|
+
TextAlign["START"] = "start";
|
|
57
|
+
TextAlign["CENTER"] = "center";
|
|
58
|
+
TextAlign["END"] = "end";
|
|
59
|
+
TextAlign["LEFT"] = "left";
|
|
60
|
+
TextAlign["RIGHT"] = "right";
|
|
61
|
+
})(TextAlign || (exports.TextAlign = TextAlign = {}));
|
|
41
62
|
|
|
42
63
|
var CanvasConfig = 'CanvasConfig';
|
|
43
64
|
exports.CanvasConfig = CanvasConfig;
|
|
@@ -14,7 +14,7 @@ var _bezierEasing = require("./bezier-easing");
|
|
|
14
14
|
*/
|
|
15
15
|
var convertToDash = function convertToDash(str) {
|
|
16
16
|
str = str.replace(/([A-Z])/g, function (letter) {
|
|
17
|
-
return "-"
|
|
17
|
+
return "-".concat(letter.toLowerCase());
|
|
18
18
|
}); // Remove first dash
|
|
19
19
|
|
|
20
20
|
return str.charAt(0) === '-' ? str.substr(1) : str;
|
package/lib/utils/event.js
CHANGED
|
@@ -45,9 +45,11 @@ function normalizeToPointerEvent(event) {
|
|
|
45
45
|
|
|
46
46
|
if (isTouchEvent(event)) {
|
|
47
47
|
for (var i = 0; i < event.changedTouches.length; i++) {
|
|
48
|
-
var touch = event.changedTouches[i];
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
var touch = event.changedTouches[i]; // use changedTouches instead of touches since touchend has no touches
|
|
49
|
+
// @see https://stackoverflow.com/a/10079076
|
|
50
|
+
|
|
51
|
+
if ((0, _util.isUndefined)(touch.button)) touch.button = event.changedTouches.length ? 1 : 0;
|
|
52
|
+
if ((0, _util.isUndefined)(touch.buttons)) touch.buttons = event.changedTouches.length ? 1 : 0;
|
|
51
53
|
|
|
52
54
|
if ((0, _util.isUndefined)(touch.isPrimary)) {
|
|
53
55
|
touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -67,4 +67,17 @@ Object.keys(_text).forEach(function (key) {
|
|
|
67
67
|
return _text[key];
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
var _string = require("./string");
|
|
73
|
+
|
|
74
|
+
Object.keys(_string).forEach(function (key) {
|
|
75
|
+
if (key === "default" || key === "__esModule") return;
|
|
76
|
+
if (key in exports && exports[key] === _string[key]) return;
|
|
77
|
+
Object.defineProperty(exports, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function get() {
|
|
80
|
+
return _string[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
70
83
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { AnimationEffectTiming } from '../dom';
|
|
2
2
|
import type { IElement } from '../dom/interfaces';
|
|
3
3
|
export declare function convertEffectInput(keyframes: ComputedKeyframe[], timing: AnimationEffectTiming, target: IElement | null): (target: IElement, fraction: number) => void;
|
|
4
|
+
export declare function formatAttribute(name: string, value: any): [string, any];
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.convertEffectInput = convertEffectInput;
|
|
7
|
+
exports.formatAttribute = formatAttribute;
|
|
7
8
|
|
|
8
9
|
var _tslib = require("tslib");
|
|
9
10
|
|
|
@@ -11,10 +12,8 @@ var _globalModule = require("../global-module");
|
|
|
11
12
|
|
|
12
13
|
var _animation = require("./animation");
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// StylePropertyParserFactory,
|
|
17
|
-
// } from '../property-handlers/interfaces';
|
|
15
|
+
var _string = require("./string");
|
|
16
|
+
|
|
18
17
|
function convertEffectInput(keyframes, timing, target) {
|
|
19
18
|
var propertySpecificKeyframeGroups = makePropertySpecificKeyframeGroups(keyframes, timing);
|
|
20
19
|
var interpolations = makeInterpolations(propertySpecificKeyframeGroups, target);
|
|
@@ -130,9 +129,9 @@ function propertyInterpolation(property, left, right, target) {
|
|
|
130
129
|
|
|
131
130
|
if (parser) {
|
|
132
131
|
// @ts-ignore
|
|
133
|
-
parsedLeft = parser(left, target); // @ts-ignore
|
|
132
|
+
parsedLeft = parser(left, target, property); // @ts-ignore
|
|
134
133
|
|
|
135
|
-
parsedRight = parser(right, target);
|
|
134
|
+
parsedRight = parser(right, target, property);
|
|
136
135
|
} // merger [left, right, n2string()]
|
|
137
136
|
|
|
138
137
|
|
|
@@ -189,4 +188,41 @@ convertToString) {
|
|
|
189
188
|
return function (f) {
|
|
190
189
|
return convertToString(interpolate(from, to, f));
|
|
191
190
|
};
|
|
192
|
-
};
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
var FORMAT_ATTR_MAP = {
|
|
194
|
+
d: {
|
|
195
|
+
alias: 'path'
|
|
196
|
+
},
|
|
197
|
+
cx: {
|
|
198
|
+
alias: 'x'
|
|
199
|
+
},
|
|
200
|
+
cy: {
|
|
201
|
+
alias: 'y'
|
|
202
|
+
},
|
|
203
|
+
strokeDasharray: {
|
|
204
|
+
alias: 'lineDash'
|
|
205
|
+
},
|
|
206
|
+
strokeWidth: {
|
|
207
|
+
alias: 'lineWidth'
|
|
208
|
+
},
|
|
209
|
+
textAnchor: {
|
|
210
|
+
alias: 'textAlign',
|
|
211
|
+
values: {
|
|
212
|
+
middle: 'center'
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
src: {
|
|
216
|
+
alias: 'img'
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
function formatAttribute(name, value) {
|
|
221
|
+
var _a;
|
|
222
|
+
|
|
223
|
+
var attributeName = (0, _string.camelCase)(name);
|
|
224
|
+
var map = FORMAT_ATTR_MAP[attributeName];
|
|
225
|
+
attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
|
|
226
|
+
var attributeValue = ((_a = map === null || map === void 0 ? void 0 : map.values) === null || _a === void 0 ? void 0 : _a[value]) || value;
|
|
227
|
+
return [attributeName, attributeValue];
|
|
228
|
+
}
|
package/lib/utils/path.js
CHANGED
|
@@ -234,7 +234,7 @@ function commandsToPathString(commands, localTransform, anchor, parsedStyle) {
|
|
|
234
234
|
|
|
235
235
|
_glMatrix.vec3.transformMat4(p, p, localTransform);
|
|
236
236
|
|
|
237
|
-
path = ""
|
|
237
|
+
path = "".concat(cur[0]).concat(p[0], ",").concat(p[1]);
|
|
238
238
|
} else if (cur[0] === 'Z') {
|
|
239
239
|
path = cur[0];
|
|
240
240
|
} else if (cur[0] === 'C') {
|
|
@@ -250,13 +250,13 @@ function commandsToPathString(commands, localTransform, anchor, parsedStyle) {
|
|
|
250
250
|
|
|
251
251
|
_glMatrix.vec3.transformMat4(p3, p3, localTransform);
|
|
252
252
|
|
|
253
|
-
path = ""
|
|
253
|
+
path = "".concat(cur[0]).concat(p1[0], ",").concat(p1[1], ",").concat(p2[0], ",").concat(p2[1], ",").concat(p3[0], ",").concat(p3[1]);
|
|
254
254
|
} else if (cur[0] === 'A') {
|
|
255
255
|
var c = _glMatrix.vec3.fromValues(cur[6] - x, cur[7] - y, 0);
|
|
256
256
|
|
|
257
257
|
_glMatrix.vec3.transformMat4(c, c, localTransform);
|
|
258
258
|
|
|
259
|
-
path = ""
|
|
259
|
+
path = "".concat(cur[0]).concat(cur[1], ",").concat(cur[2], ",").concat(cur[3], ",").concat(cur[4], ",").concat(cur[5], ",").concat(c[0], ",").concat(c[1]);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
return prev += path;
|
|
@@ -306,7 +306,7 @@ function convertToPath(object) {
|
|
|
306
306
|
var commands = [];
|
|
307
307
|
|
|
308
308
|
switch (object.nodeName) {
|
|
309
|
-
case _types.
|
|
309
|
+
case _types.Shape.LINE:
|
|
310
310
|
var _a = object.parsedStyle,
|
|
311
311
|
x1 = _a.x1,
|
|
312
312
|
y1 = _a.y1,
|
|
@@ -315,7 +315,7 @@ function convertToPath(object) {
|
|
|
315
315
|
commands = lineToCommands(x1, y1, x2, y2);
|
|
316
316
|
break;
|
|
317
317
|
|
|
318
|
-
case _types.
|
|
318
|
+
case _types.Shape.CIRCLE:
|
|
319
319
|
{
|
|
320
320
|
var _b = object.parsedStyle,
|
|
321
321
|
r = _b.rInPixels,
|
|
@@ -327,7 +327,7 @@ function convertToPath(object) {
|
|
|
327
327
|
break;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
case _types.
|
|
330
|
+
case _types.Shape.ELLIPSE:
|
|
331
331
|
{
|
|
332
332
|
var _e = object.parsedStyle,
|
|
333
333
|
rx = _e.rxInPixels,
|
|
@@ -340,13 +340,13 @@ function convertToPath(object) {
|
|
|
340
340
|
break;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
case _types.
|
|
344
|
-
case _types.
|
|
343
|
+
case _types.Shape.POLYLINE:
|
|
344
|
+
case _types.Shape.POLYGON:
|
|
345
345
|
var points = object.parsedStyle.points;
|
|
346
346
|
commands = polygonToCommands(points.points);
|
|
347
347
|
break;
|
|
348
348
|
|
|
349
|
-
case _types.
|
|
349
|
+
case _types.Shape.RECT:
|
|
350
350
|
var _h = object.parsedStyle,
|
|
351
351
|
width = _h.widthInPixels,
|
|
352
352
|
height = _h.heightInPixels,
|
|
@@ -356,7 +356,7 @@ function convertToPath(object) {
|
|
|
356
356
|
commands = rectToCommands(width, height, x, y, radius);
|
|
357
357
|
break;
|
|
358
358
|
|
|
359
|
-
case _types.
|
|
359
|
+
case _types.Shape.PATH:
|
|
360
360
|
commands = object.parsedStyle.path.curve;
|
|
361
361
|
break;
|
|
362
362
|
}
|
package/lib/utils/raf.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* use user-defined raf instead of requestAnimationFrame
|
|
3
3
|
*/
|
|
4
|
-
export declare function patch(requestAFPatch: (callback:
|
|
4
|
+
export declare function patch(requestAFPatch: (callback: (timestamp: number) => void) => number, cancelAFPatch: (id: number) => void): void;
|
|
5
5
|
export declare const requestAnimationFrame: (callback: Function) => number;
|
|
6
6
|
export declare const cancelAnimationFrame: (id: number) => void;
|
package/lib/utils/raf.js
CHANGED
|
@@ -9,8 +9,6 @@ exports.requestAnimationFrame = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _requestAnimationFramePolyfill = require("request-animation-frame-polyfill");
|
|
11
11
|
|
|
12
|
-
// import { requestAnimationFrame, cancelAnimationFrame } from 'request-animation-frame-polyfill';
|
|
13
|
-
// export { requestAnimationFrame, cancelAnimationFrame };
|
|
14
12
|
var requestAF = _requestAnimationFramePolyfill.requestAnimationFrame;
|
|
15
13
|
var cancelAF = _requestAnimationFramePolyfill.cancelAnimationFrame;
|
|
16
14
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function camelCase(str?: string): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.camelCase = camelCase;
|
|
7
|
+
|
|
8
|
+
function camelCase(str) {
|
|
9
|
+
if (str === void 0) {
|
|
10
|
+
str = '';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return str.replace(/-([a-z])/g, function (g) {
|
|
14
|
+
return g[1].toUpperCase();
|
|
15
|
+
});
|
|
16
|
+
}
|
package/lib/utils/text.js
CHANGED
|
@@ -16,7 +16,7 @@ function toFontString(attributes) {
|
|
|
16
16
|
fontVariant = attributes.fontVariant,
|
|
17
17
|
fontWeight = attributes.fontWeight; // build canvas api font setting from individual components. Convert a numeric this.fontSize to px
|
|
18
18
|
|
|
19
|
-
var fontSizeString = (0, _util.isNumber)(fontSize) ? fontSize
|
|
19
|
+
var fontSizeString = (0, _util.isNumber)(fontSize) ? "".concat(fontSize, "px") : "".concat(fontSize.value).concat(fontSize.unit || 'px'); // Clean-up fontFamily property by quoting each font name
|
|
20
20
|
// this will support font names with spaces
|
|
21
21
|
// @ts-ignore
|
|
22
22
|
|
|
@@ -31,11 +31,11 @@ function toFontString(attributes) {
|
|
|
31
31
|
var fontFamily_1 = fontFamilies[i].trim(); // Check if font already contains strings
|
|
32
32
|
|
|
33
33
|
if (!/([\"\'])[^\'\"]+\1/.test(fontFamily_1) && genericFontFamilies.indexOf(fontFamily_1) < 0) {
|
|
34
|
-
fontFamily_1 = "\""
|
|
34
|
+
fontFamily_1 = "\"".concat(fontFamily_1, "\"");
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
fontFamilies[i] = fontFamily_1;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
return fontStyle
|
|
40
|
+
return "".concat(fontStyle, " ").concat(fontVariant, " ").concat(fontWeight, " ").concat(fontSizeString, " ").concat(fontFamilies.join(','));
|
|
41
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.16",
|
|
4
4
|
"description": "A core module including ECS and DI container.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://github.com/antvis/g#readme",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@antv/g-math": "^1.0.
|
|
40
|
+
"@antv/g-math": "^1.0.13",
|
|
41
41
|
"@antv/path-util": "^2.0.14",
|
|
42
42
|
"@antv/util": "^2.0.13",
|
|
43
43
|
"@types/offscreencanvas": "^2019.6.4",
|
|
@@ -45,12 +45,14 @@
|
|
|
45
45
|
"eventemitter3": "^4.0.0",
|
|
46
46
|
"gl-matrix": "^3.1.0",
|
|
47
47
|
"mana-syringe": "^0.3.0",
|
|
48
|
+
"reflect-metadata": "^0.1.13",
|
|
48
49
|
"request-animation-frame-polyfill": "^1.1.2",
|
|
50
|
+
"setimmediate": "^1.0.5",
|
|
49
51
|
"tapable": "^2.2.1",
|
|
50
52
|
"tslib": "^2.3.1"
|
|
51
53
|
},
|
|
52
54
|
"scripts": {
|
|
53
55
|
"umd": "webpack"
|
|
54
56
|
},
|
|
55
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "0c7b71ca68a0ada7e50c9eeec3c47f9b7de44f01"
|
|
56
58
|
}
|