@antv/g 5.0.18 → 5.0.19

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.js CHANGED
@@ -57,7 +57,8 @@ function (_super) {
57
57
  renderer = config.renderer,
58
58
  background = config.background,
59
59
  requestAnimationFrame = config.requestAnimationFrame,
60
- cancelAnimationFrame = config.cancelAnimationFrame;
60
+ cancelAnimationFrame = config.cancelAnimationFrame,
61
+ createImage = config.createImage;
61
62
  cleanExistedCanvas(container, _this);
62
63
  var canvasWidth = width;
63
64
  var canvasHeight = height;
@@ -83,7 +84,8 @@ function (_super) {
83
84
  renderer: renderer,
84
85
  devicePixelRatio: dpr,
85
86
  cursor: 'default',
86
- background: background // background: 'white',
87
+ background: background,
88
+ createImage: createImage // background: 'white',
87
89
 
88
90
  });
89
91
 
@@ -84,7 +84,9 @@ export function parseColor(colorStr) {
84
84
  return {
85
85
  type: PARSED_COLOR_TYPE.Constant,
86
86
  value: rgba,
87
- formatted: color && "rgba(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ",").concat(color.opacity, ")") || 'rgba(0,0,0,0)'
87
+ formatted: // rgba(255,255,255,0) -> [NaN, NaN, NaN, 0]
88
+ // @see https://github.com/d3/d3-color/issues/52
89
+ color && "rgba(".concat(color.r || 0, ",").concat(color.g || 0, ",").concat(color.b || 0, ",").concat(color.opacity, ")") || 'rgba(0,0,0,0)'
88
90
  };
89
91
  }
