@antv/g-canvas 1.9.39 → 1.9.41
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.esm.js +36 -40
- package/dist/index.js +36 -40
- package/dist/index.umd.js +146 -172
- package/dist/index.umd.min.js +1 -1
- package/package.json +8 -8
package/dist/index.esm.js
CHANGED
|
@@ -379,36 +379,34 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
379
379
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
380
380
|
var _this$canvasConfig, container, canvas, $canvas;
|
|
381
381
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
382
|
-
while (1) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
this.$container.style.position = 'relative';
|
|
402
|
-
}
|
|
403
|
-
this.$canvas = $canvas;
|
|
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';
|
|
404
401
|
}
|
|
402
|
+
this.$canvas = $canvas;
|
|
405
403
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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();
|
|
412
410
|
}
|
|
413
411
|
}, _callee, this);
|
|
414
412
|
}));
|
|
@@ -468,18 +466,16 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
468
466
|
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
469
467
|
var _options, type, encoderOptions;
|
|
470
468
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
471
|
-
while (1) {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
return _context2.stop();
|
|
482
|
-
}
|
|
469
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
470
|
+
case 0:
|
|
471
|
+
if (options === void 0) {
|
|
472
|
+
options = {};
|
|
473
|
+
}
|
|
474
|
+
_options = options, type = _options.type, encoderOptions = _options.encoderOptions;
|
|
475
|
+
return _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
|
|
476
|
+
case 3:
|
|
477
|
+
case "end":
|
|
478
|
+
return _context2.stop();
|
|
483
479
|
}
|
|
484
480
|
}, _callee2, this);
|
|
485
481
|
}));
|
package/dist/index.js
CHANGED
|
@@ -398,36 +398,34 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
398
398
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
399
399
|
var _this$canvasConfig, container, canvas, $canvas;
|
|
400
400
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
401
|
-
while (1) {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
this.$container.style.position = 'relative';
|
|
421
|
-
}
|
|
422
|
-
this.$canvas = $canvas;
|
|
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';
|
|
423
420
|
}
|
|
421
|
+
this.$canvas = $canvas;
|
|
424
422
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
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();
|
|
431
429
|
}
|
|
432
430
|
}, _callee, this);
|
|
433
431
|
}));
|
|
@@ -487,18 +485,16 @@ var Canvas2DContextService = /*#__PURE__*/function () {
|
|
|
487
485
|
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
488
486
|
var _options, type, encoderOptions;
|
|
489
487
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
490
|
-
while (1) {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
return _context2.stop();
|
|
501
|
-
}
|
|
488
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
489
|
+
case 0:
|
|
490
|
+
if (options === void 0) {
|
|
491
|
+
options = {};
|
|
492
|
+
}
|
|
493
|
+
_options = options, type = _options.type, encoderOptions = _options.encoderOptions;
|
|
494
|
+
return _context2.abrupt("return", this.context.canvas.toDataURL(type, encoderOptions));
|
|
495
|
+
case 3:
|
|
496
|
+
case "end":
|
|
497
|
+
return _context2.stop();
|
|
502
498
|
}
|
|
503
499
|
}, _callee2, this);
|
|
504
500
|
}));
|