@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
|
@@ -4,7 +4,13 @@ import { __read, __spreadArray } from "tslib";
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { bezier } from './bezier-easing';
|
|
7
|
-
|
|
7
|
+
export var convertToDash = function convertToDash(str) {
|
|
8
|
+
str = str.replace(/([A-Z])/g, function (letter) {
|
|
9
|
+
return "-" + letter.toLowerCase();
|
|
10
|
+
}); // Remove first dash
|
|
11
|
+
|
|
12
|
+
return str.charAt(0) === '-' ? str.substr(1) : str;
|
|
13
|
+
};
|
|
8
14
|
export var limit = function limit(value, min, max) {
|
|
9
15
|
return Math.min(Math.max(value, min), max);
|
|
10
16
|
};
|
|
@@ -109,7 +115,7 @@ export var INTINITE_LOOP_LIMIT = 10000;
|
|
|
109
115
|
|
|
110
116
|
export var parseEasingParameters = function parseEasingParameters(str) {
|
|
111
117
|
var match = /(\(|\s)([^)]+)\)?/.exec(str);
|
|
112
|
-
return match ? match[2].split(
|
|
118
|
+
return match ? match[2].split(',').map(function (value) {
|
|
113
119
|
var num = parseFloat(value);
|
|
114
120
|
return !Number.isNaN(num) ? num : value.trim();
|
|
115
121
|
}) : [];
|
|
@@ -293,8 +299,8 @@ export var EasingFunctions = {
|
|
|
293
299
|
*/
|
|
294
300
|
|
|
295
301
|
export var complexEasingSyntax = function complexEasingSyntax(ease) {
|
|
296
|
-
return convertToDash(ease).replace(/^ease-/,
|
|
297
|
-
.replace(/(\(|\s).+/,
|
|
302
|
+
return convertToDash(ease).replace(/^ease-/, '') // Remove the "ease-" keyword
|
|
303
|
+
.replace(/(\(|\s).+/, '') // Remove the function brackets and parameters
|
|
298
304
|
.toLowerCase().trim();
|
|
299
305
|
};
|
|
300
306
|
/** Re-maps a number from one range to another. Numbers outside the range are not clamped to 0 and 1, because out-of-range values are often intentional and useful. */
|
|
@@ -312,8 +318,8 @@ export var registerEasingFunction = function registerEasingFunction(key, fn) {
|
|
|
312
318
|
Object.assign(EasingFunctions, (_a = {}, _a[key] = fn, _a));
|
|
313
319
|
};
|
|
314
320
|
/**
|
|
315
|
-
* Allows you to register multiple new easing functions
|
|
316
|
-
*/
|
|
321
|
+
* Allows you to register multiple new easing functions
|
|
322
|
+
*/
|
|
317
323
|
|
|
318
324
|
export var registerEasingFunctions = function registerEasingFunctions() {
|
|
319
325
|
var obj = [];
|
package/es/utils/event.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isUndefined } from '@antv/util'; // use `self` instead of `window`, account for non-window contexts, such as in Web Workers
|
|
2
2
|
// @see https://developer.mozilla.org/en-US/docs/Web/API/Window/self
|
|
3
3
|
|
|
4
|
-
export var supportsTouchEvents =
|
|
4
|
+
export var supportsTouchEvents = !!self.TouchEvent;
|
|
5
5
|
export var supportsPointerEvents = !!self.PointerEvent;
|
|
6
6
|
export var MOUSE_POINTER_ID = 1;
|
|
7
7
|
export var TOUCH_TO_POINTER = {
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AnimationEffectTiming } from '../
|
|
2
|
-
import {
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function convertEffectInput(keyframes: ComputedKeyframe[], timing: AnimationEffectTiming, target: DisplayObject | null): (target: DisplayObject, fraction: number) => void;
|
|
1
|
+
import type { AnimationEffectTiming } from '../dom';
|
|
2
|
+
import type { IElement } from '../dom/interfaces';
|
|
3
|
+
export declare function convertEffectInput(keyframes: ComputedKeyframe[], timing: AnimationEffectTiming, target: IElement | null): (target: IElement, fraction: number) => void;
|
|
@@ -2,22 +2,6 @@ import { __read, __spreadArray } from "tslib";
|
|
|
2
2
|
import { container } from '../inversify.config';
|
|
3
3
|
import { StylePropertyMergerFactory, StylePropertyParserFactory } from '../property-handlers';
|
|
4
4
|
import { parseEasingFunction } from './animation';
|
|
5
|
-
/**
|
|
6
|
-
* handlers for valid properties
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
var propertyHandlers = {};
|
|
10
|
-
|
|
11
|
-
function addPropertyHandler(parser, merger, property) {
|
|
12
|
-
propertyHandlers[property] = propertyHandlers[property] || [];
|
|
13
|
-
propertyHandlers[property].push([parser, merger]);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function addPropertiesHandler(parser, merger, properties) {
|
|
17
|
-
for (var i = 0; i < properties.length; i++) {
|
|
18
|
-
addPropertyHandler(parser, merger, toCamelCase(properties[i]));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
5
|
export function convertEffectInput(keyframes, timing, target) {
|
|
22
6
|
var propertySpecificKeyframeGroups = makePropertySpecificKeyframeGroups(keyframes, timing);
|
|
23
7
|
var interpolations = makeInterpolations(propertySpecificKeyframeGroups, target);
|
package/es/utils/path.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { DisplayObject } from '../DisplayObject';
|
|
1
|
+
import type { DisplayObject } from '../display-objects/DisplayObject';
|
|
2
2
|
import { PathCommand } from '../types';
|
|
3
3
|
export declare function equalizeSegments(path1: PathCommand[], path2: PathCommand[], TL?: number): PathCommand[][];
|
|
4
4
|
export declare function getDrawDirection(pathArray: PathCommand[]): boolean;
|
|
5
5
|
export declare function getPathArea(pathArray: PathCommand[]): number;
|
|
6
6
|
export declare function reverseCurve(pathArray: PathCommand[]): PathCommand[];
|
|
7
7
|
export declare function clonePath(pathArray: PathCommand[]): PathCommand[];
|
|
8
|
-
export declare function getRotatedCurve(a: PathCommand[], b: PathCommand[]): (string[] | ["a" | "A", number, number, number, number, number, number, number] | ["
|
|
8
|
+
export declare function getRotatedCurve(a: PathCommand[], b: PathCommand[]): (string[] | ["a" | "A", number, number, number, number, number, number, number] | ["C" | "c", number, number, number, number, number, number] | ["o" | "O", number, number] | ["h" | "H", number] | ["l" | "L", number, number] | ["m" | "M", number, number] | ["r" | "R", number, number, number, number] | ["q" | "Q", number, number, number, number] | ["s" | "S", number, number, number, number, number, number, number] | ["t" | "T", number, number] | ["v" | "V", number] | ["u" | "U", number, number, number])[];
|
|
9
9
|
/**
|
|
10
10
|
* convert object to path, should account for:
|
|
11
11
|
* * transform & origin
|
package/lib/Canvas.d.ts
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import { CanvasConfig } from './types';
|
|
2
|
-
import { DisplayObject } from './DisplayObject';
|
|
2
|
+
import { DisplayObject } from './display-objects/DisplayObject';
|
|
3
3
|
import { ContextService } from './services';
|
|
4
4
|
import { RenderingService } from './services/RenderingService';
|
|
5
5
|
import { RenderingContext } from './services/RenderingContext';
|
|
6
6
|
import { EventService } from './services/EventService';
|
|
7
|
+
import { Camera } from './camera';
|
|
7
8
|
import { AbstractRenderer } from './AbstractRenderer';
|
|
8
|
-
import {
|
|
9
|
-
import { EventTarget } from './dom
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import type { PointLike } from './shapes';
|
|
10
|
+
import { Document, EventTarget } from './dom';
|
|
11
|
+
import type { IElement, INode, ICanvas } from './dom/interfaces';
|
|
12
|
+
import { CustomElementRegistry } from './dom/CustomElementRegistry';
|
|
13
|
+
export declare enum CanvasEvent {
|
|
14
|
+
READY = "ready",
|
|
15
|
+
BEFORE_RENDER = "beforerender",
|
|
16
|
+
AFTER_RENDER = "afterrender",
|
|
17
|
+
BEFORE_DESTROY = "beforedestroy",
|
|
18
|
+
AFTER_DESTROY = "afterdestroy"
|
|
14
19
|
}
|
|
15
20
|
/**
|
|
16
21
|
* can be treated like Window in DOM
|
|
17
22
|
*
|
|
18
23
|
* prototype chains: Canvas(Window) -> EventTarget
|
|
19
24
|
*/
|
|
20
|
-
export declare class Canvas extends EventTarget {
|
|
25
|
+
export declare class Canvas extends EventTarget implements ICanvas {
|
|
21
26
|
/**
|
|
22
27
|
* child container of current canvas, use hierarchy container
|
|
23
28
|
*/
|
|
@@ -26,6 +31,10 @@ export declare class Canvas extends EventTarget {
|
|
|
26
31
|
* window.document
|
|
27
32
|
*/
|
|
28
33
|
document: Document;
|
|
34
|
+
/**
|
|
35
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry
|
|
36
|
+
*/
|
|
37
|
+
customElements: CustomElementRegistry;
|
|
29
38
|
Element: typeof DisplayObject;
|
|
30
39
|
/**
|
|
31
40
|
* rAF in auto rendering
|
|
@@ -35,15 +44,16 @@ export declare class Canvas extends EventTarget {
|
|
|
35
44
|
private initRenderingContext;
|
|
36
45
|
private initDefaultCamera;
|
|
37
46
|
getConfig(): Partial<CanvasConfig>;
|
|
47
|
+
getContainer(): import("inversify/lib/container/container").Container;
|
|
38
48
|
/**
|
|
39
49
|
* get the root displayObject in scenegraph
|
|
40
50
|
* @alias this.document.documentElement
|
|
41
51
|
*/
|
|
42
|
-
getRoot(): import("
|
|
52
|
+
getRoot(): import(".").Group;
|
|
43
53
|
/**
|
|
44
54
|
* get the camera of canvas
|
|
45
55
|
*/
|
|
46
|
-
getCamera():
|
|
56
|
+
getCamera(): Camera;
|
|
47
57
|
getContextService(): ContextService<unknown>;
|
|
48
58
|
getEventService(): EventService;
|
|
49
59
|
getRenderingService(): RenderingService;
|
|
@@ -52,14 +62,15 @@ export declare class Canvas extends EventTarget {
|
|
|
52
62
|
destroy(destroyScenegraph?: boolean): void;
|
|
53
63
|
/**
|
|
54
64
|
* compatible with G 3.0
|
|
65
|
+
* @deprecated
|
|
66
|
+
* @alias resize
|
|
55
67
|
*/
|
|
56
68
|
changeSize(width: number, height: number): void;
|
|
57
69
|
resize(width: number, height: number): void;
|
|
58
|
-
appendChild(
|
|
59
|
-
insertBefore(
|
|
60
|
-
removeChild(
|
|
61
|
-
removeChildren(): void;
|
|
62
|
-
decorate(object: DisplayObject, renderingService: RenderingService, root: DisplayObject): void;
|
|
70
|
+
appendChild<T extends INode>(child: T, index?: number): T;
|
|
71
|
+
insertBefore<T extends INode>(newChild: T, refChild: IElement | null): T;
|
|
72
|
+
removeChild<T extends INode>(child: T, destroy?: boolean): T;
|
|
73
|
+
removeChildren(destroy?: boolean): void;
|
|
63
74
|
render(): void;
|
|
64
75
|
private run;
|
|
65
76
|
private initRenderer;
|
|
@@ -68,7 +79,18 @@ export declare class Canvas extends EventTarget {
|
|
|
68
79
|
setRenderer(renderer: AbstractRenderer): void;
|
|
69
80
|
private unmountChildren;
|
|
70
81
|
private mountChildren;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
82
|
+
client2Viewport(client: PointLike): PointLike;
|
|
83
|
+
viewport2Client(canvas: PointLike): PointLike;
|
|
84
|
+
viewport2Canvas(viewport: PointLike): PointLike;
|
|
85
|
+
canvas2Viewport(canvas: PointLike): PointLike;
|
|
86
|
+
/**
|
|
87
|
+
* @deprecated
|
|
88
|
+
* @alias client2Viewport
|
|
89
|
+
*/
|
|
90
|
+
getPointByClient(clientX: number, clientY: number): PointLike;
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated
|
|
93
|
+
* @alias viewport2Client
|
|
94
|
+
*/
|
|
95
|
+
getClientByPoint(x: number, y: number): PointLike;
|
|
74
96
|
}
|
package/lib/Canvas.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Canvas = void 0;
|
|
6
|
+
exports.Canvas = exports.CanvasEvent = void 0;
|
|
7
7
|
|
|
8
8
|
var _tslib = require("tslib");
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ var _types = require("./types");
|
|
|
11
11
|
|
|
12
12
|
var _canvas = require("./utils/canvas");
|
|
13
13
|
|
|
14
|
-
var _DisplayObject = require("./DisplayObject");
|
|
14
|
+
var _DisplayObject = require("./display-objects/DisplayObject");
|
|
15
15
|
|
|
16
16
|
var _services = require("./services");
|
|
17
17
|
|
|
@@ -23,25 +23,35 @@ var _RenderingContext = require("./services/RenderingContext");
|
|
|
23
23
|
|
|
24
24
|
var _EventService = require("./services/EventService");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _camera = require("./camera");
|
|
27
27
|
|
|
28
28
|
var _canvasModule = require("./canvas-module");
|
|
29
29
|
|
|
30
30
|
var _raf = require("./utils/raf");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _dom = require("./dom");
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _CustomElementRegistry = require("./dom/CustomElementRegistry");
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _components = require("./components");
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var CanvasEvent;
|
|
39
|
+
exports.CanvasEvent = CanvasEvent;
|
|
39
40
|
|
|
41
|
+
(function (CanvasEvent) {
|
|
42
|
+
CanvasEvent["READY"] = "ready";
|
|
43
|
+
CanvasEvent["BEFORE_RENDER"] = "beforerender";
|
|
44
|
+
CanvasEvent["AFTER_RENDER"] = "afterrender";
|
|
45
|
+
CanvasEvent["BEFORE_DESTROY"] = "beforedestroy";
|
|
46
|
+
CanvasEvent["AFTER_DESTROY"] = "afterdestroy";
|
|
47
|
+
})(CanvasEvent || (exports.CanvasEvent = CanvasEvent = {}));
|
|
40
48
|
/**
|
|
41
49
|
* can be treated like Window in DOM
|
|
42
50
|
*
|
|
43
51
|
* prototype chains: Canvas(Window) -> EventTarget
|
|
44
52
|
*/
|
|
53
|
+
|
|
54
|
+
|
|
45
55
|
var Canvas = function (_super) {
|
|
46
56
|
(0, _tslib.__extends)(Canvas, _super);
|
|
47
57
|
|
|
@@ -69,38 +79,55 @@ var Canvas = function (_super) {
|
|
|
69
79
|
}
|
|
70
80
|
|
|
71
81
|
Canvas.prototype.initRenderingContext = function (mergedConfig) {
|
|
82
|
+
var _this = this;
|
|
83
|
+
|
|
72
84
|
this.container.bind(_types.CanvasConfig).toConstantValue(mergedConfig);
|
|
73
|
-
this.document = new
|
|
74
|
-
this.document.defaultView = this;
|
|
85
|
+
this.document = new _dom.Document();
|
|
86
|
+
this.document.defaultView = this;
|
|
87
|
+
this.customElements = new _CustomElementRegistry.CustomElementRegistry(); // bind rendering context, shared by all renderers
|
|
75
88
|
|
|
76
89
|
this.container.bind(_RenderingContext.RenderingContext).toConstantValue({
|
|
77
90
|
/**
|
|
78
91
|
* the root node in scene graph
|
|
79
92
|
*/
|
|
80
93
|
root: this.document.documentElement,
|
|
81
|
-
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* removed render bounds
|
|
97
|
+
*/
|
|
98
|
+
removedRenderBoundsList: [],
|
|
82
99
|
renderReasons: new Set(),
|
|
83
100
|
force: false,
|
|
84
101
|
dirty: false
|
|
85
102
|
});
|
|
103
|
+
this.document.documentElement.addEventListener(_dom.ElementEvent.CHILD_INSERTED, function (e) {
|
|
104
|
+
_this.mountChildren(e.detail.child);
|
|
105
|
+
});
|
|
106
|
+
this.document.documentElement.addEventListener(_dom.ElementEvent.CHILD_REMOVED, function (e) {
|
|
107
|
+
_this.unmountChildren(e.detail.child);
|
|
108
|
+
});
|
|
86
109
|
};
|
|
87
110
|
|
|
88
111
|
Canvas.prototype.initDefaultCamera = function (width, height) {
|
|
89
112
|
// set a default ortho camera
|
|
90
|
-
var camera = new
|
|
113
|
+
var camera = new _camera.Camera().setPosition(width / 2, height / 2, 500).setFocalPoint(width / 2, height / 2, 0) // origin to be in the top left
|
|
91
114
|
.setOrthographic(width / -2, width / 2, height / -2, height / 2, 0.1, 1000); // redraw when camera changed
|
|
92
115
|
|
|
93
116
|
var context = this.container.get(_RenderingContext.RenderingContext);
|
|
94
|
-
camera.on(
|
|
117
|
+
camera.on(_camera.CAMERA_EVENT.Updated, function () {
|
|
95
118
|
context.renderReasons.add(_RenderingContext.RENDER_REASON.CameraChanged);
|
|
96
119
|
}); // bind camera
|
|
97
120
|
|
|
98
|
-
this.container.bind(
|
|
121
|
+
this.container.bind(_camera.DefaultCamera).toConstantValue(camera);
|
|
99
122
|
};
|
|
100
123
|
|
|
101
124
|
Canvas.prototype.getConfig = function () {
|
|
102
125
|
return this.container.get(_types.CanvasConfig);
|
|
103
126
|
};
|
|
127
|
+
|
|
128
|
+
Canvas.prototype.getContainer = function () {
|
|
129
|
+
return this.container;
|
|
130
|
+
};
|
|
104
131
|
/**
|
|
105
132
|
* get the root displayObject in scenegraph
|
|
106
133
|
* @alias this.document.documentElement
|
|
@@ -116,7 +143,7 @@ var Canvas = function (_super) {
|
|
|
116
143
|
|
|
117
144
|
|
|
118
145
|
Canvas.prototype.getCamera = function () {
|
|
119
|
-
return this.container.get(
|
|
146
|
+
return this.container.get(_camera.DefaultCamera);
|
|
120
147
|
};
|
|
121
148
|
|
|
122
149
|
Canvas.prototype.getContextService = function () {
|
|
@@ -140,13 +167,11 @@ var Canvas = function (_super) {
|
|
|
140
167
|
};
|
|
141
168
|
|
|
142
169
|
Canvas.prototype.destroy = function (destroyScenegraph) {
|
|
143
|
-
var _this = this;
|
|
144
|
-
|
|
145
170
|
if (destroyScenegraph === void 0) {
|
|
146
171
|
destroyScenegraph = true;
|
|
147
172
|
}
|
|
148
173
|
|
|
149
|
-
this.emit(
|
|
174
|
+
this.emit(CanvasEvent.BEFORE_DESTROY, function () {});
|
|
150
175
|
|
|
151
176
|
if (this.frameId) {
|
|
152
177
|
(0, _raf.cancelAnimationFrame)(this.frameId);
|
|
@@ -154,25 +179,22 @@ var Canvas = function (_super) {
|
|
|
154
179
|
|
|
155
180
|
|
|
156
181
|
var root = this.getRoot();
|
|
157
|
-
|
|
182
|
+
this.unmountChildren(root);
|
|
158
183
|
|
|
159
184
|
if (destroyScenegraph) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}); // destroy timeline
|
|
163
|
-
|
|
164
|
-
this.document.timeline.destroy();
|
|
165
|
-
} else {
|
|
166
|
-
this.unmountChildren(root);
|
|
185
|
+
// destroy Document
|
|
186
|
+
this.document.destroy();
|
|
167
187
|
} // destroy services
|
|
168
188
|
|
|
169
189
|
|
|
170
190
|
this.getContextService().destroy();
|
|
171
|
-
|
|
172
|
-
this.emit(
|
|
191
|
+
this.getRenderingService().destroy();
|
|
192
|
+
this.emit(CanvasEvent.AFTER_DESTROY, {});
|
|
173
193
|
};
|
|
174
194
|
/**
|
|
175
195
|
* compatible with G 3.0
|
|
196
|
+
* @deprecated
|
|
197
|
+
* @alias resize
|
|
176
198
|
*/
|
|
177
199
|
|
|
178
200
|
|
|
@@ -188,10 +210,10 @@ var Canvas = function (_super) {
|
|
|
188
210
|
|
|
189
211
|
this.getContextService().resize(width, height); // resize camera
|
|
190
212
|
|
|
191
|
-
var camera = this.container.get(
|
|
213
|
+
var camera = this.container.get(_camera.DefaultCamera);
|
|
192
214
|
var projectionMode = camera.getProjectionMode();
|
|
193
215
|
|
|
194
|
-
if (projectionMode ===
|
|
216
|
+
if (projectionMode === _camera.CAMERA_PROJECTION_MODE.ORTHOGRAPHIC) {
|
|
195
217
|
camera.setOrthographic(width / -2, width / 2, height / -2, height / 2, camera.getNear(), camera.getFar());
|
|
196
218
|
} else {
|
|
197
219
|
camera.setAspect(width / height);
|
|
@@ -199,46 +221,39 @@ var Canvas = function (_super) {
|
|
|
199
221
|
}; // proxy to document.documentElement
|
|
200
222
|
|
|
201
223
|
|
|
202
|
-
Canvas.prototype.appendChild = function (
|
|
203
|
-
return this.document.documentElement.appendChild(
|
|
224
|
+
Canvas.prototype.appendChild = function (child, index) {
|
|
225
|
+
return this.document.documentElement.appendChild(child, index);
|
|
204
226
|
};
|
|
205
227
|
|
|
206
|
-
Canvas.prototype.insertBefore = function (
|
|
207
|
-
return this.document.documentElement.insertBefore(
|
|
228
|
+
Canvas.prototype.insertBefore = function (newChild, refChild) {
|
|
229
|
+
return this.document.documentElement.insertBefore(newChild, refChild);
|
|
208
230
|
};
|
|
209
231
|
|
|
210
|
-
Canvas.prototype.removeChild = function (
|
|
211
|
-
|
|
212
|
-
|
|
232
|
+
Canvas.prototype.removeChild = function (child, destroy) {
|
|
233
|
+
if (destroy === void 0) {
|
|
234
|
+
destroy = true;
|
|
235
|
+
}
|
|
213
236
|
|
|
214
|
-
|
|
215
|
-
this.document.documentElement.removeChildren();
|
|
237
|
+
return this.document.documentElement.removeChild(child, destroy);
|
|
216
238
|
};
|
|
217
239
|
|
|
218
|
-
Canvas.prototype.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
_this.mountChild(child);
|
|
240
|
+
Canvas.prototype.removeChildren = function (destroy) {
|
|
241
|
+
if (destroy === void 0) {
|
|
242
|
+
destroy = true;
|
|
243
|
+
}
|
|
223
244
|
|
|
224
|
-
|
|
225
|
-
return _this.decorate(grandchild, renderingService, root);
|
|
226
|
-
});
|
|
227
|
-
child.on(_Element.DISPLAY_OBJECT_EVENT.ChildRemoved, function (grandchild) {
|
|
228
|
-
return _this.unmountChildren(grandchild);
|
|
229
|
-
});
|
|
230
|
-
});
|
|
245
|
+
this.document.documentElement.removeChildren(destroy);
|
|
231
246
|
};
|
|
232
247
|
|
|
233
248
|
Canvas.prototype.render = function () {
|
|
234
|
-
this.emit(
|
|
249
|
+
this.emit(CanvasEvent.BEFORE_RENDER, {});
|
|
235
250
|
|
|
236
251
|
if (this.container.isBound(_RenderingService.RenderingService)) {
|
|
237
252
|
var renderingService = this.container.get(_RenderingService.RenderingService);
|
|
238
253
|
renderingService.render();
|
|
239
254
|
}
|
|
240
255
|
|
|
241
|
-
this.emit(
|
|
256
|
+
this.emit(CanvasEvent.AFTER_RENDER, {});
|
|
242
257
|
};
|
|
243
258
|
|
|
244
259
|
Canvas.prototype.run = function () {
|
|
@@ -254,6 +269,8 @@ var Canvas = function (_super) {
|
|
|
254
269
|
};
|
|
255
270
|
|
|
256
271
|
Canvas.prototype.initRenderer = function (renderer) {
|
|
272
|
+
var _this = this;
|
|
273
|
+
|
|
257
274
|
if (!renderer) {
|
|
258
275
|
throw new Error('Renderer is required.');
|
|
259
276
|
}
|
|
@@ -265,12 +282,23 @@ var Canvas = function (_super) {
|
|
|
265
282
|
var contextService = this.container.get(_services.ContextService);
|
|
266
283
|
var renderingService = this.container.get(_RenderingService.RenderingService);
|
|
267
284
|
contextService.init();
|
|
268
|
-
renderingService.init()
|
|
285
|
+
renderingService.init().then(function () {
|
|
286
|
+
_this.emit(CanvasEvent.READY, {});
|
|
287
|
+
});
|
|
269
288
|
|
|
270
289
|
if (renderer.getConfig().enableAutoRendering) {
|
|
271
290
|
this.run();
|
|
272
|
-
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this.getRoot().forEach(function (node) {
|
|
294
|
+
var renderable = node.entity.getComponent(_components.Renderable);
|
|
273
295
|
|
|
296
|
+
if (renderable) {
|
|
297
|
+
renderable.renderBoundsDirty = true;
|
|
298
|
+
renderable.boundsDirty = true;
|
|
299
|
+
renderable.dirty = true; // element.emit(ElementEvent.BOUNDS_CHANGED, {});
|
|
300
|
+
}
|
|
301
|
+
}); // keep current scenegraph unchanged, just trigger mounted event
|
|
274
302
|
|
|
275
303
|
this.mountChildren(this.getRoot());
|
|
276
304
|
};
|
|
@@ -311,14 +339,18 @@ var Canvas = function (_super) {
|
|
|
311
339
|
this.initRenderer(renderer);
|
|
312
340
|
};
|
|
313
341
|
|
|
314
|
-
Canvas.prototype.unmountChildren = function (
|
|
315
|
-
var
|
|
316
|
-
|
|
342
|
+
Canvas.prototype.unmountChildren = function (parent) {
|
|
343
|
+
var path = [];
|
|
344
|
+
parent.forEach(function (child) {
|
|
317
345
|
if (child.isConnected) {
|
|
318
|
-
|
|
319
|
-
child.isConnected = false;
|
|
320
|
-
child.ownerDocument = null;
|
|
346
|
+
path.push(child);
|
|
321
347
|
}
|
|
348
|
+
}); // unmount from leaf to root
|
|
349
|
+
|
|
350
|
+
path.reverse().forEach(function (child) {
|
|
351
|
+
child.emit(_dom.ElementEvent.UNMOUNTED, {});
|
|
352
|
+
child.ownerDocument = null;
|
|
353
|
+
child.isConnected = false;
|
|
322
354
|
});
|
|
323
355
|
};
|
|
324
356
|
|
|
@@ -326,31 +358,56 @@ var Canvas = function (_super) {
|
|
|
326
358
|
var _this = this;
|
|
327
359
|
|
|
328
360
|
parent.forEach(function (child) {
|
|
329
|
-
|
|
361
|
+
if (!child.isConnected) {
|
|
362
|
+
child.ownerDocument = _this.document;
|
|
363
|
+
child.isConnected = true;
|
|
364
|
+
debugger;
|
|
365
|
+
child.emit(_dom.ElementEvent.MOUNTED, {});
|
|
366
|
+
}
|
|
330
367
|
});
|
|
331
368
|
};
|
|
332
369
|
|
|
333
|
-
Canvas.prototype.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
child.isConnected = true;
|
|
340
|
-
}
|
|
370
|
+
Canvas.prototype.client2Viewport = function (client) {
|
|
371
|
+
return this.getEventService().client2Viewport(client);
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
Canvas.prototype.viewport2Client = function (canvas) {
|
|
375
|
+
return this.getEventService().viewport2Client(canvas);
|
|
341
376
|
};
|
|
342
377
|
|
|
378
|
+
Canvas.prototype.viewport2Canvas = function (viewport) {
|
|
379
|
+
return this.getEventService().viewport2Canvas(viewport);
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
Canvas.prototype.canvas2Viewport = function (canvas) {
|
|
383
|
+
return this.getEventService().canvas2Viewport(canvas);
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* @deprecated
|
|
387
|
+
* @alias client2Viewport
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
|
|
343
391
|
Canvas.prototype.getPointByClient = function (clientX, clientY) {
|
|
344
|
-
|
|
345
|
-
|
|
392
|
+
return this.client2Viewport({
|
|
393
|
+
x: clientX,
|
|
394
|
+
y: clientY
|
|
395
|
+
});
|
|
346
396
|
};
|
|
397
|
+
/**
|
|
398
|
+
* @deprecated
|
|
399
|
+
* @alias viewport2Client
|
|
400
|
+
*/
|
|
401
|
+
|
|
347
402
|
|
|
348
403
|
Canvas.prototype.getClientByPoint = function (x, y) {
|
|
349
|
-
|
|
350
|
-
|
|
404
|
+
return this.viewport2Client({
|
|
405
|
+
x: x,
|
|
406
|
+
y: y
|
|
407
|
+
});
|
|
351
408
|
};
|
|
352
409
|
|
|
353
410
|
return Canvas;
|
|
354
|
-
}(
|
|
411
|
+
}(_dom.EventTarget);
|
|
355
412
|
|
|
356
413
|
exports.Canvas = Canvas;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { DisplayObject } from './
|
|
1
|
+
import type { DisplayObject } from './display-objects';
|
|
2
2
|
export declare class DisplayObjectPool {
|
|
3
3
|
private pool;
|
|
4
4
|
getByName(name: string): DisplayObject;
|
|
5
5
|
add(name: string, groupOrShape: DisplayObject): void;
|
|
6
|
+
remove(name: string): void;
|
|
6
7
|
}
|
package/lib/DisplayObjectPool.js
CHANGED
|
@@ -22,6 +22,10 @@ var DisplayObjectPool = function () {
|
|
|
22
22
|
this.pool[name] = groupOrShape;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
DisplayObjectPool.prototype.remove = function (name) {
|
|
26
|
+
delete this.pool[name];
|
|
27
|
+
};
|
|
28
|
+
|
|
25
29
|
DisplayObjectPool = (0, _tslib.__decorate)([(0, _inversify.injectable)()], DisplayObjectPool);
|
|
26
30
|
return DisplayObjectPool;
|
|
27
31
|
}();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { mat4, vec3 } from 'gl-matrix';
|
|
3
|
-
import Landmark from './Landmark';
|
|
4
|
-
import { Frustum } from '
|
|
3
|
+
import { Landmark } from './Landmark';
|
|
4
|
+
import { Frustum } from '../shapes';
|
|
5
5
|
export declare const DefaultCamera = "DefaultCamera";
|
|
6
6
|
export declare enum CAMERA_TYPE {
|
|
7
7
|
ORBITING = "ORBITING",
|
|
@@ -108,7 +108,8 @@ export declare class Camera extends EventEmitter {
|
|
|
108
108
|
private rright;
|
|
109
109
|
private top;
|
|
110
110
|
private bottom;
|
|
111
|
-
private
|
|
111
|
+
private projectionMatrix;
|
|
112
|
+
private projectionMatrixInverse;
|
|
112
113
|
private jitteredProjectionMatrix;
|
|
113
114
|
private view;
|
|
114
115
|
private following;
|
|
@@ -131,8 +132,10 @@ export declare class Camera extends EventEmitter {
|
|
|
131
132
|
clone(): Camera;
|
|
132
133
|
getProjectionMode(): CAMERA_PROJECTION_MODE;
|
|
133
134
|
getPerspective(): mat4;
|
|
135
|
+
getPerspectiveInverse(): mat4;
|
|
134
136
|
getFrustum(): Frustum;
|
|
135
137
|
getPosition(): vec3;
|
|
138
|
+
getFocalPoint(): vec3;
|
|
136
139
|
getNear(): number;
|
|
137
140
|
getFar(): number;
|
|
138
141
|
getZoom(): number;
|