@antv/g 5.0.7 → 5.0.8

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 CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Cursor } from './types';
1
2
  import { CanvasConfig } from './types';
2
3
  import { DisplayObject } from './display-objects/DisplayObject';
3
4
  import { ContextService } from './services';
@@ -5,7 +6,7 @@ import { RenderingService } from './services/RenderingService';
5
6
  import { RenderingContext } from './services/RenderingContext';
6
7
  import { EventService } from './services/EventService';
7
8
  import { Camera } from './camera';
8
- import type { AbstractRenderer } from './AbstractRenderer';
9
+ import type { IRenderer } from './AbstractRenderer';
9
10
  import type { PointLike } from './shapes';
10
11
  import type { IChildNode } from './dom';
11
12
  import { Document, EventTarget } from './dom';
@@ -87,7 +88,8 @@ export declare class Canvas extends EventTarget implements ICanvas {
87
88
  private initRenderer;
88
89
  private loadCommonContainerModule;
89
90
  private loadRendererContainerModule;
90
- setRenderer(renderer: AbstractRenderer): void;
91
+ setRenderer(renderer: IRenderer): void;
92
+ setCursor(cursor: Cursor): void;
91
93
  private unmountChildren;
92
94
  private mountChildren;
93
95
  client2Viewport(client: PointLike): PointLike;
package/es/Canvas.js CHANGED
@@ -340,6 +340,10 @@ function (_super) {
340
340
  this.initRenderer(renderer);
341
341
  };
342
342
 
343
+ Canvas.prototype.setCursor = function (cursor) {
344
+ this.getContextService().applyCursorStyle(cursor);
345
+ };
346
+
343
347
  Canvas.prototype.unmountChildren = function (parent) {
344
348
  var path = [];
345
349
  parent.forEach(function (child) {
@@ -27,7 +27,7 @@ export declare class EventTarget implements IEventTarget {
27
27
  */
28
28
  off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
29
29
  removeAllEventListeners(): void;
30
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
30
+ removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
31
31
  /**
32
32
  * @deprecated
33
33
  * @alias dispatchEvent
@@ -110,7 +110,7 @@ function () {
110
110
  var capture = isBoolean(options) && options || isObject(options) && options.capture;
111
111
  var context = isFunction(listener) ? undefined : listener;
112
112
  type = capture ? type + "capture" : type;
113
- listener = isFunction(listener) ? listener : listener.handleEvent;
113
+ listener = isFunction(listener) ? listener : listener === null || listener === void 0 ? void 0 : listener.handleEvent;
114
114
  this.emitter.off(type, listener, context);
115
115
  return this;
116
116
  };
package/lib/Canvas.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Cursor } from './types';
1
2
  import { CanvasConfig } from './types';
2
3
  import { DisplayObject } from './display-objects/DisplayObject';
3
4
  import { ContextService } from './services';
@@ -5,7 +6,7 @@ import { RenderingService } from './services/RenderingService';
5
6
  import { RenderingContext } from './services/RenderingContext';
6
7
  import { EventService } from './services/EventService';
7
8
  import { Camera } from './camera';
8
- import type { AbstractRenderer } from './AbstractRenderer';
9
+ import type { IRenderer } from './AbstractRenderer';
9
10
  import type { PointLike } from './shapes';
10
11
  import type { IChildNode } from './dom';
11
12
  import { Document, EventTarget } from './dom';
@@ -87,7 +88,8 @@ export declare class Canvas extends EventTarget implements ICanvas {
87
88
  private initRenderer;
88
89
  private loadCommonContainerModule;
89
90
  private loadRendererContainerModule;
90
- setRenderer(renderer: AbstractRenderer): void;
91
+ setRenderer(renderer: IRenderer): void;
92
+ setCursor(cursor: Cursor): void;
91
93
  private unmountChildren;
92
94
  private mountChildren;
93
95
  client2Viewport(client: PointLike): PointLike;
package/lib/Canvas.js CHANGED
@@ -361,6 +361,10 @@ function (_super) {
361
361
  this.initRenderer(renderer);
362
362
  };
363
363
 
364
+ Canvas.prototype.setCursor = function (cursor) {
365
+ this.getContextService().applyCursorStyle(cursor);
366
+ };
367
+
364
368
  Canvas.prototype.unmountChildren = function (parent) {
365
369
  var path = [];
366
370
  parent.forEach(function (child) {
@@ -27,7 +27,7 @@ export declare class EventTarget implements IEventTarget {
27
27
  */
28
28
  off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
29
29
  removeAllEventListeners(): void;
30
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
30
+ removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
31
31
  /**
32
32
  * @deprecated
33
33
  * @alias dispatchEvent
@@ -124,7 +124,7 @@ function () {
124
124
  var capture = (0, _util.isBoolean)(options) && options || (0, _util.isObject)(options) && options.capture;
125
125
  var context = (0, _util.isFunction)(listener) ? undefined : listener;
126
126
  type = capture ? type + "capture" : type;
127
- listener = (0, _util.isFunction)(listener) ? listener : listener.handleEvent;
127
+ listener = (0, _util.isFunction)(listener) ? listener : listener === null || listener === void 0 ? void 0 : listener.handleEvent;
128
128
  this.emitter.off(type, listener, context);
129
129
  return this;
130
130
  };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.7",
3
+ "version": "5.0.8",
4
4
  "description": "A core module including ECS and DI container.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
7
  "types": "es/index.d.ts",
8
- "unpkg": "dist/index.umd.js",
8
+ "unpkg": "dist/index.umd.min.js",
9
9
  "files": [
10
10
  "package.json",
11
11
  "dist",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "homepage": "https://github.com/antvis/g#readme",
39
39
  "dependencies": {
40
- "@antv/g-math": "^1.0.6",
40
+ "@antv/g-math": "^1.0.7",
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": "aaa26a747017b8407bdbd3c9bcc24b058cdf06c9"
53
+ "gitHead": "94a3aa628ce9b24a90c387c3465a68d1f515e5ff"
54
54
  }