@antv/g 1.0.0-alpha.20 → 1.0.0-alpha.24
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/Canvas.d.ts +40 -18
- package/es/Canvas.js +121 -65
- package/es/DisplayObjectPool.d.ts +2 -1
- package/es/DisplayObjectPool.js +4 -0
- package/{lib → es/camera}/Camera.d.ts +6 -3
- package/es/{Camera.js → camera/Camera.js} +22 -16
- package/es/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
- package/es/{Landmark.js → camera/Landmark.js} +1 -1
- package/es/camera/index.d.ts +2 -0
- package/es/camera/index.js +2 -0
- package/es/components/Cullable.js +1 -1
- package/es/components/Geometry.d.ts +8 -1
- package/es/components/Renderable.d.ts +9 -8
- package/es/components/Renderable.js +2 -6
- package/es/components/Sortable.d.ts +6 -2
- package/es/display-objects/Circle.d.ts +2 -3
- package/es/display-objects/Circle.js +2 -5
- package/es/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
- package/es/{CustomElement.js → display-objects/CustomElement.js} +22 -12
- package/{lib → es/display-objects}/DisplayObject.d.ts +136 -141
- package/es/{DisplayObject.js → display-objects/DisplayObject.js} +408 -292
- package/es/display-objects/Ellipse.d.ts +2 -3
- package/es/display-objects/Ellipse.js +2 -5
- package/es/display-objects/Group.d.ts +2 -1
- package/es/display-objects/Group.js +13 -5
- package/es/display-objects/HTML.d.ts +2 -2
- package/es/display-objects/HTML.js +4 -7
- package/es/display-objects/Image.d.ts +2 -2
- package/es/display-objects/Image.js +2 -6
- package/es/display-objects/Line.d.ts +2 -2
- package/es/display-objects/Line.js +8 -8
- package/es/display-objects/Path.d.ts +3 -2
- package/es/display-objects/Path.js +8 -8
- package/es/display-objects/Polygon.d.ts +2 -2
- package/es/display-objects/Polygon.js +2 -6
- package/es/display-objects/Polyline.d.ts +2 -2
- package/es/display-objects/Polyline.js +8 -8
- package/es/display-objects/Rect.d.ts +2 -2
- package/es/display-objects/Rect.js +2 -6
- package/es/display-objects/Text.d.ts +2 -3
- package/es/display-objects/Text.js +8 -7
- package/es/display-objects/index.d.ts +2 -0
- package/es/display-objects/index.js +2 -0
- package/es/{Animation.d.ts → dom/Animation.d.ts} +3 -3
- package/es/{Animation.js → dom/Animation.js} +2 -3
- package/{lib → es/dom}/AnimationEffectTiming.d.ts +2 -0
- package/es/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -2
- package/es/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
- package/es/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
- package/es/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
- package/es/{Timeline.js → dom/AnimationTimeline.js} +1 -1
- package/es/dom/CustomElementRegistry.d.ts +15 -0
- package/es/dom/CustomElementRegistry.js +40 -0
- package/{lib → es/dom}/CustomEvent.d.ts +1 -1
- package/es/{CustomEvent.js → dom/CustomEvent.js} +1 -1
- package/es/dom/Document.d.ts +36 -17
- package/es/dom/Document.js +98 -14
- package/es/dom/Element.d.ts +71 -92
- package/es/dom/Element.js +179 -195
- package/es/dom/EventTarget.d.ts +11 -6
- package/es/dom/EventTarget.js +12 -4
- package/es/dom/FederatedEvent.d.ts +15 -7
- package/es/dom/FederatedEvent.js +33 -0
- package/es/dom/FederatedMouseEvent.d.ts +1 -1
- package/es/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
- package/es/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
- package/es/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
- package/es/{KeyframeList.js → dom/KeyframeList.js} +0 -0
- package/es/dom/Node.d.ts +38 -23
- package/es/dom/Node.js +37 -33
- package/es/dom/index.d.ts +15 -2
- package/es/dom/index.js +16 -3
- package/es/dom/interfaces.d.ts +301 -0
- package/es/dom/interfaces.js +1 -0
- package/es/global-module.d.ts +0 -2
- package/es/global-module.js +31 -29
- package/es/index.d.ts +7 -14
- package/es/index.js +8 -15
- package/es/plugins/CullingPlugin.d.ts +2 -2
- package/es/plugins/CullingPlugin.js +13 -16
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/es/plugins/DirtyCheckPlugin.js +8 -7
- package/es/plugins/EventPlugin.js +52 -31
- package/es/plugins/FrustumCullingStrategy.d.ts +1 -1
- package/es/plugins/FrustumCullingStrategy.js +5 -4
- package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/es/plugins/PrepareRendererPlugin.js +42 -38
- package/es/property-handlers/aabb.d.ts +2 -3
- package/es/property-handlers/aabb.js +29 -21
- package/es/property-handlers/anchor.d.ts +3 -0
- package/es/property-handlers/anchor.js +21 -0
- package/es/property-handlers/clipPath.d.ts +1 -1
- package/es/property-handlers/clipPath.js +3 -4
- package/es/property-handlers/color.d.ts +1 -1
- package/es/property-handlers/dimension.d.ts +1 -1
- package/es/property-handlers/dimension.js +6 -9
- package/es/property-handlers/filter.d.ts +1 -1
- package/es/property-handlers/index.d.ts +5 -4
- package/es/property-handlers/index.js +1 -0
- package/es/property-handlers/localPosition.d.ts +1 -1
- package/es/property-handlers/localPosition.js +1 -6
- package/es/property-handlers/offsetDistance.d.ts +1 -1
- package/es/property-handlers/offsetPath.d.ts +1 -1
- package/es/property-handlers/origin.d.ts +1 -1
- package/es/property-handlers/origin.js +9 -2
- package/es/property-handlers/path.d.ts +2 -2
- package/es/property-handlers/path.js +8 -4
- package/es/property-handlers/points.d.ts +1 -1
- package/es/property-handlers/transform.d.ts +1 -1
- package/es/property-handlers/zIndex.d.ts +1 -1
- package/es/services/ContextService.d.ts +3 -2
- package/es/services/EventService.d.ts +18 -13
- package/es/services/EventService.js +604 -384
- package/es/services/RenderingContext.d.ts +1 -1
- package/es/services/RenderingService.d.ts +23 -29
- package/es/services/RenderingService.js +63 -54
- package/es/services/SceneGraphSelector.d.ts +7 -7
- package/es/services/SceneGraphSelector.js +10 -6
- package/es/services/SceneGraphService.d.ts +73 -78
- package/es/services/SceneGraphService.js +165 -78
- package/es/services/aabb/PathUpdater.d.ts +1 -1
- package/es/services/aabb/RectUpdater.d.ts +2 -2
- package/es/services/aabb/interfaces.d.ts +1 -1
- package/es/shapes/Point.d.ts +4 -0
- package/es/shapes/Polygon.d.ts +9 -0
- package/es/shapes/Polygon.js +62 -0
- package/es/shapes/index.d.ts +1 -0
- package/es/shapes/index.js +2 -1
- package/es/types.d.ts +18 -6
- package/es/utils/animation.d.ts +1 -2
- package/es/utils/animation.js +5 -10
- package/es/utils/canvas.d.ts +1 -1
- package/es/utils/custom-easing.d.ts +3 -2
- package/es/utils/custom-easing.js +12 -6
- package/es/utils/event.js +1 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/interpolation.d.ts +3 -4
- package/es/utils/interpolation.js +0 -16
- package/es/utils/path.d.ts +2 -2
- package/lib/Canvas.d.ts +40 -18
- package/lib/Canvas.js +131 -74
- package/lib/DisplayObjectPool.d.ts +2 -1
- package/lib/DisplayObjectPool.js +4 -0
- package/{es → lib/camera}/Camera.d.ts +6 -3
- package/lib/{Camera.js → camera/Camera.js} +25 -20
- package/lib/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
- package/lib/{Landmark.js → camera/Landmark.js} +2 -3
- package/lib/camera/index.d.ts +2 -0
- package/lib/camera/index.js +31 -0
- package/lib/components/Cullable.js +1 -1
- package/lib/components/Geometry.d.ts +8 -1
- package/lib/components/Renderable.d.ts +9 -8
- package/lib/components/Renderable.js +2 -6
- package/lib/components/Sortable.d.ts +6 -2
- package/lib/display-objects/Circle.d.ts +2 -3
- package/lib/display-objects/Circle.js +3 -6
- package/lib/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
- package/lib/{CustomElement.js → display-objects/CustomElement.js} +22 -12
- package/{es → lib/display-objects}/DisplayObject.d.ts +136 -141
- package/lib/{DisplayObject.js → display-objects/DisplayObject.js} +418 -299
- package/lib/display-objects/Ellipse.d.ts +2 -3
- package/lib/display-objects/Ellipse.js +3 -6
- package/lib/display-objects/Group.d.ts +2 -1
- package/lib/display-objects/Group.js +12 -4
- package/lib/display-objects/HTML.d.ts +2 -2
- package/lib/display-objects/HTML.js +4 -7
- package/lib/display-objects/Image.d.ts +2 -2
- package/lib/display-objects/Image.js +2 -6
- package/lib/display-objects/Line.d.ts +2 -2
- package/lib/display-objects/Line.js +8 -8
- package/lib/display-objects/Path.d.ts +3 -2
- package/lib/display-objects/Path.js +8 -8
- package/lib/display-objects/Polygon.d.ts +2 -2
- package/lib/display-objects/Polygon.js +2 -6
- package/lib/display-objects/Polyline.d.ts +2 -2
- package/lib/display-objects/Polyline.js +8 -8
- package/lib/display-objects/Rect.d.ts +2 -2
- package/lib/display-objects/Rect.js +2 -6
- package/lib/display-objects/Text.d.ts +2 -3
- package/lib/display-objects/Text.js +9 -8
- package/lib/display-objects/index.d.ts +2 -0
- package/lib/display-objects/index.js +26 -0
- package/lib/{Animation.d.ts → dom/Animation.d.ts} +3 -3
- package/lib/{Animation.js → dom/Animation.js} +2 -3
- package/{es → lib/dom}/AnimationEffectTiming.d.ts +2 -0
- package/lib/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -3
- package/lib/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
- package/lib/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
- package/lib/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
- package/lib/{Timeline.js → dom/AnimationTimeline.js} +1 -1
- package/lib/dom/CustomElementRegistry.d.ts +15 -0
- package/lib/dom/CustomElementRegistry.js +48 -0
- package/{es → lib/dom}/CustomEvent.d.ts +1 -1
- package/lib/{CustomEvent.js → dom/CustomEvent.js} +1 -1
- package/lib/dom/Document.d.ts +36 -17
- package/lib/dom/Document.js +99 -15
- package/lib/dom/Element.d.ts +71 -92
- package/lib/dom/Element.js +180 -198
- package/lib/dom/EventTarget.d.ts +11 -6
- package/lib/dom/EventTarget.js +20 -10
- package/lib/dom/FederatedEvent.d.ts +15 -7
- package/lib/dom/FederatedEvent.js +33 -0
- package/lib/dom/FederatedMouseEvent.d.ts +1 -1
- package/lib/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
- package/lib/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
- package/lib/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
- package/lib/{KeyframeList.js → dom/KeyframeList.js} +0 -0
- package/lib/dom/Node.d.ts +38 -23
- package/lib/dom/Node.js +37 -33
- package/lib/dom/index.d.ts +15 -2
- package/lib/dom/index.js +177 -8
- package/lib/dom/interfaces.d.ts +301 -0
- package/lib/dom/interfaces.js +5 -0
- package/lib/global-module.d.ts +0 -2
- package/lib/global-module.js +30 -30
- package/lib/index.d.ts +7 -14
- package/lib/index.js +44 -135
- package/lib/plugins/CullingPlugin.d.ts +2 -2
- package/lib/plugins/CullingPlugin.js +14 -16
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/lib/plugins/DirtyCheckPlugin.js +9 -7
- package/lib/plugins/EventPlugin.js +52 -30
- package/lib/plugins/FrustumCullingStrategy.d.ts +1 -1
- package/lib/plugins/FrustumCullingStrategy.js +5 -4
- package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/lib/plugins/PrepareRendererPlugin.js +41 -37
- package/lib/property-handlers/aabb.d.ts +2 -3
- package/lib/property-handlers/aabb.js +28 -22
- package/lib/property-handlers/anchor.d.ts +3 -0
- package/lib/property-handlers/anchor.js +34 -0
- package/lib/property-handlers/clipPath.d.ts +1 -1
- package/lib/property-handlers/clipPath.js +3 -4
- package/lib/property-handlers/color.d.ts +1 -1
- package/lib/property-handlers/dimension.d.ts +1 -1
- package/lib/property-handlers/dimension.js +6 -9
- package/lib/property-handlers/filter.d.ts +1 -1
- package/lib/property-handlers/index.d.ts +5 -4
- package/lib/property-handlers/index.js +14 -0
- package/lib/property-handlers/localPosition.d.ts +1 -1
- package/lib/property-handlers/localPosition.js +1 -7
- package/lib/property-handlers/offsetDistance.d.ts +1 -1
- package/lib/property-handlers/offsetPath.d.ts +1 -1
- package/lib/property-handlers/origin.d.ts +1 -1
- package/lib/property-handlers/origin.js +10 -2
- package/lib/property-handlers/path.d.ts +2 -2
- package/lib/property-handlers/path.js +8 -4
- package/lib/property-handlers/points.d.ts +1 -1
- package/lib/property-handlers/transform.d.ts +1 -1
- package/lib/property-handlers/zIndex.d.ts +1 -1
- package/lib/services/ContextService.d.ts +3 -2
- package/lib/services/EventService.d.ts +18 -13
- package/lib/services/EventService.js +616 -385
- package/lib/services/RenderingContext.d.ts +1 -1
- package/lib/services/RenderingService.d.ts +23 -29
- package/lib/services/RenderingService.js +66 -56
- package/lib/services/SceneGraphSelector.d.ts +7 -7
- package/lib/services/SceneGraphSelector.js +10 -6
- package/lib/services/SceneGraphService.d.ts +73 -78
- package/lib/services/SceneGraphService.js +166 -79
- package/lib/services/aabb/PathUpdater.d.ts +1 -1
- package/lib/services/aabb/RectUpdater.d.ts +2 -2
- package/lib/services/aabb/interfaces.d.ts +1 -1
- package/lib/shapes/Point.d.ts +4 -0
- package/lib/shapes/Polygon.d.ts +9 -0
- package/lib/shapes/Polygon.js +69 -0
- package/lib/shapes/index.d.ts +1 -0
- package/lib/shapes/index.js +13 -0
- package/lib/types.d.ts +18 -6
- package/lib/utils/animation.d.ts +1 -2
- package/lib/utils/animation.js +8 -16
- package/lib/utils/canvas.d.ts +1 -1
- package/lib/utils/custom-easing.d.ts +3 -2
- package/lib/utils/custom-easing.js +16 -8
- package/lib/utils/event.js +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/interpolation.d.ts +3 -4
- package/lib/utils/interpolation.js +0 -17
- package/lib/utils/path.d.ts +2 -2
- package/package.json +6 -6
- package/es/Batch.d.ts +0 -25
- package/es/Batch.js +0 -82
- package/es/shapes-type.d.ts +0 -175
- package/es/shapes-type.js +0 -18
- package/es/utils/matrix-decompose.d.ts +0 -3
- package/es/utils/matrix-decompose.js +0 -404
- package/lib/Batch.d.ts +0 -25
- package/lib/Batch.js +0 -91
- package/lib/shapes-type.d.ts +0 -175
- package/lib/shapes-type.js +0 -41
- package/lib/utils/matrix-decompose.d.ts +0 -3
- package/lib/utils/matrix-decompose.js +0 -414
|
@@ -2,7 +2,8 @@ import { __decorate, __metadata, __values } from "tslib";
|
|
|
2
2
|
import { inject, injectable } from 'inversify';
|
|
3
3
|
import { FederatedPointerEvent } from '../dom/FederatedPointerEvent';
|
|
4
4
|
import { FederatedWheelEvent } from '../dom/FederatedWheelEvent';
|
|
5
|
-
import { ContextService, RenderingService, EventService } from '../services';
|
|
5
|
+
import { ContextService, RenderingService, EventService, RenderingServiceEvent } from '../services';
|
|
6
|
+
import { Point } from '../shapes';
|
|
6
7
|
import { CanvasConfig } from '../types';
|
|
7
8
|
import { normalizeToPointerEvent, supportsTouchEvents, TOUCH_TO_POINTER } from '../utils/event';
|
|
8
9
|
/**
|
|
@@ -50,25 +51,27 @@ var EventPlugin = function () {
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
EventPlugin_1 = EventPlugin;
|
|
54
|
-
|
|
55
54
|
EventPlugin.prototype.apply = function (renderingService) {
|
|
56
55
|
var _this = this;
|
|
57
56
|
|
|
58
57
|
this.eventService.setPickHandler(function (position) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
return new Promise(function (resolve, reject) {
|
|
59
|
+
var result = {
|
|
60
|
+
position: position,
|
|
61
|
+
picked: null
|
|
62
|
+
};
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
_this.renderingService.emitter.emit(RenderingServiceEvent.Picking, result, function () {
|
|
65
|
+
resolve(result.picked);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
65
68
|
});
|
|
66
|
-
renderingService.
|
|
69
|
+
renderingService.emitter.on(RenderingServiceEvent.PointerWheel, function (nativeEvent) {
|
|
67
70
|
var wheelEvent = _this.normalizeWheelEvent(nativeEvent);
|
|
68
71
|
|
|
69
72
|
_this.eventService.mapEvent(wheelEvent);
|
|
70
73
|
});
|
|
71
|
-
renderingService.
|
|
74
|
+
renderingService.emitter.on(RenderingServiceEvent.PointerDown, function (nativeEvent) {
|
|
72
75
|
var e_2, _a;
|
|
73
76
|
|
|
74
77
|
if (supportsTouchEvents && nativeEvent.pointerType === 'touch') {
|
|
@@ -107,7 +110,7 @@ var EventPlugin = function () {
|
|
|
107
110
|
|
|
108
111
|
_this.setCursor(_this.eventService.cursor);
|
|
109
112
|
});
|
|
110
|
-
renderingService.
|
|
113
|
+
renderingService.emitter.on(RenderingServiceEvent.PointerUp, function (nativeEvent) {
|
|
111
114
|
var e_3, _a;
|
|
112
115
|
|
|
113
116
|
if (supportsTouchEvents && nativeEvent.pointerType === 'touch') return; // account for element in SVG
|
|
@@ -142,9 +145,9 @@ var EventPlugin = function () {
|
|
|
142
145
|
|
|
143
146
|
_this.setCursor(_this.eventService.cursor);
|
|
144
147
|
});
|
|
145
|
-
renderingService.
|
|
146
|
-
renderingService.
|
|
147
|
-
renderingService.
|
|
148
|
+
renderingService.emitter.on(RenderingServiceEvent.PointerMove, this.onPointerMove);
|
|
149
|
+
renderingService.emitter.on(RenderingServiceEvent.PointerOver, this.onPointerMove);
|
|
150
|
+
renderingService.emitter.on(RenderingServiceEvent.PointerOut, this.onPointerMove);
|
|
148
151
|
};
|
|
149
152
|
|
|
150
153
|
EventPlugin.prototype.bootstrapEvent = function (event, nativeEvent) {
|
|
@@ -161,15 +164,23 @@ var EventPlugin = function () {
|
|
|
161
164
|
event.tiltX = nativeEvent.tiltX;
|
|
162
165
|
event.tiltY = nativeEvent.tiltY;
|
|
163
166
|
event.twist = nativeEvent.twist;
|
|
164
|
-
this.transferMouseData(event, nativeEvent);
|
|
167
|
+
this.transferMouseData(event, nativeEvent);
|
|
168
|
+
|
|
169
|
+
var _a = this.eventService.client2Viewport(new Point(nativeEvent.clientX, nativeEvent.clientY)),
|
|
170
|
+
x = _a.x,
|
|
171
|
+
y = _a.y;
|
|
172
|
+
|
|
173
|
+
event.viewport.x = x;
|
|
174
|
+
event.viewport.y = y;
|
|
165
175
|
|
|
166
|
-
var
|
|
176
|
+
var _b = this.eventService.viewport2Canvas(event.viewport),
|
|
177
|
+
canvasX = _b.x,
|
|
178
|
+
canvasY = _b.y;
|
|
167
179
|
|
|
168
|
-
event.canvas.x =
|
|
169
|
-
event.canvas.y =
|
|
170
|
-
event.
|
|
171
|
-
event.
|
|
172
|
-
event.offset.copyFrom(event.screen);
|
|
180
|
+
event.canvas.x = canvasX;
|
|
181
|
+
event.canvas.y = canvasY;
|
|
182
|
+
event.global.copyFrom(event.canvas);
|
|
183
|
+
event.offset.copyFrom(event.canvas);
|
|
173
184
|
event.isTrusted = nativeEvent.isTrusted;
|
|
174
185
|
|
|
175
186
|
if (event.type === 'pointerleave') {
|
|
@@ -193,14 +204,23 @@ var EventPlugin = function () {
|
|
|
193
204
|
event.deltaMode = nativeEvent.deltaMode;
|
|
194
205
|
event.deltaX = nativeEvent.deltaX;
|
|
195
206
|
event.deltaY = nativeEvent.deltaY;
|
|
196
|
-
event.deltaZ = nativeEvent.deltaZ;
|
|
197
|
-
|
|
198
|
-
var
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
event.
|
|
203
|
-
event.
|
|
207
|
+
event.deltaZ = nativeEvent.deltaZ;
|
|
208
|
+
|
|
209
|
+
var _a = this.eventService.client2Viewport(new Point(nativeEvent.clientX, nativeEvent.clientY)),
|
|
210
|
+
x = _a.x,
|
|
211
|
+
y = _a.y;
|
|
212
|
+
|
|
213
|
+
event.viewport.x = x;
|
|
214
|
+
event.viewport.y = y;
|
|
215
|
+
|
|
216
|
+
var _b = this.eventService.viewport2Canvas(event.viewport),
|
|
217
|
+
canvasX = _b.x,
|
|
218
|
+
canvasY = _b.y;
|
|
219
|
+
|
|
220
|
+
event.canvas.x = canvasX;
|
|
221
|
+
event.canvas.y = canvasY;
|
|
222
|
+
event.global.copyFrom(event.canvas);
|
|
223
|
+
event.offset.copyFrom(event.canvas);
|
|
204
224
|
event.nativeEvent = nativeEvent;
|
|
205
225
|
event.type = nativeEvent.type;
|
|
206
226
|
return event;
|
|
@@ -225,6 +245,8 @@ var EventPlugin = function () {
|
|
|
225
245
|
event.movement.y = nativeEvent.movementY;
|
|
226
246
|
event.page.x = nativeEvent.pageX;
|
|
227
247
|
event.page.y = nativeEvent.pageY;
|
|
248
|
+
event.screen.x = nativeEvent.screenX;
|
|
249
|
+
event.screen.y = nativeEvent.screenY;
|
|
228
250
|
event.relatedTarget = null;
|
|
229
251
|
};
|
|
230
252
|
|
|
@@ -232,7 +254,6 @@ var EventPlugin = function () {
|
|
|
232
254
|
this.contextService.applyCursorStyle(cursor || this.canvasConfig.cursor || 'default');
|
|
233
255
|
};
|
|
234
256
|
|
|
235
|
-
var EventPlugin_1;
|
|
236
257
|
EventPlugin.tag = 'EventPlugin';
|
|
237
258
|
|
|
238
259
|
__decorate([inject(CanvasConfig), __metadata("design:type", Object)], EventPlugin.prototype, "canvasConfig", void 0);
|
|
@@ -243,7 +264,7 @@ var EventPlugin = function () {
|
|
|
243
264
|
|
|
244
265
|
__decorate([inject(EventService), __metadata("design:type", EventService)], EventPlugin.prototype, "eventService", void 0);
|
|
245
266
|
|
|
246
|
-
EventPlugin =
|
|
267
|
+
EventPlugin = __decorate([injectable()], EventPlugin);
|
|
247
268
|
return EventPlugin;
|
|
248
269
|
}();
|
|
249
270
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CullingStrategy } from './CullingPlugin';
|
|
2
|
-
import { DisplayObject } from '../DisplayObject';
|
|
2
|
+
import { DisplayObject } from '../display-objects/DisplayObject';
|
|
3
3
|
export declare class FrustumCullingStrategy implements CullingStrategy {
|
|
4
4
|
private camera;
|
|
5
5
|
isVisible(object: DisplayObject): boolean;
|
|
@@ -3,7 +3,7 @@ import { mat4, vec3 } from 'gl-matrix';
|
|
|
3
3
|
import { inject, injectable } from 'inversify';
|
|
4
4
|
import { Cullable } from '../components';
|
|
5
5
|
import { Mask } from '../shapes';
|
|
6
|
-
import { DefaultCamera, Camera } from '../Camera';
|
|
6
|
+
import { DefaultCamera, Camera } from '../camera/Camera';
|
|
7
7
|
|
|
8
8
|
var FrustumCullingStrategy = function () {
|
|
9
9
|
function FrustumCullingStrategy() {}
|
|
@@ -13,14 +13,15 @@ var FrustumCullingStrategy = function () {
|
|
|
13
13
|
|
|
14
14
|
var entity = object.getEntity();
|
|
15
15
|
var cullable = entity.getComponent(Cullable);
|
|
16
|
+
return true;
|
|
16
17
|
|
|
17
18
|
if (!cullable.enable) {
|
|
18
19
|
return true;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
var
|
|
22
|
+
var renderBounds = object.getRenderBounds();
|
|
22
23
|
|
|
23
|
-
if (!
|
|
24
|
+
if (!renderBounds) {
|
|
24
25
|
return false;
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -29,7 +30,7 @@ var FrustumCullingStrategy = function () {
|
|
|
29
30
|
|
|
30
31
|
this.camera.getFrustum().extractFromVPMatrix(vpMatrix);
|
|
31
32
|
var parentVisibilityPlaneMask = (_b = (_a = object.parentNode) === null || _a === void 0 ? void 0 : _a.getEntity().getComponent(Cullable)) === null || _b === void 0 ? void 0 : _b.visibilityPlaneMask;
|
|
32
|
-
cullable.visibilityPlaneMask = this.computeVisibilityWithPlaneMask(
|
|
33
|
+
cullable.visibilityPlaneMask = this.computeVisibilityWithPlaneMask(renderBounds, parentVisibilityPlaneMask || Mask.INDETERMINATE, this.camera.getFrustum().planes);
|
|
33
34
|
cullable.visible = cullable.visibilityPlaneMask !== Mask.OUTSIDE;
|
|
34
35
|
return cullable.visible;
|
|
35
36
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RenderingService, RenderingPlugin } from '../services/RenderingService';
|
|
2
2
|
export declare class PrepareRendererPlugin implements RenderingPlugin {
|
|
3
3
|
static tag: string;
|
|
4
|
-
private sceneGraphService;
|
|
5
4
|
private renderingContext;
|
|
6
5
|
apply(renderingService: RenderingService): void;
|
|
7
6
|
}
|
|
@@ -1,69 +1,73 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { inject, injectable } from 'inversify';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { SceneGraphService, SCENE_GRAPH_EVENT } from '../services/SceneGraphService';
|
|
3
|
+
import { ElementEvent } from '../dom';
|
|
4
|
+
import { dirtifyRenderable, RenderingContext, RENDER_REASON } from '../services';
|
|
5
|
+
import { RenderingServiceEvent } from '../services/RenderingService';
|
|
7
6
|
|
|
8
7
|
var PrepareRendererPlugin = function () {
|
|
9
8
|
function PrepareRendererPlugin() {}
|
|
10
9
|
|
|
11
|
-
PrepareRendererPlugin_1 = PrepareRendererPlugin;
|
|
12
|
-
|
|
13
10
|
PrepareRendererPlugin.prototype.apply = function (renderingService) {
|
|
14
11
|
var _this = this;
|
|
15
12
|
|
|
16
|
-
var handleAttributeChanged = function handleAttributeChanged(
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
var handleAttributeChanged = function handleAttributeChanged(e) {
|
|
14
|
+
_this.renderingContext.renderReasons.add(RENDER_REASON.DisplayObjectChanged);
|
|
15
|
+
};
|
|
19
16
|
|
|
17
|
+
var dirtifyToRoot = function dirtifyToRoot(e) {
|
|
18
|
+
dirtifyRenderable(e.target, true);
|
|
19
|
+
renderingService.dirtify();
|
|
20
|
+
};
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
var handleBoundsChanged = function handleBoundsChanged(e) {
|
|
23
|
+
// const path = e.composedPath().slice(0, -2);
|
|
24
|
+
// path.forEach((node: DisplayObject) => {
|
|
25
|
+
// const parent = node.parentElement as DisplayObject;
|
|
26
|
+
// if (parent && parent.style && parent.style.transformOrigin) {
|
|
27
|
+
// updateTransformOrigin(
|
|
28
|
+
// parent.style.transformOrigin,
|
|
29
|
+
// parent.style.transformOrigin,
|
|
30
|
+
// parent,
|
|
31
|
+
// true,
|
|
32
|
+
// );
|
|
33
|
+
// }
|
|
34
|
+
// });
|
|
35
|
+
renderingService.dirtify();
|
|
22
36
|
};
|
|
23
37
|
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
_this.renderingContext.renderReasons.add(RENDER_REASON.DisplayObjectChanged);
|
|
38
|
+
var handleMounted = function handleMounted(e) {
|
|
39
|
+
dirtifyToRoot(e);
|
|
27
40
|
};
|
|
28
41
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
renderingService.hooks.destroy.tap(PrepareRendererPlugin_1.tag, function () {
|
|
33
|
-
_this.sceneGraphService.off(SCENE_GRAPH_EVENT.AABBChanged, handleAABBChanged);
|
|
34
|
-
});
|
|
35
|
-
renderingService.hooks.mounted.tap(PrepareRendererPlugin_1.tag, function (object) {
|
|
36
|
-
var entity = object.getEntity(); // delegate attribute-changed handler
|
|
42
|
+
var handleUnmounted = function handleUnmounted(e) {
|
|
43
|
+
dirtifyToRoot(e);
|
|
44
|
+
};
|
|
37
45
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
renderable.dirty = true; // need re-render
|
|
46
|
+
renderingService.emitter.on(RenderingServiceEvent.Init, function () {
|
|
47
|
+
_this.renderingContext.root.addEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
41
48
|
|
|
42
|
-
_this.renderingContext.
|
|
49
|
+
_this.renderingContext.root.addEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
|
|
50
|
+
|
|
51
|
+
_this.renderingContext.root.addEventListener(ElementEvent.ATTRIBUTE_CHANGED, handleAttributeChanged);
|
|
52
|
+
|
|
53
|
+
_this.renderingContext.root.addEventListener(ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
43
54
|
});
|
|
44
|
-
renderingService.
|
|
45
|
-
|
|
46
|
-
object.off(DISPLAY_OBJECT_EVENT.AttributeChanged, handleAttributeChanged);
|
|
47
|
-
var entity = object.getEntity();
|
|
48
|
-
var renderable = entity.getComponent(Renderable);
|
|
55
|
+
renderingService.emitter.on(RenderingServiceEvent.Destroy, function () {
|
|
56
|
+
_this.renderingContext.root.removeEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
49
57
|
|
|
50
|
-
|
|
51
|
-
_this.renderingContext.removedAABBs.push(renderable.aabb);
|
|
52
|
-
} // need re-render
|
|
58
|
+
_this.renderingContext.root.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
|
|
53
59
|
|
|
60
|
+
_this.renderingContext.root.removeEventListener(ElementEvent.ATTRIBUTE_CHANGED, handleAttributeChanged);
|
|
54
61
|
|
|
55
|
-
_this.renderingContext.
|
|
62
|
+
_this.renderingContext.root.removeEventListener(ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
56
63
|
});
|
|
57
64
|
};
|
|
58
65
|
|
|
59
|
-
var PrepareRendererPlugin_1;
|
|
60
66
|
PrepareRendererPlugin.tag = 'PrepareRendererPlugin';
|
|
61
67
|
|
|
62
|
-
__decorate([inject(SceneGraphService), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "sceneGraphService", void 0);
|
|
63
|
-
|
|
64
68
|
__decorate([inject(RenderingContext), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
|
|
65
69
|
|
|
66
|
-
PrepareRendererPlugin =
|
|
70
|
+
PrepareRendererPlugin = __decorate([injectable()], PrepareRendererPlugin);
|
|
67
71
|
return PrepareRendererPlugin;
|
|
68
72
|
}();
|
|
69
73
|
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { DisplayObject } from '../DisplayObject';
|
|
2
|
-
|
|
3
|
-
export declare function updateGeometry(oldValue: number, newValue: number, object: DisplayObject, sceneGraphService: SceneGraphService): void;
|
|
1
|
+
import type { DisplayObject } from '../display-objects/DisplayObject';
|
|
2
|
+
export declare function updateGeometry(oldValue: number, newValue: number, object: DisplayObject): void;
|
|
@@ -2,18 +2,22 @@ import { vec3 } from 'gl-matrix';
|
|
|
2
2
|
import { Geometry } from '../components';
|
|
3
3
|
import { AABB } from '../shapes';
|
|
4
4
|
import { container } from '../inversify.config';
|
|
5
|
-
import { GeometryUpdaterFactory } from '../services';
|
|
5
|
+
import { dirtifyRenderable, GeometryUpdaterFactory } from '../services';
|
|
6
6
|
import { SHAPE } from '../types';
|
|
7
7
|
import { PARSED_COLOR_TYPE } from './color';
|
|
8
|
-
export function updateGeometry(oldValue, newValue, object
|
|
8
|
+
export function updateGeometry(oldValue, newValue, object) {
|
|
9
9
|
var geometryUpdaterFactory = container.get(GeometryUpdaterFactory);
|
|
10
10
|
var geometryUpdater = geometryUpdaterFactory(object.nodeName);
|
|
11
11
|
|
|
12
12
|
if (geometryUpdater) {
|
|
13
|
-
var geometry_1 = object.
|
|
13
|
+
var geometry_1 = object.entity.getComponent(Geometry);
|
|
14
14
|
|
|
15
|
-
if (!geometry_1.
|
|
16
|
-
geometry_1.
|
|
15
|
+
if (!geometry_1.contentBounds) {
|
|
16
|
+
geometry_1.contentBounds = new AABB();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (!geometry_1.renderBounds) {
|
|
20
|
+
geometry_1.renderBounds = new AABB();
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
var _a = geometryUpdater.update(object.parsedStyle, object),
|
|
@@ -55,26 +59,31 @@ export function updateGeometry(oldValue, newValue, object, sceneGraphService) {
|
|
|
55
59
|
var _h = object.parsedStyle,
|
|
56
60
|
_j = _h.lineWidth,
|
|
57
61
|
lineWidth = _j === void 0 ? 0 : _j,
|
|
58
|
-
_k = _h.
|
|
59
|
-
|
|
62
|
+
_k = _h.padding,
|
|
63
|
+
padding = _k === void 0 ? [] : _k,
|
|
60
64
|
_l = _h.anchor,
|
|
61
|
-
anchor = _l === void 0 ? [0
|
|
65
|
+
anchor = _l === void 0 ? [0, 0] : _l,
|
|
62
66
|
shadowColor = _h.shadowColor,
|
|
63
67
|
_m = _h.filter,
|
|
64
|
-
filter = _m === void 0 ? [] : _m;
|
|
65
|
-
var center = vec3.fromValues((1 - anchor[0] * 2) * halfExtents[0] + offsetX, (1 - anchor[1] * 2) * halfExtents[1] + offsetY, (1 - (anchor[2] || 0) * 2) * halfExtents[2] + offsetZ); // <Text> use textAlign & textBaseline instead of anchor
|
|
68
|
+
filter = _m === void 0 ? [] : _m; // <Text> use textAlign & textBaseline instead of anchor
|
|
66
69
|
|
|
67
70
|
if (object.nodeName === SHAPE.Text) {
|
|
68
71
|
delete object.parsedStyle.anchor;
|
|
69
|
-
}
|
|
72
|
+
}
|
|
70
73
|
|
|
74
|
+
var center = vec3.fromValues((1 - anchor[0] * 2) * halfExtents[0] + offsetX, (1 - anchor[1] * 2) * halfExtents[1] + offsetY, (1 - (anchor[2] || 0) * 2) * halfExtents[2] + offsetZ); // update geometry's AABB
|
|
71
75
|
|
|
72
|
-
|
|
76
|
+
geometry_1.contentBounds.update(center, halfExtents);
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
if (lineWidth) {
|
|
79
|
+
// append border
|
|
80
|
+
vec3.add(halfExtents, halfExtents, vec3.fromValues(lineWidth / 2, lineWidth / 2, 0));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
geometry_1.renderBounds.update(center, halfExtents); // account for shadow, only support constant value now
|
|
75
84
|
|
|
76
85
|
if (shadowColor && shadowColor.type === PARSED_COLOR_TYPE.Constant) {
|
|
77
|
-
var _o = geometry_1.
|
|
86
|
+
var _o = geometry_1.renderBounds,
|
|
78
87
|
min = _o.min,
|
|
79
88
|
max = _o.max;
|
|
80
89
|
var _p = object.parsedStyle,
|
|
@@ -92,7 +101,7 @@ export function updateGeometry(oldValue, newValue, object, sceneGraphService) {
|
|
|
92
101
|
max[0] = Math.max(max[0], shadowRight);
|
|
93
102
|
min[1] = Math.min(min[1], shadowTop);
|
|
94
103
|
max[1] = Math.max(max[1], shadowBottom);
|
|
95
|
-
geometry_1.
|
|
104
|
+
geometry_1.renderBounds.setMinMax(min, max);
|
|
96
105
|
} // account for filter, eg. blur(5px), drop-shadow()
|
|
97
106
|
|
|
98
107
|
|
|
@@ -102,12 +111,12 @@ export function updateGeometry(oldValue, newValue, object, sceneGraphService) {
|
|
|
102
111
|
|
|
103
112
|
if (name === 'blur') {
|
|
104
113
|
var blurRadius = params[0].value;
|
|
105
|
-
geometry_1.
|
|
114
|
+
geometry_1.renderBounds.update(geometry_1.renderBounds.center, vec3.add(geometry_1.renderBounds.halfExtents, geometry_1.renderBounds.halfExtents, vec3.fromValues(blurRadius, blurRadius, 0)));
|
|
106
115
|
} else if (name === 'drop-shadow') {
|
|
107
116
|
var shadowOffsetX = params[0].value;
|
|
108
117
|
var shadowOffsetY = params[1].value;
|
|
109
118
|
var shadowBlur = params[2].value;
|
|
110
|
-
var _b = geometry_1.
|
|
119
|
+
var _b = geometry_1.renderBounds,
|
|
111
120
|
min = _b.min,
|
|
112
121
|
max = _b.max;
|
|
113
122
|
var shadowLeft = min[0] - shadowBlur + shadowOffsetX;
|
|
@@ -118,10 +127,9 @@ export function updateGeometry(oldValue, newValue, object, sceneGraphService) {
|
|
|
118
127
|
max[0] = Math.max(max[0], shadowRight);
|
|
119
128
|
min[1] = Math.min(min[1], shadowTop);
|
|
120
129
|
max[1] = Math.max(max[1], shadowBottom);
|
|
121
|
-
geometry_1.
|
|
130
|
+
geometry_1.renderBounds.setMinMax(min, max);
|
|
122
131
|
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
sceneGraphService.dirtifyAABBToRoot(object);
|
|
132
|
+
});
|
|
133
|
+
dirtifyRenderable(object);
|
|
126
134
|
}
|
|
127
135
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
|
+
import { vec3 } from 'gl-matrix';
|
|
3
|
+
import { Geometry } from '../components';
|
|
4
|
+
import { dirtifyRenderable } from '../services';
|
|
5
|
+
import { createVec3 } from '../utils';
|
|
6
|
+
export function updateAnchor(oldValue, newValue, object) {
|
|
7
|
+
var bounds = object.getGeometryBounds();
|
|
8
|
+
|
|
9
|
+
if (bounds) {
|
|
10
|
+
var geometry = object.entity.getComponent(Geometry);
|
|
11
|
+
|
|
12
|
+
if (geometry && geometry.contentBounds) {
|
|
13
|
+
var offset = vec3.multiply(vec3.create(), vec3.fromValues.apply(vec3, __spreadArray([], __read(bounds.halfExtents.map(function (n) {
|
|
14
|
+
return n * 2;
|
|
15
|
+
})))), vec3.subtract(vec3.create(), createVec3(newValue || vec3.create()), createVec3(oldValue || vec3.create())));
|
|
16
|
+
geometry.contentBounds.update(vec3.subtract(geometry.contentBounds.center, geometry.contentBounds.center, offset), geometry.contentBounds.halfExtents);
|
|
17
|
+
geometry.renderBounds.update(vec3.subtract(geometry.renderBounds.center, geometry.renderBounds.center, offset), geometry.renderBounds.halfExtents);
|
|
18
|
+
dirtifyRenderable(object);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dirtifyRenderable } from '../services';
|
|
2
2
|
/**
|
|
3
3
|
* @see /zh/docs/api/basic/display-object#clippath
|
|
4
4
|
* @example
|
|
@@ -30,8 +30,7 @@ export function updateClipPath(oldClipPath, newClipPath, object) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
newClipPath.style.clipPathTargets.push(object);
|
|
33
|
-
}
|
|
34
|
-
|
|
33
|
+
}
|
|
35
34
|
|
|
36
|
-
object
|
|
35
|
+
dirtifyRenderable(object);
|
|
37
36
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DisplayObject } from '../DisplayObject';
|
|
1
|
+
import type { DisplayObject } from '../display-objects/DisplayObject';
|
|
2
2
|
export declare type LengthUnit = 'px' | '%';
|
|
3
3
|
export declare type AngleUnit = 'deg' | 'rad' | 'turn';
|
|
4
4
|
export declare type Unit = LengthUnit | AngleUnit | '';
|
|
@@ -95,17 +95,14 @@ export function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
|
95
95
|
if (valueWithUnit.unit === 'px') {
|
|
96
96
|
return Number(valueWithUnit.value);
|
|
97
97
|
} else if (valueWithUnit.unit === '%' && target) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// can't use bounds
|
|
102
|
-
// const bounds = target.getLocalBounds();
|
|
98
|
+
// use bounds
|
|
99
|
+
var bounds = target.getBounds();
|
|
100
|
+
var size = 0;
|
|
103
101
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
if (bounds) {
|
|
103
|
+
size = bounds.halfExtents[vec3Index] * 2;
|
|
104
|
+
}
|
|
107
105
|
|
|
108
|
-
size = vec3Index === 0 ? width : height;
|
|
109
106
|
return Number(valueWithUnit.value) / 100 * size;
|
|
110
107
|
}
|
|
111
108
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DisplayObject } from '../DisplayObject';
|
|
1
|
+
import type { DisplayObject } from '../display-objects/DisplayObject';
|
|
2
2
|
import { ParsedColorStyleProperty } from './color';
|
|
3
3
|
import { ParsedElement } from './dimension';
|
|
4
4
|
export interface ParsedFilterStyleProperty {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** handle props in keyframe */
|
|
2
|
-
import type {
|
|
2
|
+
import type { IElement } from '../dom';
|
|
3
3
|
import { SceneGraphService } from '../services';
|
|
4
4
|
export declare const StylePropertyParser = "StylePropertyParser";
|
|
5
|
-
export declare type StylePropertyParser<Original, Parsed> = (value: Original, displayObject:
|
|
5
|
+
export declare type StylePropertyParser<Original, Parsed> = (value: Original, displayObject: IElement | null) => Parsed;
|
|
6
6
|
export declare const StylePropertyParserFactory = "StylePropertyParserFactory";
|
|
7
7
|
export declare type StylePropertyParserFactory = <Original, Parsed>(name: string) => StylePropertyParser<Original, Parsed>;
|
|
8
8
|
export interface ParsedStyleProperty<T, V, Formatted = string> {
|
|
@@ -12,13 +12,14 @@ export interface ParsedStyleProperty<T, V, Formatted = string> {
|
|
|
12
12
|
}
|
|
13
13
|
export declare type Interpolatable = number | boolean | number[] | boolean[];
|
|
14
14
|
export declare const StylePropertyUpdater = "StylePropertyUpdater";
|
|
15
|
-
export declare type StylePropertyUpdater<Original> = (oldValue: Original, newValue: Original, displayObject:
|
|
15
|
+
export declare type StylePropertyUpdater<Original> = (oldValue: Original, newValue: Original, displayObject: IElement, sceneGraphService: SceneGraphService) => void;
|
|
16
16
|
export declare const StylePropertyUpdaterFactory = "StylePropertyUpdaterFactory";
|
|
17
17
|
export declare type StylePropertyUpdaterFactory = <Original>(name: string) => StylePropertyUpdater<Original>;
|
|
18
18
|
export declare const StylePropertyMerger = "StylePropertyMerger";
|
|
19
|
-
export declare type StylePropertyMerger<Parsed, T extends Interpolatable = number> = (left: Parsed, right: Parsed, displayObject:
|
|
19
|
+
export declare type StylePropertyMerger<Parsed, T extends Interpolatable = number> = (left: Parsed, right: Parsed, displayObject: IElement | null) => [T, T, (i: T) => string] | undefined;
|
|
20
20
|
export declare const StylePropertyMergerFactory = "StylePropertyMergerFactory";
|
|
21
21
|
export declare type StylePropertyMergerFactory = <Parsed>(name: string) => StylePropertyMerger<Parsed>;
|
|
22
|
+
export * from './anchor';
|
|
22
23
|
export * from './aabb';
|
|
23
24
|
export * from './localPosition';
|
|
24
25
|
export * from './numeric';
|
|
@@ -4,6 +4,7 @@ export var StylePropertyUpdater = 'StylePropertyUpdater';
|
|
|
4
4
|
export var StylePropertyUpdaterFactory = 'StylePropertyUpdaterFactory';
|
|
5
5
|
export var StylePropertyMerger = 'StylePropertyMerger';
|
|
6
6
|
export var StylePropertyMergerFactory = 'StylePropertyMergerFactory';
|
|
7
|
+
export * from './anchor';
|
|
7
8
|
export * from './aabb';
|
|
8
9
|
export * from './localPosition';
|
|
9
10
|
export * from './numeric';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DisplayObject } from '../
|
|
1
|
+
import type { DisplayObject } from '../display-objects';
|
|
2
2
|
export declare function updateLocalPosition(oldValue: number, newValue: number, object: DisplayObject): void;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { Renderable } from '../components';
|
|
2
1
|
export function updateLocalPosition(oldValue, newValue, object) {
|
|
3
|
-
var renderable = object.getEntity().getComponent(Renderable);
|
|
4
2
|
var _a = object.parsedStyle,
|
|
5
3
|
_b = _a.x,
|
|
6
4
|
x = _b === void 0 ? 0 : _b,
|
|
7
5
|
_c = _a.y,
|
|
8
6
|
y = _c === void 0 ? 0 : _c; // update local position when x/y changed
|
|
9
7
|
|
|
10
|
-
object.setLocalPosition(x, y);
|
|
11
|
-
|
|
12
|
-
renderable.aabbDirty = true;
|
|
13
|
-
renderable.dirty = true;
|
|
8
|
+
object.setLocalPosition(x, y);
|
|
14
9
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { convertPercentUnit, parseLengthOrPercent } from './dimension';
|
|
2
1
|
import { isNil } from '@antv/util';
|
|
2
|
+
import { convertPercentUnit, parseLengthOrPercent } from './dimension'; // import { Transform } from '../components';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
* @see /zh/docs/api/animation#%E8%B7%AF%E5%BE%84%E5%8A%A8%E7%94%BB
|
|
5
6
|
*/
|
|
@@ -43,8 +44,14 @@ export function updateTransformOrigin(oldValue, value, object) {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
if (!isNil(originX) && !isNil(originY)) {
|
|
47
|
+
// if (silent) {
|
|
48
|
+
// const transform = object.entity.getComponent(Transform);
|
|
49
|
+
// const originVec = transform.origin;
|
|
50
|
+
// originVec[0] = originX;
|
|
51
|
+
// originVec[1] = originY;
|
|
52
|
+
// } else {
|
|
46
53
|
// relative to local bounds
|
|
47
|
-
object.setOrigin(originX, originY);
|
|
54
|
+
object.setOrigin([originX, originY]); // }
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
|