@antv/g 5.0.4 → 5.0.5

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.globalContainer = exports.containerModule = void 0;
6
+ exports.stylePropertyUpdaterFactory = exports.stylePropertyParserFactory = exports.stylePropertyMergerFactory = exports.globalContainer = exports.containerModule = void 0;
7
7
 
8
8
  var _manaSyringe = require("mana-syringe");
9
9
 
@@ -27,6 +27,12 @@ var _propertyHandlers = require("./property-handlers");
27
27
 
28
28
  var globalContainer = _manaSyringe.GlobalContainer;
29
29
  exports.globalContainer = globalContainer;
30
+ var stylePropertyParserFactory = {};
31
+ exports.stylePropertyParserFactory = stylePropertyParserFactory;
32
+ var stylePropertyUpdaterFactory = {};
33
+ exports.stylePropertyUpdaterFactory = stylePropertyUpdaterFactory;
34
+ var stylePropertyMergerFactory = {};
35
+ exports.stylePropertyMergerFactory = stylePropertyMergerFactory;
30
36
  var containerModule = (0, _manaSyringe.Module)(function (register) {
31
37
  (0, _manaSyringe.decorate)((0, _manaSyringe.injectable)(), _eventemitter.EventEmitter); // bind DisplayObject pool
32
38
 
@@ -74,83 +80,65 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
74
80
  return cache[tagName];
75
81
  };
76
82
  }
77
- }); // bind style property handlers
78
-
79
- register({
80
- token: _propertyHandlers.StylePropertyParserFactory,
81
- useFactory: function useFactory(context) {
82
- var cache = {};
83
- return function (propertyName) {
84
- if (!cache[propertyName]) {
85
- if (context.container.isBoundNamed(_propertyHandlers.StylePropertyParser, propertyName)) {
86
- cache[propertyName] = context.container.getNamed(_propertyHandlers.StylePropertyParser, propertyName);
87
- }
88
- }
89
-
90
- return cache[propertyName];
91
- };
92
- }
93
- });
94
- register({
95
- token: _propertyHandlers.StylePropertyUpdaterFactory,
96
- useFactory: function useFactory(context) {
97
- var cache = {};
98
- return function (propertyName) {
99
- if (!cache[propertyName]) {
100
- if (context.container.isBoundNamed(_propertyHandlers.StylePropertyUpdater, propertyName)) {
101
- cache[propertyName] = context.container.getAllNamed(_propertyHandlers.StylePropertyUpdater, propertyName);
102
- }
103
- }
104
-
105
- return cache[propertyName];
106
- };
107
- }
108
- });
109
- register({
110
- token: _propertyHandlers.StylePropertyMergerFactory,
111
- useFactory: function useFactory(context) {
112
- var cache = {};
113
- return function (propertyName) {
114
- if (!cache[propertyName]) {
115
- if (context.container.isBoundNamed(_propertyHandlers.StylePropertyMerger, propertyName)) {
116
- cache[propertyName] = context.container.getNamed(_propertyHandlers.StylePropertyMerger, propertyName);
117
- }
118
- }
119
-
120
- return cache[propertyName];
121
- };
122
- }
123
- });
83
+ }); // // bind style property handlers
84
+ // register({
85
+ // token: StylePropertyParserFactory,
86
+ // useFactory: (context) => {
87
+ // const cache = {};
88
+ // return (propertyName: string) => {
89
+ // if (!cache[propertyName]) {
90
+ // if (context.container.isBoundNamed(StylePropertyParser, propertyName)) {
91
+ // cache[propertyName] = context.container.getNamed(StylePropertyParser, propertyName);
92
+ // }
93
+ // }
94
+ // return cache[propertyName];
95
+ // };
96
+ // },
97
+ // });
98
+ // register({
99
+ // token: StylePropertyUpdaterFactory,
100
+ // useFactory: (context) => {
101
+ // const cache = {};
102
+ // return (propertyName: string) => {
103
+ // if (!cache[propertyName]) {
104
+ // if (context.container.isBoundNamed(StylePropertyUpdater, propertyName)) {
105
+ // cache[propertyName] = context.container.getAllNamed(StylePropertyUpdater, propertyName);
106
+ // }
107
+ // }
108
+ // return cache[propertyName];
109
+ // };
110
+ // },
111
+ // });
112
+ // register({
113
+ // token: StylePropertyMergerFactory,
114
+ // useFactory: (context) => {
115
+ // const cache = {};
116
+ // return (propertyName: string) => {
117
+ // if (!cache[propertyName]) {
118
+ // if (context.container.isBoundNamed(StylePropertyMerger, propertyName)) {
119
+ // cache[propertyName] = context.container.getNamed(StylePropertyMerger, propertyName);
120
+ // }
121
+ // }
122
+ // return cache[propertyName];
123
+ // };
124
+ // },
125
+ // });
124
126
 
