@antv/g 5.0.14 → 5.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/AbstractRenderer.js +1 -3
- package/es/Canvas.d.ts +3 -0
- package/es/Canvas.js +10 -12
- package/es/DisplayObjectPool.js +1 -3
- package/es/camera/Camera.d.ts +3 -2
- package/es/camera/Camera.js +17 -11
- package/es/camera/Landmark.js +1 -3
- package/es/canvas-module.js +11 -17
- package/es/components/Cullable.js +1 -3
- package/es/components/Geometry.js +1 -3
- package/es/components/Renderable.js +1 -3
- package/es/components/Sortable.js +1 -3
- package/es/components/Transform.d.ts +0 -1
- package/es/components/Transform.js +1 -4
- package/es/display-objects/Circle.d.ts +4 -2
- package/es/display-objects/Circle.js +9 -6
- package/es/display-objects/CustomElement.d.ts +3 -2
- package/es/display-objects/CustomElement.js +10 -9
- package/es/display-objects/DisplayObject.d.ts +9 -3
- package/es/display-objects/DisplayObject.js +98 -50
- package/es/display-objects/Ellipse.d.ts +6 -3
- package/es/display-objects/Ellipse.js +9 -6
- package/es/display-objects/Group.d.ts +18 -2
- package/es/display-objects/Group.js +15 -12
- package/es/display-objects/HTML.d.ts +6 -1
- package/es/display-objects/HTML.js +8 -6
- package/es/display-objects/Image.d.ts +12 -7
- package/es/display-objects/Image.js +11 -6
- package/es/display-objects/Line.d.ts +1 -1
- package/es/display-objects/Line.js +13 -7
- package/es/display-objects/Path.d.ts +3 -2
- package/es/display-objects/Path.js +11 -8
- package/es/display-objects/Polygon.d.ts +1 -1
- package/es/display-objects/Polygon.js +10 -6
- package/es/display-objects/Polyline.d.ts +1 -1
- package/es/display-objects/Polyline.js +11 -8
- package/es/display-objects/Rect.d.ts +8 -5
- package/es/display-objects/Rect.js +10 -7
- package/es/display-objects/TSpan.d.ts +1 -0
- package/es/display-objects/TSpan.js +0 -0
- package/es/display-objects/Text.d.ts +32 -4
- package/es/display-objects/Text.js +71 -14
- package/es/dom/Animation.js +2 -4
- package/es/dom/AnimationEffectTiming.js +1 -3
- package/es/dom/AnimationEvent.js +1 -3
- package/es/dom/AnimationTimeline.js +2 -5
- package/es/dom/CustomElementRegistry.js +13 -15
- package/es/dom/CustomEvent.js +1 -3
- package/es/dom/Document.d.ts +2 -1
- package/es/dom/Document.js +23 -5
- package/es/dom/Element.d.ts +36 -9
- package/es/dom/Element.js +103 -15
- package/es/dom/EventTarget.d.ts +2 -2
- package/es/dom/EventTarget.js +3 -4
- package/es/dom/FederatedEvent.d.ts +5 -2
- package/es/dom/FederatedEvent.js +1 -3
- package/es/dom/FederatedMouseEvent.js +1 -3
- package/es/dom/FederatedPointerEvent.js +1 -3
- package/es/dom/FederatedWheelEvent.js +1 -3
- package/es/dom/KeyframeEffect.js +1 -3
- package/es/dom/MutationEvent.d.ts +15 -0
- package/es/dom/MutationEvent.js +27 -0
- package/es/dom/MutationObserver.d.ts +36 -0
- package/es/dom/MutationObserver.js +406 -0
- package/es/dom/MutationRecord.d.ts +14 -0
- package/es/dom/MutationRecord.js +29 -0
- package/es/dom/Node.d.ts +35 -3
- package/es/dom/Node.js +185 -20
- package/es/dom/index.d.ts +3 -0
- package/es/dom/index.js +3 -0
- package/es/dom/interfaces.d.ts +36 -8
- package/es/dom/interfaces.js +23 -5
- package/es/global-module.d.ts +4 -1
- package/es/global-module.js +36 -79
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/plugins/CullingPlugin.d.ts +0 -2
- package/es/plugins/CullingPlugin.js +4 -27
- package/es/plugins/DirtyCheckPlugin.js +3 -5
- package/es/plugins/EventPlugin.d.ts +2 -1
- package/es/plugins/EventPlugin.js +16 -8
- package/es/plugins/FrustumCullingStrategy.d.ts +1 -0
- package/es/plugins/FrustumCullingStrategy.js +40 -35
- package/es/plugins/PrepareRendererPlugin.js +22 -8
- package/es/property-handlers/aabb.js +22 -24
- package/es/property-handlers/anchor.js +2 -1
- package/es/property-handlers/color.js +3 -0
- package/es/property-handlers/dimension.d.ts +15 -2
- package/es/property-handlers/dimension.js +77 -8
- package/es/property-handlers/index.d.ts +3 -0
- package/es/property-handlers/index.js +4 -1
- package/es/property-handlers/inherit.d.ts +6 -0
- package/es/property-handlers/inherit.js +25 -0
- package/es/property-handlers/interfaces.d.ts +2 -2
- package/es/property-handlers/lineDash.d.ts +6 -1
- package/es/property-handlers/lineDash.js +23 -4
- package/es/property-handlers/offsetDistance.js +2 -2
- package/es/property-handlers/path.d.ts +1 -1
- package/es/property-handlers/text.d.ts +2 -0
- package/es/property-handlers/text.js +3 -0
- package/es/property-handlers/textTransform.d.ts +6 -0
- package/es/property-handlers/textTransform.js +19 -0
- package/es/services/EventService.js +2 -6
- package/es/services/RenderingContext.d.ts +5 -8
- package/es/services/RenderingContext.js +6 -7
- package/es/services/RenderingService.js +3 -11
- package/es/services/SceneGraphSelector.d.ts +3 -2
- package/es/services/SceneGraphSelector.js +9 -7
- package/es/services/SceneGraphService.d.ts +7 -14
- package/es/services/SceneGraphService.js +15 -85
- package/es/services/aabb/CircleUpdater.d.ts +2 -2
- package/es/services/aabb/CircleUpdater.js +22 -14
- package/es/services/aabb/EllipseUpdater.d.ts +2 -2
- package/es/services/aabb/EllipseUpdater.js +29 -16
- package/es/services/aabb/LineUpdater.js +3 -5
- package/es/services/aabb/PathUpdater.js +3 -5
- package/es/services/aabb/PolylineUpdater.js +4 -6
- package/es/services/aabb/RectUpdater.d.ts +2 -2
- package/es/services/aabb/RectUpdater.js +32 -21
- package/es/services/aabb/TextUpdater.js +20 -13
- package/es/services/text/OffscreenCanvasCreator.js +1 -3
- package/es/services/text/index.js +18 -22
- package/es/shapes/AABB.d.ts +1 -0
- package/es/shapes/AABB.js +9 -3
- package/es/shapes/BoundingSphere.js +1 -3
- package/es/shapes/Frustum.js +1 -3
- package/es/shapes/Plane.js +1 -3
- package/es/shapes/Point.js +1 -3
- package/es/shapes/Polygon.js +1 -3
- package/es/shapes/Ray.js +1 -3
- package/es/shapes/Rect.js +1 -3
- package/es/shapes/Rectangle.js +1 -3
- package/es/types.d.ts +48 -26
- package/es/types.js +50 -31
- package/es/utils/animation.js +1 -1
- package/es/utils/event.js +5 -3
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/interpolation.d.ts +1 -0
- package/es/utils/interpolation.js +41 -8
- package/es/utils/path.d.ts +1 -1
- package/es/utils/path.js +13 -13
- package/es/utils/raf.d.ts +1 -1
- package/es/utils/raf.js +0 -2
- package/es/utils/string.d.ts +1 -0
- package/es/utils/string.js +9 -0
- package/es/utils/text.js +1 -1
- package/lib/AbstractRenderer.js +1 -3
- package/lib/Canvas.d.ts +3 -0
- package/lib/Canvas.js +9 -11
- package/lib/DisplayObjectPool.js +1 -3
- package/lib/camera/Camera.d.ts +3 -2
- package/lib/camera/Camera.js +21 -13
- package/lib/camera/Landmark.js +1 -3
- package/lib/canvas-module.js +10 -15
- package/lib/components/Cullable.js +2 -4
- package/lib/components/Geometry.js +1 -3
- package/lib/components/Renderable.js +1 -3
- package/lib/components/Sortable.js +1 -3
- package/lib/components/Transform.d.ts +0 -1
- package/lib/components/Transform.js +1 -4
- package/lib/display-objects/Circle.d.ts +4 -2
- package/lib/display-objects/Circle.js +8 -5
- package/lib/display-objects/CustomElement.d.ts +3 -2
- package/lib/display-objects/CustomElement.js +10 -9
- package/lib/display-objects/DisplayObject.d.ts +9 -3
- package/lib/display-objects/DisplayObject.js +98 -47
- package/lib/display-objects/Ellipse.d.ts +6 -3
- package/lib/display-objects/Ellipse.js +8 -5
- package/lib/display-objects/Group.d.ts +18 -2
- package/lib/display-objects/Group.js +14 -12
- package/lib/display-objects/HTML.d.ts +6 -1
- package/lib/display-objects/HTML.js +7 -5
- package/lib/display-objects/Image.d.ts +12 -7
- package/lib/display-objects/Image.js +10 -5
- package/lib/display-objects/Line.d.ts +1 -1
- package/lib/display-objects/Line.js +12 -6
- package/lib/display-objects/Path.d.ts +3 -2
- package/lib/display-objects/Path.js +10 -7
- package/lib/display-objects/Polygon.d.ts +1 -1
- package/lib/display-objects/Polygon.js +9 -5
- package/lib/display-objects/Polyline.d.ts +1 -1
- package/lib/display-objects/Polyline.js +10 -7
- package/lib/display-objects/Rect.d.ts +8 -5
- package/lib/display-objects/Rect.js +9 -6
- package/lib/display-objects/TSpan.d.ts +1 -0
- package/lib/display-objects/TSpan.js +1 -0
- package/lib/display-objects/Text.d.ts +32 -4
- package/lib/display-objects/Text.js +71 -13
- package/lib/dom/Animation.js +2 -4
- package/lib/dom/AnimationEffectTiming.js +1 -3
- package/lib/dom/AnimationEvent.js +1 -3
- package/lib/dom/AnimationTimeline.js +3 -6
- package/lib/dom/CustomElementRegistry.js +12 -14
- package/lib/dom/CustomEvent.js +1 -3
- package/lib/dom/Document.d.ts +2 -1
- package/lib/dom/Document.js +25 -6
- package/lib/dom/Element.d.ts +36 -9
- package/lib/dom/Element.js +105 -15
- package/lib/dom/EventTarget.d.ts +2 -2
- package/lib/dom/EventTarget.js +3 -4
- package/lib/dom/FederatedEvent.d.ts +5 -2
- package/lib/dom/FederatedEvent.js +1 -3
- package/lib/dom/FederatedMouseEvent.js +1 -3
- package/lib/dom/FederatedPointerEvent.js +1 -3
- package/lib/dom/FederatedWheelEvent.js +1 -3
- package/lib/dom/KeyframeEffect.js +2 -4
- package/lib/dom/MutationEvent.d.ts +15 -0
- package/lib/dom/MutationEvent.js +35 -0
- package/lib/dom/MutationObserver.d.ts +36 -0
- package/lib/dom/MutationObserver.js +417 -0
- package/lib/dom/MutationRecord.d.ts +14 -0
- package/lib/dom/MutationRecord.js +36 -0
- package/lib/dom/Node.d.ts +35 -3
- package/lib/dom/Node.js +186 -19
- package/lib/dom/index.d.ts +3 -0
- package/lib/dom/index.js +39 -0
- package/lib/dom/interfaces.d.ts +36 -8
- package/lib/dom/interfaces.js +23 -5
- package/lib/global-module.d.ts +4 -1
- package/lib/global-module.js +42 -76
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/plugins/CullingPlugin.d.ts +0 -2
- package/lib/plugins/CullingPlugin.js +4 -27
- package/lib/plugins/DirtyCheckPlugin.js +2 -4
- package/lib/plugins/EventPlugin.d.ts +2 -1
- package/lib/plugins/EventPlugin.js +14 -8
- package/lib/plugins/FrustumCullingStrategy.d.ts +1 -0
- package/lib/plugins/FrustumCullingStrategy.js +41 -35
- package/lib/plugins/PrepareRendererPlugin.js +25 -7
- package/lib/property-handlers/aabb.js +21 -23
- package/lib/property-handlers/anchor.js +3 -1
- package/lib/property-handlers/color.js +5 -2
- package/lib/property-handlers/dimension.d.ts +15 -2
- package/lib/property-handlers/dimension.js +84 -12
- package/lib/property-handlers/index.d.ts +3 -0
- package/lib/property-handlers/index.js +39 -0
- package/lib/property-handlers/inherit.d.ts +6 -0
- package/lib/property-handlers/inherit.js +34 -0
- package/lib/property-handlers/interfaces.d.ts +2 -2
- package/lib/property-handlers/interfaces.js +1 -1
- package/lib/property-handlers/lineDash.d.ts +6 -1
- package/lib/property-handlers/lineDash.js +25 -4
- package/lib/property-handlers/numeric.js +3 -3
- package/lib/property-handlers/offsetDistance.js +1 -1
- package/lib/property-handlers/path.d.ts +1 -1
- package/lib/property-handlers/path.js +1 -1
- package/lib/property-handlers/text.d.ts +2 -0
- package/lib/property-handlers/text.js +10 -0
- package/lib/property-handlers/textTransform.d.ts +6 -0
- package/lib/property-handlers/textTransform.js +27 -0
- package/lib/property-handlers/transform.js +1 -1
- package/lib/services/EventService.js +2 -6
- package/lib/services/RenderingContext.d.ts +5 -8
- package/lib/services/RenderingContext.js +8 -9
- package/lib/services/RenderingService.js +2 -10
- package/lib/services/SceneGraphSelector.d.ts +3 -2
- package/lib/services/SceneGraphSelector.js +12 -7
- package/lib/services/SceneGraphService.d.ts +7 -14
- package/lib/services/SceneGraphService.js +18 -87
- package/lib/services/aabb/CircleUpdater.d.ts +2 -2
- package/lib/services/aabb/CircleUpdater.js +21 -13
- package/lib/services/aabb/EllipseUpdater.d.ts +2 -2
- package/lib/services/aabb/EllipseUpdater.js +28 -15
- package/lib/services/aabb/LineUpdater.js +2 -4
- package/lib/services/aabb/PathUpdater.js +2 -4
- package/lib/services/aabb/PolylineUpdater.js +3 -5
- package/lib/services/aabb/RectUpdater.d.ts +2 -2
- package/lib/services/aabb/RectUpdater.js +31 -20
- package/lib/services/aabb/TextUpdater.js +19 -12
- package/lib/services/aabb/index.js +10 -10
- package/lib/services/aabb/interfaces.js +1 -1
- package/lib/services/text/OffscreenCanvasCreator.js +1 -3
- package/lib/services/text/index.js +18 -22
- package/lib/shapes/AABB.d.ts +1 -0
- package/lib/shapes/AABB.js +9 -3
- package/lib/shapes/BoundingSphere.js +1 -3
- package/lib/shapes/Frustum.js +2 -4
- package/lib/shapes/Plane.js +1 -3
- package/lib/shapes/Point.js +1 -3
- package/lib/shapes/Polygon.js +1 -3
- package/lib/shapes/Ray.js +1 -3
- package/lib/shapes/Rect.js +1 -3
- package/lib/shapes/Rectangle.js +1 -3
- package/lib/types.d.ts +48 -26
- package/lib/types.js +56 -35
- package/lib/utils/animation.js +3 -4
- package/lib/utils/bezier-easing.js +1 -1
- package/lib/utils/custom-easing.js +1 -1
- package/lib/utils/event.js +7 -6
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/interpolation.d.ts +1 -0
- package/lib/utils/interpolation.js +43 -7
- package/lib/utils/math.js +5 -5
- package/lib/utils/path.d.ts +1 -1
- package/lib/utils/path.js +15 -15
- package/lib/utils/raf.d.ts +1 -1
- package/lib/utils/raf.js +1 -4
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +16 -0
- package/lib/utils/text.js +1 -1
- package/package.json +6 -4
- package/dist/index.umd.min.js +0 -15
package/es/AbstractRenderer.js
CHANGED
package/es/Canvas.d.ts
CHANGED
|
@@ -73,6 +73,9 @@ export declare class Canvas extends EventTarget implements ICanvas {
|
|
|
73
73
|
total: number;
|
|
74
74
|
rendered: number;
|
|
75
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Window/getComputedStyle
|
|
78
|
+
*/
|
|
76
79
|
getComputedStyle(node: DisplayObject): any;
|
|
77
80
|
get ready(): Promise<any>;
|
|
78
81
|
destroy(destroyScenegraph?: boolean): void;
|
package/es/Canvas.js
CHANGED
|
@@ -4,9 +4,9 @@ import { cleanExistedCanvas, isBrowser } from './utils/canvas';
|
|
|
4
4
|
import { DisplayObject } from './display-objects/DisplayObject';
|
|
5
5
|
import { ContextService } from './services';
|
|
6
6
|
import { RenderingService } from './services/RenderingService';
|
|
7
|
-
import { RenderingContext,
|
|
7
|
+
import { RenderingContext, RenderReason } from './services/RenderingContext';
|
|
8
8
|
import { EventService } from './services/EventService';
|
|
9
|
-
import { Camera,
|
|
9
|
+
import { Camera, CameraEvent, CAMERA_PROJECTION_MODE, DefaultCamera } from './camera';
|
|
10
10
|
import { containerModule as commonContainerModule } from './canvas-module';
|
|
11
11
|
import { cancelAnimationFrame, requestAnimationFrame, patch } from './utils/raf';
|
|
12
12
|
import { Document, EventTarget, ElementEvent } from './dom';
|
|
@@ -29,9 +29,7 @@ export var CanvasEvent;
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var Canvas =
|
|
33
|
-
/** @class */
|
|
34
|
-
function (_super) {
|
|
32
|
+
var Canvas = function (_super) {
|
|
35
33
|
__extends(Canvas, _super);
|
|
36
34
|
|
|
37
35
|
function Canvas(config) {
|
|
@@ -109,11 +107,6 @@ function (_super) {
|
|
|
109
107
|
* the root node in scene graph
|
|
110
108
|
*/
|
|
111
109
|
root: this.document.documentElement,
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* removed render bounds
|
|
115
|
-
*/
|
|
116
|
-
removedRenderBoundsList: [],
|
|
117
110
|
renderReasons: new Set(),
|
|
118
111
|
force: false,
|
|
119
112
|
dirty: false
|
|
@@ -132,8 +125,8 @@ function (_super) {
|
|
|
132
125
|
var camera = new Camera().setPosition(width / 2, height / 2, 500).setFocalPoint(width / 2, height / 2, 0).setOrthographic(width / -2, width / 2, height / 2, height / -2, 0.1, 1000); // redraw when camera changed
|
|
133
126
|
|
|
134
127
|
var context = this.container.get(RenderingContext);
|
|
135
|
-
camera.on(
|
|
136
|
-
context.renderReasons.add(
|
|
128
|
+
camera.on(CameraEvent.UPDATED, function () {
|
|
129
|
+
context.renderReasons.add(RenderReason.CAMERA_CHANGED);
|
|
137
130
|
}); // bind camera
|
|
138
131
|
|
|
139
132
|
this.container.register({
|
|
@@ -186,6 +179,10 @@ function (_super) {
|
|
|
186
179
|
Canvas.prototype.getStats = function () {
|
|
187
180
|
return this.getRenderingService().getStats();
|
|
188
181
|
};
|
|
182
|
+
/**
|
|
183
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Window/getComputedStyle
|
|
184
|
+
*/
|
|
185
|
+
|
|
189
186
|
|
|
190
187
|
Canvas.prototype.getComputedStyle = function (node) {
|
|
191
188
|
return node.parsedStyle;
|
|
@@ -367,6 +364,7 @@ function (_super) {
|
|
|
367
364
|
};
|
|
368
365
|
|
|
369
366
|
Canvas.prototype.loadCommonContainerModule = function () {
|
|
367
|
+
this.container.unload(commonContainerModule);
|
|
370
368
|
this.container.load(commonContainerModule, true);
|
|
371
369
|
};
|
|
372
370
|
|
package/es/DisplayObjectPool.js
CHANGED
package/es/camera/Camera.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export declare enum CAMERA_PROJECTION_MODE {
|
|
|
18
18
|
ORTHOGRAPHIC = "ORTHOGRAPHIC",
|
|
19
19
|
PERSPECTIVE = "PERSPECTIVE"
|
|
20
20
|
}
|
|
21
|
-
export declare const
|
|
22
|
-
|
|
21
|
+
export declare const CameraEvent: {
|
|
22
|
+
UPDATED: string;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* 参考「WebGL Insights - 23.Designing Cameras for WebGL Applications」,基于 Responsible Camera 思路设计
|
|
@@ -277,4 +277,5 @@ export declare class Camera extends EventEmitter {
|
|
|
277
277
|
*/
|
|
278
278
|
private _getDistance;
|
|
279
279
|
private _getOrthoMatrix;
|
|
280
|
+
private triggerUpdate;
|
|
280
281
|
}
|
package/es/camera/Camera.js
CHANGED
|
@@ -30,8 +30,8 @@ export var CAMERA_PROJECTION_MODE;
|
|
|
30
30
|
CAMERA_PROJECTION_MODE["PERSPECTIVE"] = "PERSPECTIVE";
|
|
31
31
|
})(CAMERA_PROJECTION_MODE || (CAMERA_PROJECTION_MODE = {}));
|
|
32
32
|
|
|
33
|
-
export var
|
|
34
|
-
|
|
33
|
+
export var CameraEvent = {
|
|
34
|
+
UPDATED: 'updated'
|
|
35
35
|
};
|
|
36
36
|
var DEG_2_RAD = Math.PI / 180;
|
|
37
37
|
var RAD_2_DEG = 180 / Math.PI;
|
|
@@ -44,9 +44,7 @@ var RAD_2_DEG = 180 / Math.PI;
|
|
|
44
44
|
* 4. 移动到 Landmark,具有平滑的动画效果,其间禁止其他用户交互
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
-
var Camera =
|
|
48
|
-
/** @class */
|
|
49
|
-
function (_super) {
|
|
47
|
+
var Camera = function (_super) {
|
|
50
48
|
__extends(Camera, _super);
|
|
51
49
|
|
|
52
50
|
function Camera() {
|
|
@@ -415,7 +413,7 @@ function (_super) {
|
|
|
415
413
|
|
|
416
414
|
mat4.scale(this.projectionMatrix, this.projectionMatrix, vec3.fromValues(1, -1, 1));
|
|
417
415
|
mat4.invert(this.projectionMatrixInverse, this.projectionMatrix);
|
|
418
|
-
this.
|
|
416
|
+
this.triggerUpdate();
|
|
419
417
|
return this;
|
|
420
418
|
};
|
|
421
419
|
|
|
@@ -452,7 +450,7 @@ function (_super) {
|
|
|
452
450
|
|
|
453
451
|
this._getOrthoMatrix();
|
|
454
452
|
|
|
455
|
-
this.
|
|
453
|
+
this.triggerUpdate();
|
|
456
454
|
return this;
|
|
457
455
|
};
|
|
458
456
|
/**
|
|
@@ -696,7 +694,7 @@ function (_super) {
|
|
|
696
694
|
|
|
697
695
|
this._setPosition(pos);
|
|
698
696
|
|
|
699
|
-
this.
|
|
697
|
+
this.triggerUpdate();
|
|
700
698
|
return this;
|
|
701
699
|
};
|
|
702
700
|
/**
|
|
@@ -725,7 +723,7 @@ function (_super) {
|
|
|
725
723
|
vec3.add(this.focalPoint, pos, this.distanceVector);
|
|
726
724
|
}
|
|
727
725
|
|
|
728
|
-
this.
|
|
726
|
+
this.triggerUpdate();
|
|
729
727
|
return this;
|
|
730
728
|
};
|
|
731
729
|
|
|
@@ -800,7 +798,7 @@ function (_super) {
|
|
|
800
798
|
|
|
801
799
|
_this.computeMatrix();
|
|
802
800
|
|
|
803
|
-
_this.
|
|
801
|
+
_this.triggerUpdate();
|
|
804
802
|
|
|
805
803
|
var dist = vec3.dist(interFocalPoint, destFocalPoint_1) + vec3.dist(interPosition, destPosition_1);
|
|
806
804
|
|
|
@@ -842,7 +840,7 @@ function (_super) {
|
|
|
842
840
|
|
|
843
841
|
this._getOrthoMatrix();
|
|
844
842
|
|
|
845
|
-
this.
|
|
843
|
+
this.triggerUpdate();
|
|
846
844
|
};
|
|
847
845
|
/**
|
|
848
846
|
* 计算相机矩阵
|
|
@@ -971,6 +969,14 @@ function (_super) {
|
|
|
971
969
|
mat4.fromRotationTranslationScaleOrigin(this.orthoMatrix, rotZ, vec3.fromValues((this.rright - this.left) / 2 - position[0], (this.top - this.bottom) / 2 - position[1], 0), vec3.fromValues(this.zoom, this.zoom, 1), position);
|
|
972
970
|
};
|
|
973
971
|
|
|
972
|
+
Camera.prototype.triggerUpdate = function () {
|
|
973
|
+
// update frustum
|
|
974
|
+
var viewMatrix = this.getViewTransform();
|
|
975
|
+
var vpMatrix = mat4.multiply(mat4.create(), this.getPerspective(), viewMatrix);
|
|
976
|
+
this.getFrustum().extractFromVPMatrix(vpMatrix);
|
|
977
|
+
this.emit(CameraEvent.UPDATED);
|
|
978
|
+
};
|
|
979
|
+
|
|
974
980
|
Camera.ProjectionMode = {
|
|
975
981
|
ORTHOGRAPHIC: 'ORTHOGRAPHIC',
|
|
976
982
|
PERSPECTIVE: 'PERSPECTIVE'
|
package/es/camera/Landmark.js
CHANGED
package/es/canvas-module.js
CHANGED
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import { Module, Contribution } from 'mana-syringe';
|
|
2
2
|
import { DirtyCheckPlugin } from './plugins/DirtyCheckPlugin';
|
|
3
3
|
import { CullingPlugin, CullingStrategyContribution } from './plugins/CullingPlugin';
|
|
4
|
-
import { PrepareRendererPlugin } from './plugins/PrepareRendererPlugin';
|
|
4
|
+
import { PrepareRendererPlugin } from './plugins/PrepareRendererPlugin'; // import { CSSCalculatorPlugin } from './plugins/CSSStyleCalculator';
|
|
5
|
+
|
|
5
6
|
import { FrustumCullingStrategy } from './plugins/FrustumCullingStrategy';
|
|
6
7
|
import { RenderingPluginContribution, RenderingService } from './services';
|
|
7
8
|
import { EventPlugin } from './plugins/EventPlugin';
|
|
8
9
|
import { EventService } from './services';
|
|
9
|
-
export var containerModule = Module(function (register
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
context.container.remove(RenderingService);
|
|
14
|
-
context.container.remove(FrustumCullingStrategy);
|
|
15
|
-
} else {
|
|
16
|
-
Contribution.register(register, RenderingPluginContribution, {
|
|
17
|
-
cache: false
|
|
18
|
-
}); // culling plugin
|
|
19
|
-
|
|
20
|
-
Contribution.register(register, CullingStrategyContribution, {
|
|
21
|
-
cache: false
|
|
22
|
-
});
|
|
23
|
-
} // register built-in rendering plugins
|
|
10
|
+
export var containerModule = Module(function (register) {
|
|
11
|
+
Contribution.register(register, RenderingPluginContribution, {
|
|
12
|
+
cache: false
|
|
13
|
+
}); // culling plugin
|
|
24
14
|
|
|
15
|
+
Contribution.register(register, CullingStrategyContribution, {
|
|
16
|
+
cache: false
|
|
17
|
+
}); // register built-in rendering plugins
|
|
25
18
|
|
|
26
19
|
register(RenderingService);
|
|
27
20
|
register(EventService);
|
|
28
21
|
register(EventPlugin);
|
|
29
|
-
register(PrepareRendererPlugin);
|
|
22
|
+
register(PrepareRendererPlugin); // register(CSSCalculatorPlugin);
|
|
23
|
+
|
|
30
24
|
register(DirtyCheckPlugin);
|
|
31
25
|
register(CullingPlugin);
|
|
32
26
|
register(FrustumCullingStrategy);
|
|
@@ -7,9 +7,7 @@ export var Strategy;
|
|
|
7
7
|
Strategy[Strategy["Standard"] = 0] = "Standard";
|
|
8
8
|
})(Strategy || (Strategy = {}));
|
|
9
9
|
|
|
10
|
-
var Cullable =
|
|
11
|
-
/** @class */
|
|
12
|
-
function () {
|
|
10
|
+
var Cullable = function () {
|
|
13
11
|
function Cullable() {
|
|
14
12
|
this.strategy = Strategy.Standard;
|
|
15
13
|
this.visibilityPlaneMask = -1;
|
|
@@ -3,14 +3,11 @@ import { mat4, quat, vec3 } from 'gl-matrix';
|
|
|
3
3
|
* do RTS transformation for 2D/3D
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
var Transform =
|
|
7
|
-
/** @class */
|
|
8
|
-
function () {
|
|
6
|
+
var Transform = function () {
|
|
9
7
|
function Transform() {
|
|
10
8
|
this.dirtyFlag = false;
|
|
11
9
|
this.localDirtyFlag = false;
|
|
12
10
|
this.frozen = false;
|
|
13
|
-
this.graphDepth = 0;
|
|
14
11
|
/**
|
|
15
12
|
* local space RTS
|
|
16
13
|
*/
|
|
@@ -1,12 +1,14 @@
|
|
|
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 CircleStyleProps extends BaseStyleProps {
|
|
5
6
|
r: number;
|
|
6
7
|
}
|
|
7
8
|
export interface ParsedCircleStyleProps extends ParsedBaseStyleProps {
|
|
8
|
-
r:
|
|
9
|
+
r: ParsedElement;
|
|
10
|
+
rInPixels: number;
|
|
9
11
|
}
|
|
10
12
|
export declare class Circle extends DisplayObject<CircleStyleProps, ParsedCircleStyleProps> {
|
|
11
|
-
constructor({ style, ...rest }
|
|
13
|
+
constructor({ style, ...rest }?: DisplayObjectConfig<CircleStyleProps>);
|
|
12
14
|
}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { Shape } from '../types';
|
|
3
3
|
import { DisplayObject } from './DisplayObject';
|
|
4
4
|
|
|
5
|
-
var Circle =
|
|
6
|
-
/** @class */
|
|
7
|
-
function (_super) {
|
|
5
|
+
var Circle = function (_super) {
|
|
8
6
|
__extends(Circle, _super);
|
|
9
7
|
|
|
10
8
|
function Circle(_a) {
|
|
9
|
+
if (_a === void 0) {
|
|
10
|
+
_a = {};
|
|
11
|
+
}
|
|
12
|
+
|
|
11
13
|
var style = _a.style,
|
|
12
14
|
rest = __rest(_a, ["style"]);
|
|
13
15
|
|
|
14
16
|
return _super.call(this, __assign({
|
|
15
|
-
type:
|
|
17
|
+
type: Shape.CIRCLE,
|
|
16
18
|
style: __assign({
|
|
17
19
|
r: 0,
|
|
18
|
-
anchor: [0.5, 0.5]
|
|
20
|
+
anchor: [0.5, 0.5],
|
|
21
|
+
lineWidth: 0
|
|
19
22
|
}, style)
|
|
20
23
|
}, rest)) || this;
|
|
21
24
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { DisplayObject } from './DisplayObject';
|
|
2
2
|
import type { DisplayObjectConfig } from '../dom/interfaces';
|
|
3
|
+
import type { BaseStyleProps } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* shadow root
|
|
5
6
|
* @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
|
|
6
7
|
*/
|
|
7
|
-
export declare abstract class CustomElement<CustomElementStyleProps> extends DisplayObject<CustomElementStyleProps> {
|
|
8
|
-
constructor(config
|
|
8
|
+
export declare abstract class CustomElement<CustomElementStyleProps extends BaseStyleProps> extends DisplayObject<CustomElementStyleProps> {
|
|
9
|
+
constructor(config?: DisplayObjectConfig<CustomElementStyleProps>);
|
|
9
10
|
/**
|
|
10
11
|
* fired after element insert into DOM tree
|
|
11
12
|
*/
|
|
@@ -6,13 +6,15 @@ import { ElementEvent } from '../dom/interfaces';
|
|
|
6
6
|
* @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
var CustomElement =
|
|
10
|
-
/** @class */
|
|
11
|
-
function (_super) {
|
|
9
|
+
var CustomElement = function (_super) {
|
|
12
10
|
__extends(CustomElement, _super); // private shadowNodes: DisplayObject[] = [];
|
|
13
11
|
|
|
14
12
|
|
|
15
13
|
function CustomElement(config) {
|
|
14
|
+
if (config === void 0) {
|
|
15
|
+
config = {};
|
|
16
|
+
}
|
|
17
|
+
|
|
16
18
|
var _this = _super.call(this, config) || this;
|
|
17
19
|
|
|
18
20
|
_this.handleMounted = function (e) {
|
|
@@ -56,20 +58,19 @@ function (_super) {
|
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
newValue = _a.newValue;
|
|
61
|
+
var attrName = e.attrName,
|
|
62
|
+
prevValue = e.prevValue,
|
|
63
|
+
newValue = e.newValue;
|
|
63
64
|
|
|
64
65
|
if (_this.attributeChangedCallback) {
|
|
65
|
-
_this.attributeChangedCallback(
|
|
66
|
+
_this.attributeChangedCallback(attrName, prevValue, newValue);
|
|
66
67
|
}
|
|
67
68
|
}; // this.addEventListener(ElementEvent.CHILD_INSERTED, this.handleChildInserted);
|
|
68
69
|
// this.addEventListener(ElementEvent.CHILD_REMOVED, this.handleChildRemoved);
|
|
69
70
|
|
|
70
71
|
|
|
71
72
|
if (_this.attributeChangedCallback) {
|
|
72
|
-
_this.addEventListener(ElementEvent.
|
|
73
|
+
_this.addEventListener(ElementEvent.ATTR_MODIFIED, _this.handleAttributeChanged);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
if (_this.connectedCallback) {
|
|
@@ -35,18 +35,24 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
|
|
|
35
35
|
destroy(): void;
|
|
36
36
|
cloneNode(deep?: boolean): this;
|
|
37
37
|
private initAttributes;
|
|
38
|
-
setAttribute<Key extends keyof StyleProps>(
|
|
38
|
+
setAttribute<Key extends keyof StyleProps>(name: Key, value: StyleProps[Key], force?: boolean): void;
|
|
39
39
|
/**
|
|
40
40
|
* parse property, eg.
|
|
41
41
|
* * fill: 'red' => [1, 0, 0, 1]
|
|
42
42
|
* * translateX: '10px' => { unit: 'px', value: 10 }
|
|
43
|
+
* * fontSize: '2em' => { unit: 'px', value: 32 }
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
parseStyleProperty<Key extends keyof ParsedStyleProps>(name: Key, value: ParsedStyleProps[Key]): void;
|
|
46
|
+
updateStyleProperty<Key extends keyof ParsedStyleProps>(name: Key, oldParsedValue: ParsedStyleProps[Key], newParsedValue: ParsedStyleProps[Key]): void;
|
|
46
47
|
/**
|
|
47
48
|
* called when attributes get changed or initialized
|
|
48
49
|
*/
|
|
49
50
|
private changeAttribute;
|
|
51
|
+
/**
|
|
52
|
+
* returns different values than getBoundingClientRect(), as the latter returns value relative to the viewport
|
|
53
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox
|
|
54
|
+
*/
|
|
55
|
+
getBBox(): DOMRect;
|
|
50
56
|
setOrigin(position: vec3 | vec2 | number, y?: number, z?: number): this;
|
|
51
57
|
getOrigin(): vec3;
|
|
52
58
|
/**
|