90
92
  export function mergeColors(left, right) {
package/es/types.d.ts CHANGED
@@ -208,6 +208,10 @@ export interface CanvasConfig {
208
208
  */
209
209
  requestAnimationFrame?: (callback: FrameRequestCallback) => number;
210
210
  cancelAnimationFrame?: (id: number) => void;
211
+ /**
212
+ * replace `new window.Image()`
213
+ */
214
+ createImage?: () => HTMLImageElement;
211
215
  /**
212
216
  * 画布宽度
213
217
  */
@@ -243,6 +247,8 @@ export declare type PathCommand = A | C | O | H | L | M | R | Q | S | T | V | U
243
247
  export declare type InteractivePointerEvent = PointerEvent | TouchEvent | MouseEvent | WheelEvent;
244
248
  export declare type Tuple4<T> = [T, T, T, T];
245
249
  export declare type Tuple4Number = Tuple4<number>;
250
+ export declare type Tuple3<T> = [T, T, T];
251
+ export declare type Tuple3Number = Tuple3<number>;
246
252
  export declare type ComninedValue<T> = T | [T] | [T, T] | [T, T, T] | Tuple4<T>;
247
253
  export declare type CombinedNumber = ComninedValue<number>;
248
254
  export declare type Length = number;
@@ -5,3 +5,4 @@ export * from './raf';
5
5
  export * from './text';
6
6
  export * from './string';
7
7
  export * from './event';
8
+ export * from './canvas';
package/es/utils/index.js CHANGED
@@ -4,4 +4,5 @@ export * from './path';
4
4
  export * from './raf';
5
5
  export * from './text';
6
6
  export * from './string';
7
- export * from './event';
7
+ export * from './event';
8
+ export * from './canvas';
package/lib/Canvas.js CHANGED
@@ -79,7 +79,8 @@ function (_super) {
79
79
  renderer = config.renderer,
80
80
  background = config.background,
81
81
  requestAnimationFrame = config.requestAnimationFrame,
82
- cancelAnimationFrame = config.cancelAnimationFrame;
82
+ cancelAnimationFrame = config.cancelAnimationFrame,
83
+ createImage = config.createImage;
83
84
  (0, _canvas.cleanExistedCanvas)(container, _this);
84
85
  var canvasWidth = width;
85
86
  var canvasHeight = height;
@@ -105,7 +106,8 @@ function (_super) {
105
106
  renderer: renderer,
106
107
  devicePixelRatio: dpr,
107
108
  cursor: 'default',
108
- background: background // background: 'white',
109
+ background: background,
110
+ createImage: createImage // background: 'white',
109
111
 
110
112
  });
111
113
 
@@ -104,7 +104,9 @@ function parseColor(colorStr) {
104
104
  return {
105
105
  type: PARSED_COLOR_TYPE.Constant,
106
106
  value: rgba,
107
- formatted: color && "rgba(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ",").concat(color.opacity, ")") || 'rgba(0,0,0,0)'
107
+ formatted: // rgba(255,255,255,0) -> [NaN, NaN, NaN, 0]
108
+ // @see https://github.com/d3/d3-color/issues/52
109
+ color && "rgba(".concat(color.r || 0, ",").concat(color.g || 0, ",").concat(color.b || 0, ",").concat(color.opacity, ")") || 'rgba(0,0,0,0)'
108
110
  };
109
111
  }
110
112
 
@@ -110,7 +110,6 @@ function () {
110
110
  };
111
111
 
112
112
  RenderingService.prototype.render = function (canvasConfig) {
113
- var renderedOnscreenInLastFrame = this.stats.renderedOnscreen;
114
113
  this.stats.total = 0;
115
114
  this.stats.rendered = 0;
116
115
  this.zIndexCounter = 0;
package/lib/types.d.ts CHANGED
@@ -208,6 +208,10 @@ export interface CanvasConfig {
208
208
  */
209
209
  requestAnimationFrame?: (callback: FrameRequestCallback) => number;
210
210
  cancelAnimationFrame?: (id: number) => void;
211
+ /**
212
+ * replace `new window.Image()`
213
+ */
214
+ createImage?: () => HTMLImageElement;
211
215
  /**
212
216
  * 画布宽度
213
217
  */
@@ -243,6 +247,8 @@ export declare type PathCommand = A | C | O | H | L | M | R | Q | S | T | V | U
243
247
  export declare type InteractivePointerEvent = PointerEvent | TouchEvent | MouseEvent | WheelEvent;
244
248
  export declare type Tuple4<T> = [T, T, T, T];
245
249
  export declare type Tuple4Number = Tuple4<number>;
250
+ export declare type Tuple3<T> = [T, T, T];
251
+ export declare type Tuple3Number = Tuple3<number>;
246
252
  export declare type ComninedValue<T> = T | [T] | [T, T] | [T, T, T] | Tuple4<T>;
247
253
  export declare type CombinedNumber = ComninedValue<number>;
248
254
  export declare type Length = number;
@@ -5,3 +5,4 @@ export * from './raf';
5
5
  export * from './text';
6
6
  export * from './string';
7
7
  export * from './event';
8
+ export * from './canvas';
@@ -93,4 +93,17 @@ Object.keys(_event).forEach(function (key) {
93
93
  return _event[key];
94
94
  }
95
95
  });
96
+ });
97
+
98
+ var _canvas = require("./canvas");
99
+
100
+ Object.keys(_canvas).forEach(function (key) {
101
+ if (key === "default" || key === "__esModule") return;
102
+ if (key in exports && exports[key] === _canvas[key]) return;
103
+ Object.defineProperty(exports, key, {
104
+ enumerable: true,
105
+ get: function get() {
106
+ return _canvas[key];
107
+ }
108
+ });
96
109
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.18",
3
+ "version": "5.0.19",
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.15",
40
+ "@antv/g-math": "^1.0.16",
41
41
  "@antv/path-util": "^2.0.14",
42
42
  "@antv/util": "^2.0.13",
43
43
  "@types/offscreencanvas": "^2019.6.4",
@@ -54,5 +54,5 @@
54
54
  "scripts": {
55
55
  "umd": "webpack"
56
56
  },
57
- "gitHead": "c32d65599adc9e7c3d31ca5710fb3968e01bff43"
57
+ "gitHead": "ac4d1b7ab482f8ff862c76fb6248ef92b4a8c22d"
58
58
  }