125
127
  function addPropertyHandler(property, parser, merger, updater) {
126
128
  if (parser) {
127
- register({
128
- token: {
129
- token: _propertyHandlers.StylePropertyParser,
130
- named: property
131
- },
132
- useValue: parser
133
- });
129
+ stylePropertyParserFactory[property] = parser; // register({ token: { token: StylePropertyParser, named: property }, useValue: parser });
134
130
  }
135
131
 
136
132
  if (merger) {
137
- register({
138
- token: {
139
- token: _propertyHandlers.StylePropertyMerger,
140
- named: property
141
- },
142
- useValue: merger
143
- });
133
+ stylePropertyMergerFactory[property] = merger; // register({ token: { token: StylePropertyMerger, named: property }, useValue: merger });
144
134
  }
145
135
 
146
136
  if (updater) {
147
- register({
148
- token: {
149
- token: _propertyHandlers.StylePropertyUpdater,
150
- named: property
151
- },
152
- useValue: updater
153
- });
137
+ if (!stylePropertyUpdaterFactory[property]) {
138
+ stylePropertyUpdaterFactory[property] = [];
139
+ }
140
+
141
+ stylePropertyUpdaterFactory[property].push(updater); // register({ token: { token: StylePropertyUpdater, named: property }, useValue: updater });
154
142
  }
155
143
  }
156
144
 
@@ -15,6 +15,8 @@ var _CullingPlugin = require("./CullingPlugin");
15
15
 
16
16
  var _shapes = require("../shapes");
17
17
 
18
+ // import { vec3, mat4 } from 'gl-matrix';
19
+ // import { inject, singleton } from 'mana-syringe';
18
20
  // import type { Element } from '../dom';
19
21
  var FrustumCullingStrategy =
20
22
  /** @class */
