@antv/g 5.0.17 → 5.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.umd.min.js +31 -0
- package/es/AbstractRenderer.js +3 -1
- package/es/Canvas.d.ts +4 -1
- package/es/Canvas.js +4 -2
- package/es/DisplayObjectPool.js +3 -1
- package/es/camera/Camera.js +3 -1
- package/es/camera/Landmark.js +3 -1
- package/es/components/Cullable.js +3 -1
- package/es/components/Geometry.js +3 -1
- package/es/components/Renderable.js +3 -1
- package/es/components/Sortable.js +3 -1
- package/es/components/Transform.js +3 -1
- package/es/display-objects/Circle.js +3 -1
- package/es/display-objects/CustomElement.js +3 -1
- package/es/display-objects/DisplayObject.js +6 -3
- package/es/display-objects/Ellipse.js +3 -1
- package/es/display-objects/Group.js +3 -1
- package/es/display-objects/HTML.js +6 -3
- package/es/display-objects/Image.js +3 -1
- package/es/display-objects/Line.js +3 -1
- package/es/display-objects/Path.js +3 -1
- package/es/display-objects/Polygon.js +3 -1
- package/es/display-objects/Polyline.js +3 -1
- package/es/display-objects/Rect.js +3 -1
- package/es/display-objects/Text.js +6 -3
- package/es/dom/Animation.js +4 -2
- package/es/dom/AnimationEffectTiming.js +3 -1
- package/es/dom/AnimationEvent.js +3 -1
- package/es/dom/AnimationTimeline.js +3 -1
- package/es/dom/CustomElementRegistry.js +3 -1
- package/es/dom/CustomEvent.js +3 -1
- package/es/dom/Document.js +3 -1
- package/es/dom/Element.d.ts +6 -0
- package/es/dom/Element.js +16 -5
- package/es/dom/EventTarget.js +5 -3
- package/es/dom/FederatedEvent.d.ts +2 -2
- package/es/dom/FederatedEvent.js +3 -1
- package/es/dom/FederatedMouseEvent.js +3 -1
- package/es/dom/FederatedPointerEvent.js +3 -1
- package/es/dom/FederatedWheelEvent.js +3 -1
- package/es/dom/KeyframeEffect.js +3 -1
- package/es/dom/KeyframeList.js +1 -1
- package/es/dom/MutationEvent.js +3 -1
- package/es/dom/MutationObserver.js +10 -3
- package/es/dom/MutationRecord.js +3 -1
- package/es/dom/Node.js +4 -2
- package/es/dom/interfaces.d.ts +3 -0
- package/es/plugins/CullingPlugin.js +3 -1
- package/es/plugins/DirtyCheckPlugin.js +3 -1
- package/es/plugins/EventPlugin.d.ts +1 -1
- package/es/plugins/EventPlugin.js +3 -1
- package/es/plugins/FrustumCullingStrategy.js +6 -3
- package/es/plugins/PrepareRendererPlugin.js +3 -1
- package/es/property-handlers/color.js +2 -2
- package/es/property-handlers/dimension.js +1 -1
- package/es/property-handlers/path.d.ts +1 -1
- package/es/property-handlers/text.js +1 -1
- package/es/services/EventService.js +13 -5
- package/es/services/RenderingService.d.ts +12 -2
- package/es/services/RenderingService.js +24 -5
- package/es/services/SceneGraphSelector.js +3 -1
- package/es/services/SceneGraphService.js +11 -11
- package/es/services/aabb/CircleUpdater.js +3 -1
- package/es/services/aabb/EllipseUpdater.js +3 -1
- package/es/services/aabb/LineUpdater.js +3 -1
- package/es/services/aabb/PathUpdater.js +3 -1
- package/es/services/aabb/PolylineUpdater.js +3 -1
- package/es/services/aabb/RectUpdater.js +3 -1
- package/es/services/aabb/TextUpdater.js +15 -1
- package/es/services/text/OffscreenCanvasCreator.js +3 -1
- package/es/services/text/index.js +5 -3
- package/es/shapes/AABB.js +8 -1
- package/es/shapes/BoundingSphere.js +3 -1
- package/es/shapes/Frustum.js +3 -1
- package/es/shapes/Plane.js +3 -1
- package/es/shapes/Point.js +3 -1
- package/es/shapes/Polygon.js +3 -1
- package/es/shapes/Ray.js +3 -1
- package/es/shapes/Rect.js +3 -1
- package/es/shapes/Rectangle.js +3 -1
- package/es/utils/custom-easing.js +1 -1
- package/es/utils/event.js +6 -5
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/path.d.ts +1 -1
- package/es/utils/path.js +3 -3
- package/es/utils/text.js +3 -3
- package/lib/AbstractRenderer.js +3 -1
- package/lib/Canvas.d.ts +4 -1
- package/lib/Canvas.js +5 -3
- package/lib/DisplayObjectPool.js +3 -1
- package/lib/camera/Camera.js +4 -2
- package/lib/camera/Landmark.js +3 -1
- package/lib/components/Cullable.js +4 -2
- package/lib/components/Geometry.js +3 -1
- package/lib/components/Renderable.js +3 -1
- package/lib/components/Sortable.js +3 -1
- package/lib/components/Transform.js +3 -1
- package/lib/display-objects/Circle.js +3 -1
- package/lib/display-objects/CustomElement.js +3 -1
- package/lib/display-objects/DisplayObject.js +6 -3
- package/lib/display-objects/Ellipse.js +3 -1
- package/lib/display-objects/Group.js +3 -1
- package/lib/display-objects/HTML.js +6 -4
- package/lib/display-objects/Image.js +3 -1
- package/lib/display-objects/Line.js +3 -1
- package/lib/display-objects/Path.js +3 -1
- package/lib/display-objects/Polygon.js +3 -1
- package/lib/display-objects/Polyline.js +3 -1
- package/lib/display-objects/Rect.js +3 -1
- package/lib/display-objects/Text.js +6 -4
- package/lib/dom/Animation.js +4 -2
- package/lib/dom/AnimationEffectTiming.js +3 -1
- package/lib/dom/AnimationEvent.js +3 -1
- package/lib/dom/AnimationTimeline.js +4 -2
- package/lib/dom/CustomElementRegistry.js +3 -1
- package/lib/dom/CustomEvent.js +3 -1
- package/lib/dom/Document.js +3 -1
- package/lib/dom/Element.d.ts +6 -0
- package/lib/dom/Element.js +16 -5
- package/lib/dom/EventTarget.js +5 -3
- package/lib/dom/FederatedEvent.d.ts +2 -2
- package/lib/dom/FederatedEvent.js +3 -1
- package/lib/dom/FederatedMouseEvent.js +3 -1
- package/lib/dom/FederatedPointerEvent.js +3 -1
- package/lib/dom/FederatedWheelEvent.js +3 -1
- package/lib/dom/KeyframeEffect.js +4 -2
- package/lib/dom/KeyframeList.js +1 -1
- package/lib/dom/MutationEvent.js +3 -1
- package/lib/dom/MutationObserver.js +11 -4
- package/lib/dom/MutationRecord.js +3 -1
- package/lib/dom/Node.js +4 -2
- package/lib/dom/interfaces.d.ts +3 -0
- package/lib/global-module.js +3 -2
- package/lib/index.js +1 -1
- package/lib/plugins/CullingPlugin.js +4 -2
- package/lib/plugins/DirtyCheckPlugin.js +3 -1
- package/lib/plugins/EventPlugin.d.ts +1 -1
- package/lib/plugins/EventPlugin.js +3 -1
- package/lib/plugins/FrustumCullingStrategy.js +5 -2
- package/lib/plugins/PrepareRendererPlugin.js +3 -1
- package/lib/property-handlers/color.js +5 -5
- package/lib/property-handlers/dimension.js +6 -5
- package/lib/property-handlers/inherit.js +1 -1
- package/lib/property-handlers/interfaces.js +1 -1
- package/lib/property-handlers/numeric.js +3 -3
- package/lib/property-handlers/path.d.ts +1 -1
- package/lib/property-handlers/path.js +1 -1
- package/lib/property-handlers/text.js +1 -1
- package/lib/property-handlers/transform.js +1 -1
- package/lib/services/EventService.js +13 -5
- package/lib/services/RenderingService.d.ts +12 -2
- package/lib/services/RenderingService.js +25 -5
- package/lib/services/SceneGraphSelector.js +4 -2
- package/lib/services/SceneGraphService.js +13 -17
- package/lib/services/aabb/CircleUpdater.js +3 -1
- package/lib/services/aabb/EllipseUpdater.js +3 -1
- package/lib/services/aabb/LineUpdater.js +3 -1
- package/lib/services/aabb/PathUpdater.js +3 -1
- package/lib/services/aabb/PolylineUpdater.js +3 -1
- package/lib/services/aabb/RectUpdater.js +3 -1
- package/lib/services/aabb/TextUpdater.js +15 -1
- package/lib/services/aabb/index.js +10 -10
- package/lib/services/aabb/interfaces.js +1 -1
- package/lib/services/text/OffscreenCanvasCreator.js +3 -1
- package/lib/services/text/index.js +5 -3
- package/lib/shapes/AABB.js +8 -1
- package/lib/shapes/BoundingSphere.js +3 -1
- package/lib/shapes/Frustum.js +4 -2
- package/lib/shapes/Plane.js +3 -1
- package/lib/shapes/Point.js +3 -1
- package/lib/shapes/Polygon.js +3 -1
- package/lib/shapes/Ray.js +3 -1
- package/lib/shapes/Rect.js +3 -1
- package/lib/shapes/Rectangle.js +3 -1
- package/lib/types.js +1 -1
- package/lib/utils/animation.js +3 -2
- package/lib/utils/bezier-easing.js +1 -1
- package/lib/utils/custom-easing.js +2 -2
- package/lib/utils/event.js +9 -7
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/math.js +5 -5
- package/lib/utils/path.d.ts +1 -1
- package/lib/utils/path.js +6 -6
- package/lib/utils/raf.js +2 -1
- package/lib/utils/text.js +3 -3
- package/package.json +3 -3
- package/es/display-objects/TSpan.d.ts +0 -1
- package/es/display-objects/TSpan.js +0 -0
- package/lib/display-objects/TSpan.d.ts +0 -1
- package/lib/display-objects/TSpan.js +0 -1
|
@@ -5,7 +5,9 @@ import { MutationRecord } from './MutationRecord';
|
|
|
5
5
|
var uidCounter = 0;
|
|
6
6
|
var registrationsTable = new WeakMap();
|
|
7
7
|
|
|
8
|
-
var Registration =
|
|
8
|
+
var Registration =
|
|
9
|
+
/** @class */
|
|
10
|
+
function () {
|
|
9
11
|
function Registration(observer, target, options) {
|
|
10
12
|
this.observer = observer;
|
|
11
13
|
this.target = target;
|
|
@@ -195,7 +197,9 @@ export { Registration };
|
|
|
195
197
|
* @see https://github.com/googlearchive/MutationObservers/blob/master/MutationObserver.js
|
|
196
198
|
*/
|
|
197
199
|
|
|
198
|
-
var MutationObserver =
|
|
200
|
+
var MutationObserver =
|
|
201
|
+
/** @class */
|
|
202
|
+
function () {
|
|
199
203
|
function MutationObserver(callback) {
|
|
200
204
|
this.callback = callback;
|
|
201
205
|
this.nodes = [];
|
|
@@ -205,7 +209,10 @@ var MutationObserver = function () {
|
|
|
205
209
|
|
|
206
210
|
MutationObserver.prototype.observe = function (target, options) {
|
|
207
211
|
// 1.1
|
|
208
|
-
if (!options.childList && !options.attributes && !options.characterData ||
|
|
212
|
+
if (!options.childList && !options.attributes && !options.characterData || // 1.2
|
|
213
|
+
options.attributeOldValue && !options.attributes || // 1.3
|
|
214
|
+
options.attributeFilter && options.attributeFilter.length && !options.attributes || // 1.4
|
|
215
|
+
options.characterDataOldValue && !options.characterData) {
|
|
209
216
|
throw new SyntaxError();
|
|
210
217
|
}
|
|
211
218
|
|
package/es/dom/MutationRecord.js
CHANGED
package/es/dom/Node.js
CHANGED
|
@@ -6,7 +6,9 @@ import { EventTarget } from './EventTarget';
|
|
|
6
6
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
var Node =
|
|
9
|
+
var Node =
|
|
10
|
+
/** @class */
|
|
11
|
+
function (_super) {
|
|
10
12
|
__extends(Node, _super);
|
|
11
13
|
|
|
12
14
|
function Node() {
|
|
@@ -115,7 +117,7 @@ var Node = function (_super) {
|
|
|
115
117
|
|
|
116
118
|
if (this.nodeName === Shape.TEXT) {
|
|
117
119
|
// @ts-ignore
|
|
118
|
-
this.style.text = ""
|
|
120
|
+
this.style.text = "".concat(content);
|
|
119
121
|
} else {// this.appendChild(
|
|
120
122
|
// new Text({
|
|
121
123
|
// style: {
|
package/es/dom/interfaces.d.ts
CHANGED
|
@@ -303,6 +303,8 @@ export interface IElement<StyleProps = any, ParsedStyleProps = any> extends INod
|
|
|
303
303
|
getElementsByTagName: <E extends IElement = IElement>(tagName: string) => E[];
|
|
304
304
|
scrollLeft: number;
|
|
305
305
|
scrollTop: number;
|
|
306
|
+
clientLeft: number;
|
|
307
|
+
clientTop: number;
|
|
306
308
|
/**
|
|
307
309
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
|
|
308
310
|
*/
|
|
@@ -315,6 +317,7 @@ export interface IElement<StyleProps = any, ParsedStyleProps = any> extends INod
|
|
|
315
317
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
|
|
316
318
|
*/
|
|
317
319
|
removeAttribute: (attributeName: keyof StyleProps) => void;
|
|
320
|
+
hasAttribute: (qualifiedName: string) => boolean;
|
|
318
321
|
}
|
|
319
322
|
export interface IDocument extends INode, IParentNode {
|
|
320
323
|
/**
|
|
@@ -8,7 +8,9 @@ export var CullingStrategyContribution = Syringe.defineToken('CullingStrategyCon
|
|
|
8
8
|
* 2. other custom culling strategies, eg. frustum culling
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
var CullingPlugin =
|
|
11
|
+
var CullingPlugin =
|
|
12
|
+
/** @class */
|
|
13
|
+
function () {
|
|
12
14
|
function CullingPlugin() {}
|
|
13
15
|
|
|
14
16
|
CullingPlugin_1 = CullingPlugin;
|
|
@@ -7,7 +7,9 @@ import { RenderingContext, RenderReason } from '../services/RenderingContext';
|
|
|
7
7
|
* Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
var DirtyCheckPlugin =
|
|
10
|
+
var DirtyCheckPlugin =
|
|
11
|
+
/** @class */
|
|
12
|
+
function () {
|
|
11
13
|
function DirtyCheckPlugin() {}
|
|
12
14
|
|
|
13
15
|
DirtyCheckPlugin_1 = DirtyCheckPlugin;
|
|
@@ -14,7 +14,9 @@ import { normalizeToPointerEvent, supportsTouchEvents, TOUCH_TO_POINTER } from '
|
|
|
14
14
|
* also provide some extra events such as `drag`
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
var EventPlugin =
|
|
17
|
+
var EventPlugin =
|
|
18
|
+
/** @class */
|
|
19
|
+
function () {
|
|
18
20
|
function EventPlugin() {
|
|
19
21
|
var _this = this;
|
|
20
22
|
|
|
@@ -2,16 +2,19 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { inject, singleton } from 'mana-syringe';
|
|
3
3
|
import { vec3 } from 'gl-matrix';
|
|
4
4
|
import { CullingStrategyContribution } from './CullingPlugin';
|
|
5
|
-
import { Mask } from '../shapes';
|
|
5
|
+
import { AABB, Mask } from '../shapes';
|
|
6
6
|
import { DefaultCamera, Camera } from '../camera/Camera';
|
|
7
7
|
import { Shape } from '..'; // group is not a 2d shape
|
|
8
8
|
|
|
9
9
|
var shape2D = [Shape.CIRCLE, Shape.ELLIPSE, Shape.IMAGE, Shape.RECT, Shape.LINE, Shape.POLYLINE, Shape.POLYGON, Shape.TEXT, Shape.PATH, Shape.HTML];
|
|
10
10
|
|
|
11
|
-
var FrustumCullingStrategy =
|
|
11
|
+
var FrustumCullingStrategy =
|
|
12
|
+
/** @class */
|
|
13
|
+
function () {
|
|
12
14
|
function FrustumCullingStrategy() {}
|
|
13
15
|
|
|
14
16
|
FrustumCullingStrategy.prototype.isVisible = function (object) {
|
|
17
|
+
// return true;
|
|
15
18
|
var _a, _b;
|
|
16
19
|
|
|
17
20
|
var cullable = object.cullable;
|
|
@@ -22,7 +25,7 @@ var FrustumCullingStrategy = function () {
|
|
|
22
25
|
|
|
23
26
|
var renderBounds = object.getRenderBounds();
|
|
24
27
|
|
|
25
|
-
if (
|
|
28
|
+
if (AABB.isEmpty(renderBounds)) {
|
|
26
29
|
return false;
|
|
27
30
|
} // get VP matrix from camera
|
|
28
31
|
|
|
@@ -6,7 +6,9 @@ import { INHERIT_PROPERTIES } from '../global-module';
|
|
|
6
6
|
import { computeInheritStyleProperty } from '../property-handlers';
|
|
7
7
|
import { RenderingContext, RenderReason, RenderingPluginContribution, dirtifyToRoot } from '../services';
|
|
8
8
|
|
|
9
|
-
var PrepareRendererPlugin =
|
|
9
|
+
var PrepareRendererPlugin =
|
|
10
|
+
/** @class */
|
|
11
|
+
function () {
|
|
10
12
|
function PrepareRendererPlugin() {}
|
|
11
13
|
|
|
12
14
|
PrepareRendererPlugin_1 = PrepareRendererPlugin;
|
|
@@ -84,7 +84,7 @@ export function parseColor(colorStr) {
|
|
|
84
84
|
return {
|
|
85
85
|
type: PARSED_COLOR_TYPE.Constant,
|
|
86
86
|
value: rgba,
|
|
87
|
-
formatted: color && "rgba("
|
|
87
|
+
formatted: color && "rgba(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ",").concat(color.opacity, ")") || 'rgba(0,0,0,0)'
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
export function mergeColors(left, right) {
|
|
@@ -103,7 +103,7 @@ export function mergeColors(left, right) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
rgba[3] = clamp(rgba[3], 0, 1);
|
|
106
|
-
return "rgba("
|
|
106
|
+
return "rgba(".concat(rgba.join(','), ")");
|
|
107
107
|
}];
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -13,7 +13,7 @@ function isAngleUnit(unit) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function parseDimension(unitRegExp, string, object, name) {
|
|
16
|
-
string =
|
|
16
|
+
string = "".concat(string).trim().toLowerCase();
|
|
17
17
|
|
|
18
18
|
if (string === 'inherit') {
|
|
19
19
|
var computed = computeInheritStyleProperty(object, name);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { PathCommand } from '../types';
|
|
2
2
|
import type { ParsedPathStyleProps } from '../display-objects';
|
|
3
3
|
export declare function parsePath(path: string): ParsedPathStyleProps;
|
|
4
|
-
export declare function mergePaths(left: ParsedPathStyleProps, right: ParsedPathStyleProps): ((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] | ["
|
|
4
|
+
export declare function mergePaths(left: ParsedPathStyleProps, right: ParsedPathStyleProps): ((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])[] | ((pathArray: PathCommand[]) => PathCommand[]))[];
|
|
@@ -13,7 +13,9 @@ import { ContextService } from './ContextService';
|
|
|
13
13
|
import { mat4, vec3 } from 'gl-matrix';
|
|
14
14
|
var PROPAGATION_LIMIT = 2048;
|
|
15
15
|
|
|
16
|
-
var EventService =
|
|
16
|
+
var EventService =
|
|
17
|
+
/** @class */
|
|
18
|
+
function (_super) {
|
|
17
19
|
__extends(EventService, _super);
|
|
18
20
|
|
|
19
21
|
function EventService() {
|
|
@@ -475,6 +477,12 @@ var EventService = function (_super) {
|
|
|
475
477
|
}
|
|
476
478
|
|
|
477
479
|
EventService.prototype.init = function () {
|
|
480
|
+
// this.onPointerDown = this.onPointerDown.bind(this);
|
|
481
|
+
// this.onPointerMove = this.onPointerUp.bind(this);
|
|
482
|
+
// this.onPointerMove = this.onPointerMove.bind(this);
|
|
483
|
+
// this.onPointerUp = this.onPointerUp.bind(this);
|
|
484
|
+
// this.onPointerOut = this.onPointerOut.bind(this);
|
|
485
|
+
// this.onWheel = this.onWheel.bind(this);
|
|
478
486
|
this.rootTarget = this.renderingContext.root.parentNode; // document
|
|
479
487
|
|
|
480
488
|
this.addEventMapping('pointerdown', this.onPointerDown);
|
|
@@ -559,7 +567,7 @@ var EventService = function (_super) {
|
|
|
559
567
|
mappers[i].fn(e);
|
|
560
568
|
}
|
|
561
569
|
} else {
|
|
562
|
-
console.warn("[EventService]: Event mapping not defined for "
|
|
570
|
+
console.warn("[EventService]: Event mapping not defined for ".concat(e.type));
|
|
563
571
|
}
|
|
564
572
|
};
|
|
565
573
|
|
|
@@ -849,7 +857,7 @@ var EventService = function (_super) {
|
|
|
849
857
|
|
|
850
858
|
EventService.prototype.notifyTarget = function (e, type) {
|
|
851
859
|
type = type !== null && type !== void 0 ? type : e.type;
|
|
852
|
-
var key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? type
|
|
860
|
+
var key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? "".concat(type, "capture") : type;
|
|
853
861
|
this.notifyListeners(e, key);
|
|
854
862
|
|
|
855
863
|
if (e.eventPhase === e.AT_TARGET) {
|
|
@@ -869,14 +877,14 @@ var EventService = function (_super) {
|
|
|
869
877
|
emitter.removeListener(type, listeners.fn, undefined, true);
|
|
870
878
|
}
|
|
871
879
|
|
|
872
|
-
listeners.fn.call(listeners.context, e);
|
|
880
|
+
listeners.fn.call(e.currentTarget || listeners.context, e); // listeners.fn.call(listeners.context, e);
|
|
873
881
|
} else {
|
|
874
882
|
for (var i = 0; i < listeners.length && !e.propagationImmediatelyStopped; i++) {
|
|
875
883
|
if (listeners[i].once) {
|
|
876
884
|
emitter.removeListener(type, listeners[i].fn, undefined, true);
|
|
877
885
|
}
|
|
878
886
|
|
|
879
|
-
listeners[i].fn.call(listeners[i].context, e);
|
|
887
|
+
listeners[i].fn.call(e.currentTarget || listeners[i].context, e); // listeners[i].fn.call(listeners[i].context, e);
|
|
880
888
|
}
|
|
881
889
|
}
|
|
882
890
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Syringe } from 'mana-syringe';
|
|
2
2
|
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from 'tapable';
|
|
3
|
-
import type { DisplayObject } from '..';
|
|
3
|
+
import type { CanvasConfig, DisplayObject } from '..';
|
|
4
4
|
import type { EventPosition, InteractivePointerEvent } from '../types';
|
|
5
5
|
export interface RenderingPlugin {
|
|
6
6
|
apply: (renderer: RenderingService) => void;
|
|
@@ -48,10 +48,20 @@ export declare class RenderingService {
|
|
|
48
48
|
};
|
|
49
49
|
init(): Promise<void>;
|
|
50
50
|
getStats(): {
|
|
51
|
+
/**
|
|
52
|
+
* total display objects in scenegraph
|
|
53
|
+
*/
|
|
51
54
|
total: number;
|
|
55
|
+
/**
|
|
56
|
+
* number of display objects need to render in current frame
|
|
57
|
+
*/
|
|
52
58
|
rendered: number;
|
|
59
|
+
/**
|
|
60
|
+
* number of display objects displayed on screen
|
|
61
|
+
*/
|
|
62
|
+
renderedOnscreen: number;
|
|
53
63
|
};
|
|
54
|
-
render(): void;
|
|
64
|
+
render(canvasConfig: Partial<CanvasConfig>): void;
|
|
55
65
|
private renderDisplayObject;
|
|
56
66
|
destroy(): void;
|
|
57
67
|
dirtify(): void;
|
|
@@ -15,12 +15,26 @@ export var RenderingPluginContribution = Syringe.defineToken('RenderingPluginCon
|
|
|
15
15
|
* * end frame
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
var RenderingService =
|
|
18
|
+
var RenderingService =
|
|
19
|
+
/** @class */
|
|
20
|
+
function () {
|
|
19
21
|
function RenderingService() {
|
|
20
22
|
this.inited = false;
|
|
21
23
|
this.stats = {
|
|
24
|
+
/**
|
|
25
|
+
* total display objects in scenegraph
|
|
26
|
+
*/
|
|
22
27
|
total: 0,
|
|
23
|
-
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* number of display objects need to render in current frame
|
|
31
|
+
*/
|
|
32
|
+
rendered: 0,
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* number of display objects displayed on screen
|
|
36
|
+
*/
|
|
37
|
+
renderedOnscreen: 0
|
|
24
38
|
};
|
|
25
39
|
this.zIndexCounter = 0;
|
|
26
40
|
this.hooks = {
|
|
@@ -79,7 +93,7 @@ var RenderingService = function () {
|
|
|
79
93
|
return this.stats;
|
|
80
94
|
};
|
|
81
95
|
|
|
82
|
-
RenderingService.prototype.render = function () {
|
|
96
|
+
RenderingService.prototype.render = function (canvasConfig) {
|
|
83
97
|
this.stats.total = 0;
|
|
84
98
|
this.stats.rendered = 0;
|
|
85
99
|
this.zIndexCounter = 0;
|
|
@@ -88,13 +102,18 @@ var RenderingService = function () {
|
|
|
88
102
|
if (this.renderingContext.renderReasons.size && this.inited) {
|
|
89
103
|
this.renderDisplayObject(this.renderingContext.root);
|
|
90
104
|
|
|
91
|
-
if (this.renderingContext.dirty) {
|
|
105
|
+
if (this.renderingContext.dirty || canvasConfig.renderer.getConfig().enableDirtyRectangleRendering && this.stats.total === 1) {
|
|
106
|
+
if (!this.renderingContext.dirty) {
|
|
107
|
+
this.hooks.beginFrame.call();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this.stats.renderedOnscreen = this.stats.rendered;
|
|
92
111
|
this.hooks.endFrame.call();
|
|
93
112
|
this.renderingContext.dirty = false;
|
|
94
113
|
}
|
|
95
114
|
|
|
96
115
|
this.renderingContext.renderReasons.clear();
|
|
97
|
-
} // console.log('
|
|
116
|
+
} // console.log('stats', this.stats);
|
|
98
117
|
|
|
99
118
|
};
|
|
100
119
|
|
|
@@ -12,7 +12,9 @@ export var SceneGraphSelector = Syringe.defineToken('SceneGraphSelector', {
|
|
|
12
12
|
* * getElementsByTag
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
var DefaultSceneGraphSelector =
|
|
15
|
+
var DefaultSceneGraphSelector =
|
|
16
|
+
/** @class */
|
|
17
|
+
function () {
|
|
16
18
|
function DefaultSceneGraphSelector() {}
|
|
17
19
|
|
|
18
20
|
DefaultSceneGraphSelector.prototype.selectOne = function (query, root) {
|
|
@@ -52,7 +52,9 @@ export var SceneGraphService = 'SceneGraphService';
|
|
|
52
52
|
* @see https://community.khronos.org/t/scene-graphs/50542/7
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
|
-
var DefaultSceneGraphService =
|
|
55
|
+
var DefaultSceneGraphService =
|
|
56
|
+
/** @class */
|
|
57
|
+
function () {
|
|
56
58
|
function DefaultSceneGraphService() {
|
|
57
59
|
var _this = this;
|
|
58
60
|
/**
|
|
@@ -340,16 +342,14 @@ var DefaultSceneGraphService = function () {
|
|
|
340
342
|
|
|
341
343
|
DefaultSceneGraphService.prototype.detach = function (child) {
|
|
342
344
|
if (child.parentNode) {
|
|
343
|
-
var transform = child.transformable;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
} // parent needs re-sort
|
|
352
|
-
|
|
345
|
+
var transform = child.transformable; // if (transform) {
|
|
346
|
+
// const worldTransform = this.getWorldTransform(child, transform);
|
|
347
|
+
// mat4.getScaling(transform.localScale, worldTransform);
|
|
348
|
+
// mat4.getTranslation(transform.localPosition, worldTransform);
|
|
349
|
+
// mat4.getRotation(transform.localRotation, worldTransform);
|
|
350
|
+
// transform.localDirtyFlag = true;
|
|
351
|
+
// }
|
|
352
|
+
// parent needs re-sort
|
|
353
353
|
|
|
354
354
|
var sortable = child.parentNode.sortable;
|
|
355
355
|
|
|
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
|
|
|
3
3
|
import { GeometryAABBUpdater } from './interfaces';
|
|
4
4
|
import { Shape } from '../../types';
|
|
5
5
|
|
|
6
|
-
var CircleUpdater =
|
|
6
|
+
var CircleUpdater =
|
|
7
|
+
/** @class */
|
|
8
|
+
function () {
|
|
7
9
|
function CircleUpdater() {}
|
|
8
10
|
|
|
9
11
|
CircleUpdater.prototype.update = function (parsedStyle, object) {
|
|
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
|
|
|
3
3
|
import { GeometryAABBUpdater } from './interfaces';
|
|
4
4
|
import { Shape } from '../../types';
|
|
5
5
|
|
|
6
|
-
var EllipseUpdater =
|
|
6
|
+
var EllipseUpdater =
|
|
7
|
+
/** @class */
|
|
8
|
+
function () {
|
|
7
9
|
function EllipseUpdater() {}
|
|
8
10
|
|
|
9
11
|
EllipseUpdater.prototype.update = function (parsedStyle, object) {
|
|
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
|
|
|
3
3
|
import { GeometryAABBUpdater } from './interfaces';
|
|
4
4
|
import { Shape } from '../../types';
|
|
5
5
|
|
|
6
|
-
var LineUpdater =
|
|
6
|
+
var LineUpdater =
|
|
7
|
+
/** @class */
|
|
8
|
+
function () {
|
|
7
9
|
function LineUpdater() {}
|
|
8
10
|
|
|
9
11
|
LineUpdater.prototype.update = function (parsedStyle) {
|
|
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
|
|
|
3
3
|
import { GeometryAABBUpdater } from './interfaces';
|
|
4
4
|
import { Shape } from '../../types';
|
|
5
5
|
|
|
6
|
-
var PathUpdater =
|
|
6
|
+
var PathUpdater =
|
|
7
|
+
/** @class */
|
|
8
|
+
function () {
|
|
7
9
|
function PathUpdater() {}
|
|
8
10
|
|
|
9
11
|
PathUpdater.prototype.update = function (parsedStyle) {
|
|
@@ -3,7 +3,9 @@ import { singleton } from 'mana-syringe';
|
|
|
3
3
|
import { GeometryAABBUpdater } from './interfaces';
|
|
4
4
|
import { Shape } from '../../types';
|
|
5
5
|
|
|
6
|
-
var PolylineUpdater =
|
|
6
|
+
var PolylineUpdater =
|
|
7
|
+
/** @class */
|
|
8
|
+
function () {
|
|
7
9
|
function PolylineUpdater() {}
|
|
8
10
|
|
|
9
11
|
PolylineUpdater.prototype.update = function (parsedStyle) {
|
|
@@ -4,7 +4,9 @@ import { isString } from '@antv/util';
|
|
|
4
4
|
import { GeometryAABBUpdater } from './interfaces';
|
|
5
5
|
import { Shape } from '../../types';
|
|
6
6
|
|
|
7
|
-
var RectUpdater =
|
|
7
|
+
var RectUpdater =
|
|
8
|
+
/** @class */
|
|
9
|
+
function () {
|
|
8
10
|
function RectUpdater() {}
|
|
9
11
|
|
|
10
12
|
RectUpdater.prototype.update = function (parsedStyle, object) {
|
|
@@ -5,7 +5,9 @@ import { GeometryAABBUpdater } from './interfaces';
|
|
|
5
5
|
import { TextService } from '../text';
|
|
6
6
|
import { Shape } from '../../types';
|
|
7
7
|
|
|
8
|
-
var TextUpdater =
|
|
8
|
+
var TextUpdater =
|
|
9
|
+
/** @class */
|
|
10
|
+
function () {
|
|
9
11
|
function TextUpdater() {}
|
|
10
12
|
|
|
11
13
|
TextUpdater.prototype.update = function (parsedStyle) {
|
|
@@ -22,6 +24,18 @@ var TextUpdater = function () {
|
|
|
22
24
|
dy = parsedStyle.dy;
|
|
23
25
|
var metrics = this.textService.measureText(text, parsedStyle);
|
|
24
26
|
parsedStyle.metrics = metrics;
|
|
27
|
+
|
|
28
|
+
if (!text) {
|
|
29
|
+
return {
|
|
30
|
+
width: 0,
|
|
31
|
+
height: 0,
|
|
32
|
+
x: 0,
|
|
33
|
+
y: 0,
|
|
34
|
+
offsetX: 0,
|
|
35
|
+
offsetY: 0
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
25
39
|
var width = metrics.width,
|
|
26
40
|
height = metrics.height,
|
|
27
41
|
lineHeight = metrics.lineHeight,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { singleton } from 'mana-syringe';
|
|
3
3
|
|
|
4
|
-
var OffscreenCanvasCreator =
|
|
4
|
+
var OffscreenCanvasCreator =
|
|
5
|
+
/** @class */
|
|
6
|
+
function () {
|
|
5
7
|
function OffscreenCanvasCreator() {}
|
|
6
8
|
|
|
7
9
|
OffscreenCanvasCreator.prototype.getOrCreateCanvas = function () {
|
|
@@ -24,10 +24,12 @@ var regexCannotStartJaJp = /[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾー
|
|
|
24
24
|
var regexCannotEndJaJp = /[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/;
|
|
25
25
|
var regexCannotStartKoKr = /[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/;
|
|
26
26
|
var regexCannotEndKoKr = /[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/;
|
|
27
|
-
var regexCannotStart = new RegExp(regexCannotStartZhCn.source
|
|
28
|
-
var regexCannotEnd = new RegExp(regexCannotEndZhCn.source
|
|
27
|
+
var regexCannotStart = new RegExp("".concat(regexCannotStartZhCn.source, "|").concat(regexCannotStartZhTw.source, "|").concat(regexCannotStartJaJp.source, "|").concat(regexCannotStartKoKr.source));
|
|
28
|
+
var regexCannotEnd = new RegExp("".concat(regexCannotEndZhCn.source, "|").concat(regexCannotEndZhTw.source, "|").concat(regexCannotEndJaJp.source, "|").concat(regexCannotEndKoKr.source));
|
|
29
29
|
|
|
30
|
-
var TextService =
|
|
30
|
+
var TextService =
|
|
31
|
+
/** @class */
|
|
32
|
+
function () {
|
|
31
33
|
function TextService() {
|
|
32
34
|
var _this = this;
|
|
33
35
|
|
package/es/shapes/AABB.js
CHANGED
|
@@ -5,7 +5,9 @@ import { vec3 } from 'gl-matrix';
|
|
|
5
5
|
* @see https://github.com/antvis/GWebGPUEngine/issues/3
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
var AABB =
|
|
8
|
+
var AABB =
|
|
9
|
+
/** @class */
|
|
10
|
+
function () {
|
|
9
11
|
function AABB(center, halfExtents) {
|
|
10
12
|
this.min = vec3.create();
|
|
11
13
|
this.max = vec3.create();
|
|
@@ -45,6 +47,11 @@ var AABB = function () {
|
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
if (AABB.isEmpty(this)) {
|
|
51
|
+
this.setMinMax(aabb.getMin(), aabb.getMax());
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
var tc = this.center;
|
|
49
56
|
var tcx = tc[0];
|
|
50
57
|
var tcy = tc[1];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { vec3 } from 'gl-matrix';
|
|
2
2
|
var tmpVecA = vec3.create();
|
|
3
3
|
|
|
4
|
-
var BoundingSphere =
|
|
4
|
+
var BoundingSphere =
|
|
5
|
+
/** @class */
|
|
6
|
+
function () {
|
|
5
7
|
function BoundingSphere(center, radius) {
|
|
6
8
|
this.center = center || vec3.create();
|
|
7
9
|
this.radius = radius || 0.5;
|
package/es/shapes/Frustum.js
CHANGED
package/es/shapes/Plane.js
CHANGED
package/es/shapes/Point.js
CHANGED
package/es/shapes/Polygon.js
CHANGED
package/es/shapes/Ray.js
CHANGED
|
@@ -11,7 +11,9 @@ var tmpVecE = vec3.create();
|
|
|
11
11
|
* @see https://github.com/mrdoob/three.js/blob/dev/src/math/Ray.js
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var Ray =
|
|
14
|
+
var Ray =
|
|
15
|
+
/** @class */
|
|
16
|
+
function () {
|
|
15
17
|
function Ray(origin, direction) {
|
|
16
18
|
this.origin = origin || vec3.create();
|
|
17
19
|
this.direction = direction || vec3.fromValues(0, 0, -1);
|
package/es/shapes/Rect.js
CHANGED