@antv/g-canvas 1.9.45 → 1.9.47
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/Canvas2DContextService.d.ts +1 -1
- package/dist/Canvas2DContextService.d.ts.map +1 -1
- package/dist/index.esm.js +31 -44
- package/dist/index.js +31 -44
- package/dist/index.umd.js +1268 -2637
- package/dist/index.umd.min.js +1 -1
- package/package.json +8 -8
|
@@ -7,7 +7,7 @@ export declare class Canvas2DContextService implements ContextService<CanvasRend
|
|
|
7
7
|
private canvasConfig;
|
|
8
8
|
private renderingContext;
|
|
9
9
|
constructor(context: GlobalRuntime & CanvasContext);
|
|
10
|
-
init():
|
|
10
|
+
init(): void;
|
|
11
11
|
getContext(): CanvasRenderingContext2D;
|
|
12
12
|
getDomElement(): CanvasLike;
|
|
13
13
|
getDPR(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canvas2DContextService.d.ts","sourceRoot":"","sources":["../src/Canvas2DContextService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,EAEb,cAAc,EACf,MAAM,cAAc,CAAC;AAItB,qBAAa,sBACX,YAAW,cAAc,CAAC,wBAAwB,CAAC;IAEnD,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,OAAO,CAGN;IACT,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,EAAE,aAAa,GAAG,aAAa;
|
|
1
|
+
{"version":3,"file":"Canvas2DContextService.d.ts","sourceRoot":"","sources":["../src/Canvas2DContextService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,EAEb,cAAc,EACf,MAAM,cAAc,CAAC;AAItB,qBAAa,sBACX,YAAW,cAAc,CAAC,wBAAwB,CAAC;IAEnD,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,OAAO,CAGN;IACT,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,EAAE,aAAa,GAAG,aAAa;IAKlD,IAAI;IAoCJ,UAAU;IAIV,aAAa;IAIb,MAAM;IAIN,qBAAqB;IAMrB,OAAO;IASP,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAyBpC,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAMzB,SAAS,CAAC,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM;CAOtD"}
|
package/dist/index.esm.js
CHANGED
|
@@ -375,46 +375,33 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
375
375
|
this.canvasConfig = context.config;
|
|
376
376
|
}
|
|
377
377
|
var _proto = Canvas2DContextService.prototype;
|
|
378
|
-
_proto.init =
|
|
379
|
-
var
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
this.$container.appendChild($canvas);
|
|
399
|
-
if (!this.$container.style.position) {
|
|
400
|
-
this.$container.style.position = 'relative';
|
|
401
|
-
}
|
|
402
|
-
this.$canvas = $canvas;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
this.context = this.$canvas.getContext('2d');
|
|
406
|
-
this.resize(this.canvasConfig.width, this.canvasConfig.height);
|
|
407
|
-
case 4:
|
|
408
|
-
case "end":
|
|
409
|
-
return _context.stop();
|
|
378
|
+
_proto.init = function init() {
|
|
379
|
+
var _this$canvasConfig = this.canvasConfig,
|
|
380
|
+
container = _this$canvasConfig.container,
|
|
381
|
+
canvas = _this$canvasConfig.canvas;
|
|
382
|
+
if (canvas) {
|
|
383
|
+
this.$canvas = canvas;
|
|
384
|
+
if (container && canvas.parentElement !== container) {
|
|
385
|
+
container.appendChild(canvas);
|
|
386
|
+
}
|
|
387
|
+
this.$container = canvas.parentElement;
|
|
388
|
+
this.canvasConfig.container = this.$container;
|
|
389
|
+
} else if (container) {
|
|
390
|
+
// create container
|
|
391
|
+
this.$container = isString(container) ? document.getElementById(container) : container;
|
|
392
|
+
if (this.$container) {
|
|
393
|
+
// create canvas
|
|
394
|
+
var $canvas = document.createElement('canvas');
|
|
395
|
+
this.$container.appendChild($canvas);
|
|
396
|
+
if (!this.$container.style.position) {
|
|
397
|
+
this.$container.style.position = 'relative';
|
|
410
398
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
function init() {
|
|
414
|
-
return _init.apply(this, arguments);
|
|
399
|
+
this.$canvas = $canvas;
|
|
400
|
+
}
|
|
415
401
|
}
|
|
416
|
-
|
|
417
|
-
|
|
402
|
+
this.context = this.$canvas.getContext('2d');
|
|
403
|
+
this.resize(this.canvasConfig.width, this.canvasConfig.height);
|
|
404
|
+
};
|
|
418
405
|
_proto.getContext = function getContext() {
|
|
419
406
|
return this.context;
|
|
420
407
|
};
|
|
@@ -463,21 +450,21 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
463
450
|
}
|
|
464
451
|
};
|
|
465
452
|
_proto.toDataURL = /*#__PURE__*/function () {
|
|
466
|
-
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
453
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
467
454
|
var _options, type, encoderOptions;
|
|
468
|
-
return _regeneratorRuntime().wrap(function
|
|
469
|
-
while (1) switch (
|
|
455
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
456
|
+
while (1) switch (_context.prev = _context.next) {
|
|
470
457
|
case 0:
|
|
471
458
|
if (options === void 0) {
|
|
472
459
|
options = {};
|
|
473
460
|
}
|
|
474
461
|
_options = options, type = _options.type, encoderOptions = _options.encoderOptions;
|
|
475
|
-
return
|
|
462
|
+
return _context.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
|
|
476
463
|
case 3:
|
|
477
464
|
case "end":
|
|
478
|
-
return
|
|
465
|
+
return _context.stop();
|
|
479
466
|
}
|
|
480
|
-
},
|
|
467
|
+
}, _callee, this);
|
|
481
468
|
}));
|
|
482
469
|
function toDataURL(_x) {
|
|
483
470
|
return _toDataURL.apply(this, arguments);
|
package/dist/index.js
CHANGED
|
@@ -394,46 +394,33 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
394
394
|
this.canvasConfig = context.config;
|
|
395
395
|
}
|
|
396
396
|
var _proto = Canvas2DContextService.prototype;
|
|
397
|
-
_proto.init =
|
|
398
|
-
var
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
this.$container.appendChild($canvas);
|
|
418
|
-
if (!this.$container.style.position) {
|
|
419
|
-
this.$container.style.position = 'relative';
|
|
420
|
-
}
|
|
421
|
-
this.$canvas = $canvas;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
this.context = this.$canvas.getContext('2d');
|
|
425
|
-
this.resize(this.canvasConfig.width, this.canvasConfig.height);
|
|
426
|
-
case 4:
|
|
427
|
-
case "end":
|
|
428
|
-
return _context.stop();
|
|
397
|
+
_proto.init = function init() {
|
|
398
|
+
var _this$canvasConfig = this.canvasConfig,
|
|
399
|
+
container = _this$canvasConfig.container,
|
|
400
|
+
canvas = _this$canvasConfig.canvas;
|
|
401
|
+
if (canvas) {
|
|
402
|
+
this.$canvas = canvas;
|
|
403
|
+
if (container && canvas.parentElement !== container) {
|
|
404
|
+
container.appendChild(canvas);
|
|
405
|
+
}
|
|
406
|
+
this.$container = canvas.parentElement;
|
|
407
|
+
this.canvasConfig.container = this.$container;
|
|
408
|
+
} else if (container) {
|
|
409
|
+
// create container
|
|
410
|
+
this.$container = util.isString(container) ? document.getElementById(container) : container;
|
|
411
|
+
if (this.$container) {
|
|
412
|
+
// create canvas
|
|
413
|
+
var $canvas = document.createElement('canvas');
|
|
414
|
+
this.$container.appendChild($canvas);
|
|
415
|
+
if (!this.$container.style.position) {
|
|
416
|
+
this.$container.style.position = 'relative';
|
|
429
417
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
function init() {
|
|
433
|
-
return _init.apply(this, arguments);
|
|
418
|
+
this.$canvas = $canvas;
|
|
419
|
+
}
|
|
434
420
|
}
|
|
435
|
-
|
|
436
|
-
|
|
421
|
+
this.context = this.$canvas.getContext('2d');
|
|
422
|
+
this.resize(this.canvasConfig.width, this.canvasConfig.height);
|
|
423
|
+
};
|
|
437
424
|
_proto.getContext = function getContext() {
|
|
438
425
|
return this.context;
|
|
439
426
|
};
|
|
@@ -482,21 +469,21 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
482
469
|
}
|
|
483
470
|
};
|
|
484
471
|
_proto.toDataURL = /*#__PURE__*/function () {
|
|
485
|
-
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
472
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
486
473
|
var _options, type, encoderOptions;
|
|
487
|
-
return _regeneratorRuntime().wrap(function
|
|
488
|
-
while (1) switch (
|
|
474
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
475
|
+
while (1) switch (_context.prev = _context.next) {
|
|
489
476
|
case 0:
|
|
490
477
|
if (options === void 0) {
|
|
491
478
|
options = {};
|
|
492
479
|
}
|
|
493
480
|
_options = options, type = _options.type, encoderOptions = _options.encoderOptions;
|
|
494
|
-
return
|
|
481
|
+
return _context.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
|
|
495
482
|
case 3:
|
|
496
483
|
case "end":
|
|
497
|
-
return
|
|
484
|
+
return _context.stop();
|
|
498
485
|
}
|
|
499
|
-
},
|
|
486
|
+
}, _callee, this);
|
|
500
487
|
}));
|
|
501
488
|
function toDataURL(_x) {
|
|
502
489
|
return _toDataURL.apply(this, arguments);
|