@@ -24,6 +24,7 @@ export declare class RenderingService {
24
24
  private renderingContext;
25
25
  private sceneGraphService;
26
26
  private inited;
27
+ private stats;
27
28
  hooks: {
28
29
  init: AsyncSeriesHook<[], import("tapable").UnsetAdditionalOptions>;
29
30
  prepare: SyncWaterfallHook<[DisplayObject<any, any>], import("tapable").UnsetAdditionalOptions>;
@@ -45,6 +46,10 @@ export declare class RenderingService {
45
46
  pointerWheel: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
46
47
  };
47
48
  init(): Promise<void>;
49
+ getStats(): {
50
+ total: number;
51
+ rendered: number;
52
+ };
48
53
  render(): void;
49
54
  private renderDisplayObject;
50
55
  destroy(): void;
@@ -34,6 +34,10 @@ var RenderingService =
34
34
  function () {
35
35
  function RenderingService() {
36
36
  this.inited = false;
37
+ this.stats = {
38
+ total: 0,
39
+ rendered: 0
40
+ };
37
41
  this.hooks = {
38
42
  init: new _tapable.AsyncSeriesHook(),
39
43
  prepare: new _tapable.SyncWaterfallHook(['object']),
@@ -86,7 +90,13 @@ function () {
86
90
  });
87
91
  };
88
92
 
93
+ RenderingService.prototype.getStats = function () {
94
+ return this.stats;
95
+ };
96
+
89
97
  RenderingService.prototype.render = function () {
98
+ this.stats.total = 0;
99
+ this.stats.rendered = 0;
90
100
  this.sceneGraphService.syncHierarchy(this.renderingContext.root);
91
101
 
92
102
  if (this.renderingContext.renderReasons.size && this.inited) {
@@ -103,7 +113,8 @@ function () {
103
113
  }
104
114
 
105
115
  this.renderingContext.renderReasons.clear();
106
- }
116
+ } // console.log('render objects: ', this.stats.count);
117
+
107
118
  };
108
119
 
109
120
  RenderingService.prototype.renderDisplayObject = function (displayObject) {
@@ -111,8 +122,11 @@ function () {
111
122
 
112
123
 
113
124
  var objectToRender = this.hooks.prepare.call(displayObject);
125
+ this.stats.total++;
114
126
 
115
127
  if (objectToRender) {
128
+ this.stats.rendered++;
129
+
116
130
  if (!this.renderingContext.dirty) {
117
131
  this.renderingContext.dirty = true;
118
132
  this.hooks.beginFrame.call();
@@ -9,10 +9,12 @@ var _tslib = require("tslib");
9
9
 
10
10
  var _globalModule = require("../global-module");
11
11
 
12
- var _interfaces = require("../property-handlers/interfaces");
13
-
14
12
  var _animation = require("./animation");
15
13
 
14
+ // import {
15
+ // StylePropertyMergerFactory,
16
+ // StylePropertyParserFactory,
17
+ // } from '../property-handlers/interfaces';
16
18
  function convertEffectInput(keyframes, timing, target) {
17
19
  var propertySpecificKeyframeGroups = makePropertySpecificKeyframeGroups(keyframes, timing);
18
20
  var interpolations = makeInterpolations(propertySpecificKeyframeGroups, target);
@@ -115,15 +117,11 @@ function makeInterpolations(propertySpecificKeyframeGroups, target) {
115
117
 
116
118
  function propertyInterpolation(property, left, right, target) {
117
119
  var parsedLeft = left;
118
- var parsedRight = right;
119
-
120
- var parserFactory = _globalModule.globalContainer.get(_interfaces.StylePropertyParserFactory);
121
-
122
- var parser = parserFactory(property);
120
+ var parsedRight = right; // const parserFactory = globalContainer.get<StylePropertyParserFactory>(StylePropertyParserFactory);
123
121
 
124
- var mergerFactory = _globalModule.globalContainer.get(_interfaces.StylePropertyMergerFactory);
122
+ var parser = _globalModule.stylePropertyParserFactory[property]; // const mergerFactory = globalContainer.get<StylePropertyMergerFactory>(StylePropertyMergerFactory);
125
123
 
126
- var merger = mergerFactory(property); // if (left == 'initial' || right == 'initial') {
124
+ var merger = _globalModule.stylePropertyMergerFactory[property]; // if (left == 'initial' || right == 'initial') {
127
125
  // if (left == 'initial')
128
126
  // left = initialValues[ucProperty];
129
127
  // if (right == 'initial')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "description": "A core module including ECS and DI container.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "homepage": "https://github.com/antvis/g#readme",
39
39
  "dependencies": {
40
- "@antv/g-math": "^1.0.4",
40
+ "@antv/g-math": "^1.0.5",
41
41
  "@antv/path-util": "^2.0.14",
42
42
  "@antv/util": "^2.0.13",
43
43
  "d3-color": "^1.4.0",
@@ -50,5 +50,5 @@
50
50
  "scripts": {
51
51
  "umd": "webpack"
52
52
  },
53
- "gitHead": "d88ec3ea3dc2bc52d23debd2070b43dddbd57fea"
53
+ "gitHead": "039cea4e9baf6988a7d6105bb3a907ed816a2fd9"
54
54
  }