@antv/g-canvas 1.9.46 → 1.9.48

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.
@@ -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(): Promise<void>;
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;IAK5C,IAAI;IAoCV,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"}
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 = /*#__PURE__*/function () {
379
- var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
380
- var _this$canvasConfig, container, canvas, $canvas;
381
- return _regeneratorRuntime().wrap(function _callee$(_context) {
382
- while (1) switch (_context.prev = _context.next) {
383
- case 0:
384
- _this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas;
385
- if (canvas) {
386
- this.$canvas = canvas;
387
- if (container && canvas.parentElement !== container) {
388
- container.appendChild(canvas);
389
- }
390
- this.$container = canvas.parentElement;
391
- this.canvasConfig.container = this.$container;
392
- } else if (container) {
393
- // create container
394
- this.$container = isString(container) ? document.getElementById(container) : container;
395
- if (this.$container) {
396
- // create canvas
397
- $canvas = document.createElement('canvas');
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
- }, _callee, this);
412
- }));
413
- function init() {
414
- return _init.apply(this, arguments);
399
+ this.$canvas = $canvas;
400
+ }
415
401
  }
416
- return init;
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 _callee2(options) {
453
+ var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
467
454
  var _options, type, encoderOptions;
468
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
469
- while (1) switch (_context2.prev = _context2.next) {
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 _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
462
+ return _context.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
476
463
  case 3:
477
464
  case "end":
478
- return _context2.stop();
465
+ return _context.stop();
479
466
  }
480
- }, _callee2, this);
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 = /*#__PURE__*/function () {
398
- var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
399
- var _this$canvasConfig, container, canvas, $canvas;
400
- return _regeneratorRuntime().wrap(function _callee$(_context) {
401
- while (1) switch (_context.prev = _context.next) {
402
- case 0:
403
- _this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas;
404
- if (canvas) {
405
- this.$canvas = canvas;
406
- if (container && canvas.parentElement !== container) {
407
- container.appendChild(canvas);
408
- }
409
- this.$container = canvas.parentElement;
410
- this.canvasConfig.container = this.$container;
411
- } else if (container) {
412
- // create container
413
- this.$container = util.isString(container) ? document.getElementById(container) : container;
414
- if (this.$container) {
415
- // create canvas
416
- $canvas = document.createElement('canvas');
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
- }, _callee, this);
431
- }));
432
- function init() {
433
- return _init.apply(this, arguments);
418
+ this.$canvas = $canvas;
419
+ }
434
420
  }
435
- return init;
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 _callee2(options) {
472
+ var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
486
473
  var _options, type, encoderOptions;
487
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
488
- while (1) switch (_context2.prev = _context2.next) {
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 _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
481
+ return _context.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
495
482
  case 3:
496
483
  case "end":
497
- return _context2.stop();
484
+ return _context.stop();
498
485
  }
499
- }, _callee2, this);
486
+ }, _callee, this);
500
487
  }));
501
488
  function toDataURL(_x) {
502
489
  return _toDataURL.apply(this, arguments);