@antv/g-canvas 1.0.0-alpha.24 → 1.0.0-alpha.28
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.js +2221 -0
- package/lib/index.js +23 -9
- package/package.json +18 -13
- package/es/Canvas2DContextService.d.ts +0 -16
- package/es/Canvas2DContextService.js +0 -83
- package/es/ContextRegisterPlugin.d.ts +0 -6
- package/es/ContextRegisterPlugin.js +0 -26
- package/es/index.d.ts +0 -4
- package/es/index.js +0 -35
- package/es/utils/browser.d.ts +0 -1
- package/es/utils/browser.js +0 -1
- package/es/utils/dom.d.ts +0 -1
- package/es/utils/dom.js +0 -8
- package/lib/Canvas2DContextService.d.ts +0 -16
- package/lib/Canvas2DContextService.js +0 -93
- package/lib/ContextRegisterPlugin.d.ts +0 -6
- package/lib/ContextRegisterPlugin.js +0 -36
- package/lib/index.d.ts +0 -4
- package/lib/utils/browser.d.ts +0 -1
- package/lib/utils/browser.js +0 -8
- package/lib/utils/dom.d.ts +0 -1
- package/lib/utils/dom.js +0 -17
package/lib/index.js
CHANGED
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.Renderer = void 0;
|
|
8
|
+
exports.HTMLRenderer = exports.CanvasPicker = exports.CanvasRenderer = exports.DomInteraction = exports.Renderer = void 0;
|
|
7
9
|
|
|
8
10
|
var _tslib = require("tslib");
|
|
9
11
|
|
|
10
12
|
var _g = require("@antv/g");
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var DomInteraction = _interopRequireWildcard(require("@antv/g-plugin-dom-interaction"));
|
|
15
|
+
|
|
16
|
+
exports.DomInteraction = DomInteraction;
|
|
17
|
+
|
|
18
|
+
var CanvasRenderer = _interopRequireWildcard(require("@antv/g-plugin-canvas-renderer"));
|
|
19
|
+
|
|
20
|
+
exports.CanvasRenderer = CanvasRenderer;
|
|
13
21
|
|
|
14
|
-
var
|
|
22
|
+
var CanvasPicker = _interopRequireWildcard(require("@antv/g-plugin-canvas-picker"));
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
exports.CanvasPicker = CanvasPicker;
|
|
17
25
|
|
|
18
|
-
var
|
|
26
|
+
var HTMLRenderer = _interopRequireWildcard(require("@antv/g-plugin-html-renderer"));
|
|
27
|
+
|
|
28
|
+
exports.HTMLRenderer = HTMLRenderer;
|
|
19
29
|
|
|
20
30
|
var _ContextRegisterPlugin = require("./ContextRegisterPlugin");
|
|
21
31
|
|
|
32
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
+
|
|
34
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
+
|
|
22
36
|
var Renderer = function (_super) {
|
|
23
37
|
(0, _tslib.__extends)(Renderer, _super);
|
|
24
38
|
|
|
@@ -29,15 +43,15 @@ var Renderer = function (_super) {
|
|
|
29
43
|
_this.registerPlugin(new _ContextRegisterPlugin.ContextRegisterPlugin()); // enable rendering with Canvas2D API
|
|
30
44
|
|
|
31
45
|
|
|
32
|
-
_this.registerPlugin(new
|
|
46
|
+
_this.registerPlugin(new CanvasRenderer.Plugin());
|
|
33
47
|
|
|
34
|
-
_this.registerPlugin(new
|
|
48
|
+
_this.registerPlugin(new DomInteraction.Plugin()); // enable picking with Canvas2D API
|
|
35
49
|
|
|
36
50
|
|
|
37
|
-
_this.registerPlugin(new
|
|
51
|
+
_this.registerPlugin(new CanvasPicker.Plugin()); // render HTML component
|
|
38
52
|
|
|
39
53
|
|
|
40
|
-
_this.registerPlugin(new
|
|
54
|
+
_this.registerPlugin(new HTMLRenderer.Plugin());
|
|
41
55
|
|
|
42
56
|
return _this;
|
|
43
57
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/g-canvas",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.28",
|
|
4
4
|
"description": "A renderer implemented by Canvas 2D API",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
-
"module": "es/index.js",
|
|
7
|
-
"types": "
|
|
8
|
-
"sideEffects": false,
|
|
6
|
+
"module": "es/index.esm.js",
|
|
7
|
+
"types": "es/index.d.ts",
|
|
9
8
|
"files": [
|
|
10
9
|
"package.json",
|
|
11
|
-
"es",
|
|
12
|
-
"lib",
|
|
13
10
|
"dist",
|
|
14
11
|
"LICENSE",
|
|
15
12
|
"README.md"
|
|
@@ -40,12 +37,20 @@
|
|
|
40
37
|
},
|
|
41
38
|
"homepage": "https://github.com/antvis/g#readme",
|
|
42
39
|
"dependencies": {
|
|
43
|
-
"@antv/g": "^1.0.0-alpha.
|
|
44
|
-
"@antv/g-plugin-canvas-picker": "^1.0.0-alpha.
|
|
45
|
-
"@antv/g-plugin-canvas-renderer": "^1.0.0-alpha.
|
|
46
|
-
"@antv/g-plugin-dom-interaction": "^1.0.0-alpha.
|
|
47
|
-
"@antv/g-plugin-html-renderer": "^1.0.0-alpha.
|
|
48
|
-
"@antv/util": "^2.0.13"
|
|
40
|
+
"@antv/g": "^1.0.0-alpha.28",
|
|
41
|
+
"@antv/g-plugin-canvas-picker": "^1.0.0-alpha.22",
|
|
42
|
+
"@antv/g-plugin-canvas-renderer": "^1.0.0-alpha.28",
|
|
43
|
+
"@antv/g-plugin-dom-interaction": "^1.0.0-alpha.27",
|
|
44
|
+
"@antv/g-plugin-html-renderer": "^1.0.0-alpha.11",
|
|
45
|
+
"@antv/util": "^2.0.13",
|
|
46
|
+
"@babel/runtime": "^7.16.3"
|
|
49
47
|
},
|
|
50
|
-
"
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@antv/g": "^1.0.0-alpha.27",
|
|
50
|
+
"mana-syringe": "^0.2.1"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"umd": "webpack"
|
|
54
|
+
},
|
|
55
|
+
"gitHead": "b8af919853fa578b4aa6c5e84715948085ac0170"
|
|
51
56
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ContextService } from '@antv/g';
|
|
2
|
-
export declare class Canvas2DContextService implements ContextService<CanvasRenderingContext2D> {
|
|
3
|
-
private $container;
|
|
4
|
-
private $canvas;
|
|
5
|
-
private dpr;
|
|
6
|
-
private context;
|
|
7
|
-
private canvasConfig;
|
|
8
|
-
init(): void;
|
|
9
|
-
getContext(): CanvasRenderingContext2D;
|
|
10
|
-
getDomElement(): HTMLCanvasElement;
|
|
11
|
-
getDPR(): number;
|
|
12
|
-
getBoundingClientRect(): DOMRect;
|
|
13
|
-
destroy(): void;
|
|
14
|
-
resize(width: number, height: number): void;
|
|
15
|
-
applyCursorStyle(cursor: string): void;
|
|
16
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { CanvasConfig } from '@antv/g';
|
|
3
|
-
import { inject, injectable } from 'inversify';
|
|
4
|
-
import { isString } from '@antv/util';
|
|
5
|
-
import { setDOMSize } from './utils/dom';
|
|
6
|
-
|
|
7
|
-
var Canvas2DContextService = function () {
|
|
8
|
-
function Canvas2DContextService() {}
|
|
9
|
-
|
|
10
|
-
Canvas2DContextService.prototype.init = function () {
|
|
11
|
-
var _a = this.canvasConfig,
|
|
12
|
-
container = _a.container,
|
|
13
|
-
width = _a.width,
|
|
14
|
-
height = _a.height; // create container
|
|
15
|
-
|
|
16
|
-
this.$container = isString(container) ? document.getElementById(container) : container;
|
|
17
|
-
|
|
18
|
-
if (this.$container) {
|
|
19
|
-
// create canvas
|
|
20
|
-
var $canvas = document.createElement('canvas');
|
|
21
|
-
this.context = $canvas.getContext('2d');
|
|
22
|
-
this.$container.appendChild($canvas);
|
|
23
|
-
|
|
24
|
-
if (!this.$container.style.position) {
|
|
25
|
-
this.$container.style.position = 'relative';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
this.$canvas = $canvas;
|
|
29
|
-
var dpr = window.devicePixelRatio || 1;
|
|
30
|
-
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
31
|
-
this.dpr = dpr;
|
|
32
|
-
this.resize(width, height);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
Canvas2DContextService.prototype.getContext = function () {
|
|
37
|
-
return this.context;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
Canvas2DContextService.prototype.getDomElement = function () {
|
|
41
|
-
return this.$canvas;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
Canvas2DContextService.prototype.getDPR = function () {
|
|
45
|
-
return this.dpr;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
Canvas2DContextService.prototype.getBoundingClientRect = function () {
|
|
49
|
-
var _a;
|
|
50
|
-
|
|
51
|
-
return (_a = this.$canvas) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
Canvas2DContextService.prototype.destroy = function () {
|
|
55
|
-
if (this.$container && this.$canvas && this.$canvas.parentNode) {
|
|
56
|
-
// destroy context
|
|
57
|
-
this.$container.removeChild(this.$canvas);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
Canvas2DContextService.prototype.resize = function (width, height) {
|
|
62
|
-
if (this.$canvas) {
|
|
63
|
-
// set canvas width & height
|
|
64
|
-
this.$canvas.width = this.dpr * width;
|
|
65
|
-
this.$canvas.height = this.dpr * height; // set CSS style width & height
|
|
66
|
-
|
|
67
|
-
setDOMSize(this.$canvas, width, height);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
Canvas2DContextService.prototype.applyCursorStyle = function (cursor) {
|
|
72
|
-
if (this.$container) {
|
|
73
|
-
this.$container.style.cursor = cursor;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
__decorate([inject(CanvasConfig), __metadata("design:type", Object)], Canvas2DContextService.prototype, "canvasConfig", void 0);
|
|
78
|
-
|
|
79
|
-
Canvas2DContextService = __decorate([injectable()], Canvas2DContextService);
|
|
80
|
-
return Canvas2DContextService;
|
|
81
|
-
}();
|
|
82
|
-
|
|
83
|
-
export { Canvas2DContextService };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ContainerModule } from 'inversify';
|
|
2
|
-
import { ContextService } from '@antv/g';
|
|
3
|
-
import { Canvas2DContextService } from './Canvas2DContextService';
|
|
4
|
-
var containerModule = new ContainerModule(function (bind, unbind, isBound, rebind) {
|
|
5
|
-
/**
|
|
6
|
-
* implements ContextService
|
|
7
|
-
*/
|
|
8
|
-
bind(Canvas2DContextService).toSelf().inSingletonScope();
|
|
9
|
-
bind(ContextService).toService(Canvas2DContextService);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
var ContextRegisterPlugin = function () {
|
|
13
|
-
function ContextRegisterPlugin() {}
|
|
14
|
-
|
|
15
|
-
ContextRegisterPlugin.prototype.init = function (container) {
|
|
16
|
-
container.load(containerModule);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
ContextRegisterPlugin.prototype.destroy = function (container) {
|
|
20
|
-
container.unload(containerModule);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return ContextRegisterPlugin;
|
|
24
|
-
}();
|
|
25
|
-
|
|
26
|
-
export { ContextRegisterPlugin };
|
package/es/index.d.ts
DELETED
package/es/index.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { __extends } from "tslib";
|
|
2
|
-
import { AbstractRenderer } from '@antv/g';
|
|
3
|
-
import { Plugin as DomInteractionPlugin } from '@antv/g-plugin-dom-interaction';
|
|
4
|
-
import { Plugin as CanvasRendererPlugin } from '@antv/g-plugin-canvas-renderer';
|
|
5
|
-
import { Plugin as CanvasPickerPlugin } from '@antv/g-plugin-canvas-picker';
|
|
6
|
-
import { Plugin as HTMLRendererPlugin } from '@antv/g-plugin-html-renderer';
|
|
7
|
-
import { ContextRegisterPlugin } from './ContextRegisterPlugin';
|
|
8
|
-
|
|
9
|
-
var Renderer = function (_super) {
|
|
10
|
-
__extends(Renderer, _super);
|
|
11
|
-
|
|
12
|
-
function Renderer(config) {
|
|
13
|
-
var _this = _super.call(this, config) || this; // register Canvas2DContext
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_this.registerPlugin(new ContextRegisterPlugin()); // enable rendering with Canvas2D API
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_this.registerPlugin(new CanvasRendererPlugin());
|
|
20
|
-
|
|
21
|
-
_this.registerPlugin(new DomInteractionPlugin()); // enable picking with Canvas2D API
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_this.registerPlugin(new CanvasPickerPlugin()); // render HTML component
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_this.registerPlugin(new HTMLRendererPlugin());
|
|
28
|
-
|
|
29
|
-
return _this;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return Renderer;
|
|
33
|
-
}(AbstractRenderer);
|
|
34
|
-
|
|
35
|
-
export { Renderer };
|
package/es/utils/browser.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isBrowser: boolean;
|
package/es/utils/browser.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
package/es/utils/dom.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function setDOMSize($el: HTMLElement, width: number, height: number): void;
|
package/es/utils/dom.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ContextService } from '@antv/g';
|
|
2
|
-
export declare class Canvas2DContextService implements ContextService<CanvasRenderingContext2D> {
|
|
3
|
-
private $container;
|
|
4
|
-
private $canvas;
|
|
5
|
-
private dpr;
|
|
6
|
-
private context;
|
|
7
|
-
private canvasConfig;
|
|
8
|
-
init(): void;
|
|
9
|
-
getContext(): CanvasRenderingContext2D;
|
|
10
|
-
getDomElement(): HTMLCanvasElement;
|
|
11
|
-
getDPR(): number;
|
|
12
|
-
getBoundingClientRect(): DOMRect;
|
|
13
|
-
destroy(): void;
|
|
14
|
-
resize(width: number, height: number): void;
|
|
15
|
-
applyCursorStyle(cursor: string): void;
|
|
16
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Canvas2DContextService = void 0;
|
|
7
|
-
|
|
8
|
-
var _tslib = require("tslib");
|
|
9
|
-
|
|
10
|
-
var _g = require("@antv/g");
|
|
11
|
-
|
|
12
|
-
var _inversify = require("inversify");
|
|
13
|
-
|
|
14
|
-
var _util = require("@antv/util");
|
|
15
|
-
|
|
16
|
-
var _dom = require("./utils/dom");
|
|
17
|
-
|
|
18
|
-
var Canvas2DContextService = function () {
|
|
19
|
-
function Canvas2DContextService() {}
|
|
20
|
-
|
|
21
|
-
Canvas2DContextService.prototype.init = function () {
|
|
22
|
-
var _a = this.canvasConfig,
|
|
23
|
-
container = _a.container,
|
|
24
|
-
width = _a.width,
|
|
25
|
-
height = _a.height; // create container
|
|
26
|
-
|
|
27
|
-
this.$container = (0, _util.isString)(container) ? document.getElementById(container) : container;
|
|
28
|
-
|
|
29
|
-
if (this.$container) {
|
|
30
|
-
// create canvas
|
|
31
|
-
var $canvas = document.createElement('canvas');
|
|
32
|
-
this.context = $canvas.getContext('2d');
|
|
33
|
-
this.$container.appendChild($canvas);
|
|
34
|
-
|
|
35
|
-
if (!this.$container.style.position) {
|
|
36
|
-
this.$container.style.position = 'relative';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
this.$canvas = $canvas;
|
|
40
|
-
var dpr = window.devicePixelRatio || 1;
|
|
41
|
-
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
42
|
-
this.dpr = dpr;
|
|
43
|
-
this.resize(width, height);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
Canvas2DContextService.prototype.getContext = function () {
|
|
48
|
-
return this.context;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
Canvas2DContextService.prototype.getDomElement = function () {
|
|
52
|
-
return this.$canvas;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
Canvas2DContextService.prototype.getDPR = function () {
|
|
56
|
-
return this.dpr;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
Canvas2DContextService.prototype.getBoundingClientRect = function () {
|
|
60
|
-
var _a;
|
|
61
|
-
|
|
62
|
-
return (_a = this.$canvas) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
Canvas2DContextService.prototype.destroy = function () {
|
|
66
|
-
if (this.$container && this.$canvas && this.$canvas.parentNode) {
|
|
67
|
-
// destroy context
|
|
68
|
-
this.$container.removeChild(this.$canvas);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
Canvas2DContextService.prototype.resize = function (width, height) {
|
|
73
|
-
if (this.$canvas) {
|
|
74
|
-
// set canvas width & height
|
|
75
|
-
this.$canvas.width = this.dpr * width;
|
|
76
|
-
this.$canvas.height = this.dpr * height; // set CSS style width & height
|
|
77
|
-
|
|
78
|
-
(0, _dom.setDOMSize)(this.$canvas, width, height);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
Canvas2DContextService.prototype.applyCursorStyle = function (cursor) {
|
|
83
|
-
if (this.$container) {
|
|
84
|
-
this.$container.style.cursor = cursor;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
(0, _tslib.__decorate)([(0, _inversify.inject)(_g.CanvasConfig), (0, _tslib.__metadata)("design:type", Object)], Canvas2DContextService.prototype, "canvasConfig", void 0);
|
|
89
|
-
Canvas2DContextService = (0, _tslib.__decorate)([(0, _inversify.injectable)()], Canvas2DContextService);
|
|
90
|
-
return Canvas2DContextService;
|
|
91
|
-
}();
|
|
92
|
-
|
|
93
|
-
exports.Canvas2DContextService = Canvas2DContextService;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ContextRegisterPlugin = void 0;
|
|
7
|
-
|
|
8
|
-
var _inversify = require("inversify");
|
|
9
|
-
|
|
10
|
-
var _g = require("@antv/g");
|
|
11
|
-
|
|
12
|
-
var _Canvas2DContextService = require("./Canvas2DContextService");
|
|
13
|
-
|
|
14
|
-
var containerModule = new _inversify.ContainerModule(function (bind, unbind, isBound, rebind) {
|
|
15
|
-
/**
|
|
16
|
-
* implements ContextService
|
|
17
|
-
*/
|
|
18
|
-
bind(_Canvas2DContextService.Canvas2DContextService).toSelf().inSingletonScope();
|
|
19
|
-
bind(_g.ContextService).toService(_Canvas2DContextService.Canvas2DContextService);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
var ContextRegisterPlugin = function () {
|
|
23
|
-
function ContextRegisterPlugin() {}
|
|
24
|
-
|
|
25
|
-
ContextRegisterPlugin.prototype.init = function (container) {
|
|
26
|
-
container.load(containerModule);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
ContextRegisterPlugin.prototype.destroy = function (container) {
|
|
30
|
-
container.unload(containerModule);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return ContextRegisterPlugin;
|
|
34
|
-
}();
|
|
35
|
-
|
|
36
|
-
exports.ContextRegisterPlugin = ContextRegisterPlugin;
|
package/lib/index.d.ts
DELETED
package/lib/utils/browser.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isBrowser: boolean;
|
package/lib/utils/browser.js
DELETED
package/lib/utils/dom.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function setDOMSize($el: HTMLElement, width: number, height: number): void;
|
package/lib/utils/dom.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.setDOMSize = setDOMSize;
|
|
7
|
-
|
|
8
|
-
var _browser = require("./browser");
|
|
9
|
-
|
|
10
|
-
var PX_SUFFIX = 'px';
|
|
11
|
-
|
|
12
|
-
function setDOMSize($el, width, height) {
|
|
13
|
-
if (_browser.isBrowser) {
|
|
14
|
-
$el.style.width = width + PX_SUFFIX;
|
|
15
|
-
$el.style.height = height + PX_SUFFIX;
|
|
16
|
-
}
|
|
17
|
-
}
|