@antv/g-canvas 1.9.4 → 1.9.5

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 CHANGED
@@ -424,17 +424,34 @@
424
424
 
425
425
  function __param(paramIndex, decorator) {
426
426
  return function (target, key) { decorator(target, key, paramIndex); }
427
- }
428
-
429
- /** @deprecated */
430
- function __spreadArrays() {
431
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
432
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
433
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
434
- r[k] = a[j];
435
- return r;
436
427
  }
437
428
 
429
+ var toString = {}.toString;
430
+ var isType = function (value, type) { return toString.call(value) === '[object ' + type + ']'; };
431
+
432
+ // isFinite,
433
+ var isNil = function (value) {
434
+ /**
435
+ * isNil(null) => true
436
+ * isNil() => true
437
+ */
438
+ return value === null || value === undefined;
439
+ };
440
+
441
+ var isString = (function (str) {
442
+ return isType(str, 'String');
443
+ });
444
+
445
+ var clamp = function (a, min, max) {
446
+ if (a < min) {
447
+ return min;
448
+ }
449
+ else if (a > max) {
450
+ return max;
451
+ }
452
+ return a;
453
+ };
454
+
438
455
  function _inheritsLoose$1(subClass, superClass) {
439
456
  subClass.prototype = Object.create(superClass.prototype);
440
457
  subClass.prototype.constructor = subClass;
@@ -691,158 +708,6 @@
691
708
  context.lineTo(x2 + endOffsetX, y2 + endOffsetY);
692
709
  }
693
710
 
694
- var toString = {}.toString;
695
-
696
- var isType = function isType(value, type) {
697
- return toString.call(value) === '[object ' + type + ']';
698
- };
699
- /**
700
- * 是否为函数
701
- * @param {*} fn 对象
702
- * @return {Boolean} 是否函数
703
- */
704
-
705
-
706
- var isFunction = function isFunction(value) {
707
- return isType(value, 'Function');
708
- };
709
-
710
- var isArray = function isArray(value) {
711
- return Array.isArray ? Array.isArray(value) : isType(value, 'Array');
712
- };
713
-
714
- var isObject = function isObject(value) {
715
- /**
716
- * isObject({}) => true
717
- * isObject([1, 2, 3]) => true
718
- * isObject(Function) => true
719
- * isObject(null) => false
720
- */
721
- var type = typeof value;
722
- return value !== null && type === 'object' || type === 'function';
723
- };
724
-
725
- function each(elements, func) {
726
- if (!elements) {
727
- return;
728
- }
729
-
730
- var rst;
731
-
732
- if (isArray(elements)) {
733
- for (var i = 0, len = elements.length; i < len; i++) {
734
- rst = func(elements[i], i);
735
-
736
- if (rst === false) {
737
- break;
738
- }
739
- }
740
- } else if (isObject(elements)) {
741
- for (var k in elements) {
742
- if (elements.hasOwnProperty(k)) {
743
- rst = func(elements[k], k);
744
-
745
- if (rst === false) {
746
- break;
747
- }
748
- }
749
- }
750
- }
751
- }
752
-
753
- var isString = function isString(str) {
754
- return isType(str, 'String');
755
- };
756
-
757
- var clamp = function clamp(a, min, max) {
758
- if (a < min) {
759
- return min;
760
- } else if (a > max) {
761
- return max;
762
- }
763
-
764
- return a;
765
- }; // @ts-ignore
766
-
767
-
768
- var values = Object.values ? function (obj) {
769
- return Object.values(obj);
770
- } : function (obj) {
771
- var result = [];
772
- each(obj, function (value, key) {
773
- if (!(isFunction(obj) && key === 'prototype')) {
774
- result.push(value);
775
- }
776
- });
777
- return result;
778
- };
779
- /**
780
- * _.memoize(calColor);
781
- * _.memoize(calColor, (...args) => args[0]);
782
- * @param f
783
- * @param resolver
784
- */
785
-
786
- var memoize = function memoize(f, resolver) {
787
- if (!isFunction(f)) {
788
- throw new TypeError('Expected a function');
789
- }
790
-
791
- var memoized = function memoized() {
792
- var args = [];
793
-
794
- for (var _i = 0; _i < arguments.length; _i++) {
795
- args[_i] = arguments[_i];
796
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
797
-
798
-
799
- var key = resolver ? resolver.apply(this, args) : args[0];
800
- var cache = memoized.cache;
801
-
802
- if (cache.has(key)) {
803
- return cache.get(key);
804
- }
805
-
806
- var result = f.apply(this, args); // 缓存起来
807
-
808
- cache.set(key, result);
809
- return result;
810
- };
811
-
812
- memoized.cache = new Map();
813
- return memoized;
814
- };
815
-
816
- var ctx;
817
- /**
818
- * 计算文本的宽度
819
- */
820
-
821
- memoize(function (text, font) {
822
- if (font === void 0) {
823
- font = {};
824
- }
825
-
826
- var fontSize = font.fontSize,
827
- fontFamily = font.fontFamily,
828
- fontWeight = font.fontWeight,
829
- fontStyle = font.fontStyle,
830
- fontVariant = font.fontVariant;
831
-
832
- if (!ctx) {
833
- ctx = document.createElement('canvas').getContext('2d');
834
- }
835
-
836
- ctx.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
837
- return ctx.measureText(isString(text) ? text : '').width;
838
- }, function (text, font) {
839
- if (font === void 0) {
840
- font = {};
841
- }
842
-
843
- return __spreadArrays([text], values(font)).join('');
844
- });
845
-
846
711
  function generatePath$6(context, parsedStyle) {
847
712
  var radius = parsedStyle.radius,
848
713
  width = parsedStyle.width,
@@ -998,16 +863,6 @@
998
863
  Plugin: Plugin
999
864
  });
1000
865
 
1001
- var clamp$1 = function (a, min, max) {
1002
- if (a < min) {
1003
- return min;
1004
- }
1005
- else if (a > max) {
1006
- return max;
1007
- }
1008
- return a;
1009
- };
1010
-
1011
866
  function _regeneratorRuntime$1() {
1012
867
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
1013
868
  _regeneratorRuntime$1 = function _regeneratorRuntime() {
@@ -2856,7 +2711,7 @@
2856
2711
 
2857
2712
  if (hasStroke || isClipPath) {
2858
2713
  isHit = inRectWithRadius(0, 0, width, height, radius.map(function (r) {
2859
- return clamp$1(r, 0, Math.min(Math.abs(width) / 2, Math.abs(height) / 2));
2714
+ return clamp(r, 0, Math.min(Math.abs(width) / 2, Math.abs(height) / 2));
2860
2715
  }), lineWidthForHitTesting, position.x, position.y);
2861
2716
  } // 仅填充时带有圆角的矩形直接通过图形拾取
2862
2717
  // 以后可以改成纯数学的近似拾取,将圆弧切割成多边形
@@ -3347,148 +3202,6 @@
3347
3202
  return _setPrototypeOf$3(o, p);
3348
3203
  }
3349
3204
 
3350
- var toString$1 = {}.toString;
3351
-
3352
- var isType$1 = function isType(value, type) {
3353
- return toString$1.call(value) === '[object ' + type + ']';
3354
- };
3355
- /**
3356
- * 是否为函数
3357
- * @param {*} fn 对象
3358
- * @return {Boolean} 是否函数
3359
- */
3360
-
3361
-
3362
- var isFunction$1 = function isFunction(value) {
3363
- return isType$1(value, 'Function');
3364
- };
3365
-
3366
- var isArray$1 = function isArray(value) {
3367
- return Array.isArray ? Array.isArray(value) : isType$1(value, 'Array');
3368
- };
3369
-
3370
- var isObject$1 = function isObject(value) {
3371
- /**
3372
- * isObject({}) => true
3373
- * isObject([1, 2, 3]) => true
3374
- * isObject(Function) => true
3375
- * isObject(null) => false
3376
- */
3377
- var type = typeof value;
3378
- return value !== null && type === 'object' || type === 'function';
3379
- };
3380
-
3381
- function each$1(elements, func) {
3382
- if (!elements) {
3383
- return;
3384
- }
3385
-
3386
- var rst;
3387
-
3388
- if (isArray$1(elements)) {
3389
- for (var i = 0, len = elements.length; i < len; i++) {
3390
- rst = func(elements[i], i);
3391
-
3392
- if (rst === false) {
3393
- break;
3394
- }
3395
- }
3396
- } else if (isObject$1(elements)) {
3397
- for (var k in elements) {
3398
- if (elements.hasOwnProperty(k)) {
3399
- rst = func(elements[k], k);
3400
-
3401
- if (rst === false) {
3402
- break;
3403
- }
3404
- }
3405
- }
3406
- }
3407
- }
3408
-
3409
- var isString$1 = function isString(str) {
3410
- return isType$1(str, 'String');
3411
- }; // @ts-ignore
3412
-
3413
-
3414
- var values$1 = Object.values ? function (obj) {
3415
- return Object.values(obj);
3416
- } : function (obj) {
3417
- var result = [];
3418
- each$1(obj, function (value, key) {
3419
- if (!(isFunction$1(obj) && key === 'prototype')) {
3420
- result.push(value);
3421
- }
3422
- });
3423
- return result;
3424
- };
3425
- /**
3426
- * _.memoize(calColor);
3427
- * _.memoize(calColor, (...args) => args[0]);
3428
- * @param f
3429
- * @param resolver
3430
- */
3431
-
3432
- var memoize$1 = function memoize(f, resolver) {
3433
- if (!isFunction$1(f)) {
3434
- throw new TypeError('Expected a function');
3435
- }
3436
-
3437
- var memoized = function memoized() {
3438
- var args = [];
3439
-
3440
- for (var _i = 0; _i < arguments.length; _i++) {
3441
- args[_i] = arguments[_i];
3442
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
3443
-
3444
-
3445
- var key = resolver ? resolver.apply(this, args) : args[0];
3446
- var cache = memoized.cache;
3447
-
3448
- if (cache.has(key)) {
3449
- return cache.get(key);
3450
- }
3451
-
3452
- var result = f.apply(this, args); // 缓存起来
3453
-
3454
- cache.set(key, result);
3455
- return result;
3456
- };
3457
-
3458
- memoized.cache = new Map();
3459
- return memoized;
3460
- };
3461
-
3462
- var ctx$1;
3463
- /**
3464
- * 计算文本的宽度
3465
- */
3466
-
3467
- memoize$1(function (text, font) {
3468
- if (font === void 0) {
3469
- font = {};
3470
- }
3471
-
3472
- var fontSize = font.fontSize,
3473
- fontFamily = font.fontFamily,
3474
- fontWeight = font.fontWeight,
3475
- fontStyle = font.fontStyle,
3476
- fontVariant = font.fontVariant;
3477
-
3478
- if (!ctx$1) {
3479
- ctx$1 = document.createElement('canvas').getContext('2d');
3480
- }
3481
-
3482
- ctx$1.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
3483
- return ctx$1.measureText(isString$1(text) ? text : '').width;
3484
- }, function (text, font) {
3485
- if (font === void 0) {
3486
- font = {};
3487
- }
3488
-
3489
- return __spreadArrays([text], values$1(font)).join('');
3490
- });
3491
-
3492
3205
  var ImagePool = /*#__PURE__*/function () {
3493
3206
  function ImagePool(canvasConfig) {
3494
3207
  this.canvasConfig = void 0;
@@ -3561,7 +3274,7 @@
3561
3274
  repetition = pattern.repetition;
3562
3275
  var src; // Image URL
3563
3276
 
3564
- if (isString$1(image)) {
3277
+ if (isString(image)) {
3565
3278
  src = this.getImageSync(image, callback);
3566
3279
  } else {
3567
3280
  src = image;
@@ -3645,7 +3358,7 @@
3645
3358
  var image = pattern.image,
3646
3359
  repetition = pattern.repetition; // only generate cache for Image
3647
3360
 
3648
- if (isString$1(image)) {
3361
+ if (isString(image)) {
3649
3362
  return "pattern-" + image + "-" + repetition;
3650
3363
  }
3651
3364
  };
@@ -3679,7 +3392,7 @@
3679
3392
  if (nodeName === gLite.Shape.IMAGE) {
3680
3393
  var img = attributes.img;
3681
3394
 
3682
- if (isString$1(img)) {
3395
+ if (isString(img)) {
3683
3396
  _this.imagePool.getImageSync(img, function () {
3684
3397
  // set dirty rectangle flag
3685
3398
  object.renderable.dirty = true;
@@ -3696,7 +3409,7 @@
3696
3409
 
3697
3410
  if (object.nodeName === gLite.Shape.IMAGE) {
3698
3411
  if (attrName === 'img') {
3699
- if (isString$1(newValue)) {
3412
+ if (isString(newValue)) {
3700
3413
  _this.imagePool.getOrCreateImage(newValue).then(function () {
3701
3414
  // set dirty rectangle flag
3702
3415
  object.renderable.dirty = true;
@@ -4191,162 +3904,12 @@
4191
3904
  };
4192
3905
  return _setPrototypeOf$4(o, p);
4193
3906
  }
4194
-
4195
- var toString$2 = {}.toString;
4196
-
4197
- var isType$2 = function isType(value, type) {
4198
- return toString$2.call(value) === '[object ' + type + ']';
4199
- };
4200
- /**
4201
- * 是否为函数
4202
- * @param {*} fn 对象
4203
- * @return {Boolean} 是否函数
4204
- */
4205
-
4206
-
4207
- var isFunction$2 = function isFunction(value) {
4208
- return isType$2(value, 'Function');
4209
- }; // isFinite,
4210
-
4211
-
4212
- var isNil = function isNil(value) {
4213
- /**
4214
- * isNil(null) => true
4215
- * isNil() => true
4216
- */
4217
- return value === null || value === undefined;
4218
- };
4219
-
4220
- var isArray$2 = function isArray(value) {
4221
- return Array.isArray ? Array.isArray(value) : isType$2(value, 'Array');
4222
- };
4223
-
4224
- var isObject$2 = function isObject(value) {
4225
- /**
4226
- * isObject({}) => true
4227
- * isObject([1, 2, 3]) => true
4228
- * isObject(Function) => true
4229
- * isObject(null) => false
4230
- */
4231
- var type = typeof value;
4232
- return value !== null && type === 'object' || type === 'function';
4233
- };
4234
-
4235
- function each$2(elements, func) {
4236
- if (!elements) {
4237
- return;
4238
- }
4239
-
4240
- var rst;
4241
-
4242
- if (isArray$2(elements)) {
4243
- for (var i = 0, len = elements.length; i < len; i++) {
4244
- rst = func(elements[i], i);
4245
-
4246
- if (rst === false) {
4247
- break;
4248
- }
4249
- }
4250
- } else if (isObject$2(elements)) {
4251
- for (var k in elements) {
4252
- if (elements.hasOwnProperty(k)) {
4253
- rst = func(elements[k], k);
4254
-
4255
- if (rst === false) {
4256
- break;
4257
- }
4258
- }
4259
- }
4260
- }
4261
- }
4262
-
4263
- var isString$2 = function isString(str) {
4264
- return isType$2(str, 'String');
4265
- }; // @ts-ignore
4266
-
4267
-
4268
- var values$2 = Object.values ? function (obj) {
4269
- return Object.values(obj);
4270
- } : function (obj) {
4271
- var result = [];
4272
- each$2(obj, function (value, key) {
4273
- if (!(isFunction$2(obj) && key === 'prototype')) {
4274
- result.push(value);
4275
- }
4276
- });
4277
- return result;
4278
- };
4279
- /**
4280
- * _.memoize(calColor);
4281
- * _.memoize(calColor, (...args) => args[0]);
4282
- * @param f
4283
- * @param resolver
4284
- */
4285
-
4286
- var memoize$2 = function memoize(f, resolver) {
4287
- if (!isFunction$2(f)) {
4288
- throw new TypeError('Expected a function');
4289
- }
4290
-
4291
- var memoized = function memoized() {
4292
- var args = [];
4293
-
4294
- for (var _i = 0; _i < arguments.length; _i++) {
4295
- args[_i] = arguments[_i];
4296
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
4297
-
4298
-
4299
- var key = resolver ? resolver.apply(this, args) : args[0];
4300
- var cache = memoized.cache;
4301
-
4302
- if (cache.has(key)) {
4303
- return cache.get(key);
4304
- }
4305
-
4306
- var result = f.apply(this, args); // 缓存起来
4307
-
4308
- cache.set(key, result);
4309
- return result;
4310
- };
4311
-
4312
- memoized.cache = new Map();
4313
- return memoized;
4314
- };
4315
-
4316
- var ctx$2;
4317
- /**
4318
- * 计算文本的宽度
4319
- */
4320
-
4321
- memoize$2(function (text, font) {
4322
- if (font === void 0) {
4323
- font = {};
4324
- }
4325
-
4326
- var fontSize = font.fontSize,
4327
- fontFamily = font.fontFamily,
4328
- fontWeight = font.fontWeight,
4329
- fontStyle = font.fontStyle,
4330
- fontVariant = font.fontVariant;
4331
-
4332
- if (!ctx$2) {
4333
- ctx$2 = document.createElement('canvas').getContext('2d');
4334
- }
4335
-
4336
- ctx$2.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
4337
- return ctx$2.measureText(isString$2(text) ? text : '').width;
4338
- }, function (text, font) {
4339
- if (font === void 0) {
4340
- font = {};
4341
- }
4342
-
4343
- return __spreadArrays([text], values$2(font)).join('');
4344
- });
4345
3907
  /**
4346
3908
  * Common utilities
4347
3909
  * @module glMatrix
4348
3910
  */
4349
3911
 
3912
+
4350
3913
  var ARRAY_TYPE$1 = typeof Float32Array !== 'undefined' ? Float32Array : Array;
4351
3914
  if (!Math.hypot) Math.hypot = function () {
4352
3915
  var y = 0,
@@ -4912,7 +4475,7 @@
4912
4475
  var iw = width;
4913
4476
  var ih = height;
4914
4477
 
4915
- if (isString$2(img)) {
4478
+ if (isString(img)) {
4916
4479
  // image has been loaded in `mounted` hook
4917
4480
  image = this.imagePool.getImageSync(img);
4918
4481
  } else {
@@ -6818,148 +6381,6 @@
6818
6381
  return _setPrototypeOf$6(o, p);
6819
6382
  }
6820
6383
 
6821
- var toString$3 = {}.toString;
6822
-
6823
- var isType$3 = function isType(value, type) {
6824
- return toString$3.call(value) === '[object ' + type + ']';
6825
- };
6826
- /**
6827
- * 是否为函数
6828
- * @param {*} fn 对象
6829
- * @return {Boolean} 是否函数
6830
- */
6831
-
6832
-
6833
- var isFunction$3 = function isFunction(value) {
6834
- return isType$3(value, 'Function');
6835
- };
6836
-
6837
- var isArray$3 = function isArray(value) {
6838
- return Array.isArray ? Array.isArray(value) : isType$3(value, 'Array');
6839
- };
6840
-
6841
- var isObject$3 = function isObject(value) {
6842
- /**
6843
- * isObject({}) => true
6844
- * isObject([1, 2, 3]) => true
6845
- * isObject(Function) => true
6846
- * isObject(null) => false
6847
- */
6848
- var type = typeof value;
6849
- return value !== null && type === 'object' || type === 'function';
6850
- };
6851
-
6852
- function each$3(elements, func) {
6853
- if (!elements) {
6854
- return;
6855
- }
6856
-
6857
- var rst;
6858
-
6859
- if (isArray$3(elements)) {
6860
- for (var i = 0, len = elements.length; i < len; i++) {
6861
- rst = func(elements[i], i);
6862
-
6863
- if (rst === false) {
6864
- break;
6865
- }
6866
- }
6867
- } else if (isObject$3(elements)) {
6868
- for (var k in elements) {
6869
- if (elements.hasOwnProperty(k)) {
6870
- rst = func(elements[k], k);
6871
-
6872
- if (rst === false) {
6873
- break;
6874
- }
6875
- }
6876
- }
6877
- }
6878
- }
6879
-
6880
- var isString$3 = function isString(str) {
6881
- return isType$3(str, 'String');
6882
- }; // @ts-ignore
6883
-
6884
-
6885
- var values$3 = Object.values ? function (obj) {
6886
- return Object.values(obj);
6887
- } : function (obj) {
6888
- var result = [];
6889
- each$3(obj, function (value, key) {
6890
- if (!(isFunction$3(obj) && key === 'prototype')) {
6891
- result.push(value);
6892
- }
6893
- });
6894
- return result;
6895
- };
6896
- /**
6897
- * _.memoize(calColor);
6898
- * _.memoize(calColor, (...args) => args[0]);
6899
- * @param f
6900
- * @param resolver
6901
- */
6902
-
6903
- var memoize$3 = function memoize(f, resolver) {
6904
- if (!isFunction$3(f)) {
6905
- throw new TypeError('Expected a function');
6906
- }
6907
-
6908
- var memoized = function memoized() {
6909
- var args = [];
6910
-
6911
- for (var _i = 0; _i < arguments.length; _i++) {
6912
- args[_i] = arguments[_i];
6913
- } // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
6914
-
6915
-
6916
- var key = resolver ? resolver.apply(this, args) : args[0];
6917
- var cache = memoized.cache;
6918
-
6919
- if (cache.has(key)) {
6920
- return cache.get(key);
6921
- }
6922
-
6923
- var result = f.apply(this, args); // 缓存起来
6924
-
6925
- cache.set(key, result);
6926
- return result;
6927
- };
6928
-
6929
- memoized.cache = new Map();
6930
- return memoized;
6931
- };
6932
-
6933
- var ctx$3;
6934
- /**
6935
- * 计算文本的宽度
6936
- */
6937
-
6938
- memoize$3(function (text, font) {
6939
- if (font === void 0) {
6940
- font = {};
6941
- }
6942
-
6943
- var fontSize = font.fontSize,
6944
- fontFamily = font.fontFamily,
6945
- fontWeight = font.fontWeight,
6946
- fontStyle = font.fontStyle,
6947
- fontVariant = font.fontVariant;
6948
-
6949
- if (!ctx$3) {
6950
- ctx$3 = document.createElement('canvas').getContext('2d');
6951
- }
6952
-
6953
- ctx$3.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
6954
- return ctx$3.measureText(isString$3(text) ? text : '').width;
6955
- }, function (text, font) {
6956
- if (font === void 0) {
6957
- font = {};
6958
- }
6959
-
6960
- return __spreadArrays([text], values$3(font)).join('');
6961
- });
6962
-
6963
6384
  var _class$4;
6964
6385
 
6965
6386
  var HTMLRenderingPlugin_1;
@@ -7122,7 +6543,7 @@
7122
6543
  case 'innerHTML':
7123
6544
  var innerHTML = object.parsedStyle.innerHTML;
7124
6545
 
7125
- if (isString$3(innerHTML)) {
6546
+ if (isString(innerHTML)) {
7126
6547
  $el.innerHTML = innerHTML;
7127
6548
  } else {
7128
6549
  $el.innerHTML = '';
@@ -7259,122 +6680,6 @@
7259
6680
  Plugin: Plugin$5
7260
6681
  });
7261
6682
 
7262
- var toString$4 = {}.toString;
7263
- var isType$4 = function (value, type) { return toString$4.call(value) === '[object ' + type + ']'; };
7264
-
7265
- /**
7266
- * 是否为函数
7267
- * @param {*} fn 对象
7268
- * @return {Boolean} 是否函数
7269
- */
7270
- var isFunction$4 = (function (value) {
7271
- return isType$4(value, 'Function');
7272
- });
7273
-
7274
- var isArray$4 = (function (value) {
7275
- return Array.isArray ?
7276
- Array.isArray(value) :
7277
- isType$4(value, 'Array');
7278
- });
7279
-
7280
- var isObject$4 = (function (value) {
7281
- /**
7282
- * isObject({}) => true
7283
- * isObject([1, 2, 3]) => true
7284
- * isObject(Function) => true
7285
- * isObject(null) => false
7286
- */
7287
- var type = typeof value;
7288
- return value !== null && type === 'object' || type === 'function';
7289
- });
7290
-
7291
- function each$4(elements, func) {
7292
- if (!elements) {
7293
- return;
7294
- }
7295
- var rst;
7296
- if (isArray$4(elements)) {
7297
- for (var i = 0, len = elements.length; i < len; i++) {
7298
- rst = func(elements[i], i);
7299
- if (rst === false) {
7300
- break;
7301
- }
7302
- }
7303
- }
7304
- else if (isObject$4(elements)) {
7305
- for (var k in elements) {
7306
- if (elements.hasOwnProperty(k)) {
7307
- rst = func(elements[k], k);
7308
- if (rst === false) {
7309
- break;
7310
- }
7311
- }
7312
- }
7313
- }
7314
- }
7315
-
7316
- var isString$4 = (function (str) {
7317
- return isType$4(str, 'String');
7318
- });
7319
-
7320
- // @ts-ignore
7321
- var values$4 = Object.values ? function (obj) { return Object.values(obj); } : function (obj) {
7322
- var result = [];
7323
- each$4(obj, function (value, key) {
7324
- if (!(isFunction$4(obj) && key === 'prototype')) {
7325
- result.push(value);
7326
- }
7327
- });
7328
- return result;
7329
- };
7330
-
7331
- /**
7332
- * _.memoize(calColor);
7333
- * _.memoize(calColor, (...args) => args[0]);
7334
- * @param f
7335
- * @param resolver
7336
- */
7337
- var memoize$4 = (function (f, resolver) {
7338
- if (!isFunction$4(f)) {
7339
- throw new TypeError('Expected a function');
7340
- }
7341
- var memoized = function () {
7342
- var args = [];
7343
- for (var _i = 0; _i < arguments.length; _i++) {
7344
- args[_i] = arguments[_i];
7345
- }
7346
- // 使用方法构造 key,如果不存在 resolver,则直接取第一个参数作为 key
7347
- var key = resolver ? resolver.apply(this, args) : args[0];
7348
- var cache = memoized.cache;
7349
- if (cache.has(key)) {
7350
- return cache.get(key);
7351
- }
7352
- var result = f.apply(this, args);
7353
- // 缓存起来
7354
- cache.set(key, result);
7355
- return result;
7356
- };
7357
- memoized.cache = new Map();
7358
- return memoized;
7359
- });
7360
-
7361
- var ctx$4;
7362
- /**
7363
- * 计算文本的宽度
7364
- */
7365
- memoize$4(function (text, font) {
7366
- if (font === void 0) { font = {}; }
7367
- var fontSize = font.fontSize, fontFamily = font.fontFamily, fontWeight = font.fontWeight, fontStyle = font.fontStyle, fontVariant = font.fontVariant;
7368
- if (!ctx$4) {
7369
- ctx$4 = document.createElement('canvas').getContext('2d');
7370
- }
7371
- ctx$4.font = [fontStyle, fontVariant, fontWeight, fontSize + "px", fontFamily].join(' ');
7372
- return ctx$4.measureText(isString$4(text) ? text : '').width;
7373
- }, function (text, font) {
7374
- if (font === void 0) { font = {}; }
7375
- return __spreadArrays([text], values$4(font)).join('');
7376
- });
7377
-
7378
6683
  var Canvas2DContextService = /*#__PURE__*/function () {
7379
6684
  function Canvas2DContextService(canvasConfig) {
7380
6685
  this.canvasConfig = void 0;
@@ -7408,7 +6713,7 @@
7408
6713
  this.canvasConfig.container = this.$container;
7409
6714
  } else if (container) {
7410
6715
  // create container
7411
- this.$container = isString$4(container) ? document.getElementById(container) : container;
6716
+ this.$container = isString(container) ? document.getElementById(container) : container;
7412
6717
 
7413
6718
  if (this.$container) {
7414
6719
  // create canvas