@visactor/vrender 0.17.8-alpha.0 → 0.17.9

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.js CHANGED
@@ -2728,6 +2728,63 @@
2728
2728
  out.a = scaleX * a1, out.b = scaleX * b1, out.c = scaleY * c1, out.d = scaleY * d1, out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY, out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
2729
2729
  }
2730
2730
 
2731
+ var LRU = /*#__PURE__*/function () {
2732
+ function LRU() {
2733
+ _classCallCheck(this, LRU);
2734
+ this.CLEAN_THRESHOLD = 1e3, this.L_TIME = 1e3, this.R_COUNT = 1, this.R_TIMESTAMP_MAX_SIZE = 20;
2735
+ }
2736
+ _createClass(LRU, [{
2737
+ key: "clearCache",
2738
+ value: function clearCache(cache, params) {
2739
+ var _params$CLEAN_THRESHO = params.CLEAN_THRESHOLD,
2740
+ CLEAN_THRESHOLD = _params$CLEAN_THRESHO === void 0 ? this.CLEAN_THRESHOLD : _params$CLEAN_THRESHO,
2741
+ _params$L_TIME = params.L_TIME,
2742
+ L_TIME = _params$L_TIME === void 0 ? this.L_TIME : _params$L_TIME,
2743
+ _params$R_COUNT = params.R_COUNT,
2744
+ R_COUNT = _params$R_COUNT === void 0 ? this.R_COUNT : _params$R_COUNT;
2745
+ if (cache.size < CLEAN_THRESHOLD) return 0;
2746
+ var clearNum = 0;
2747
+ var clear = function clear(key) {
2748
+ clearNum++, cache["delete"](key);
2749
+ },
2750
+ now = Date.now();
2751
+ return cache.forEach(function (item, key) {
2752
+ if (item.timestamp.length < R_COUNT) return clear(key);
2753
+ var useCount = 0;
2754
+ for (; now - item.timestamp[item.timestamp.length - 1 - useCount] < L_TIME && (useCount++, !(useCount >= R_COUNT)););
2755
+ if (useCount < R_COUNT) return clear(key);
2756
+ for (; now - item.timestamp[0] > L_TIME;) item.timestamp.shift();
2757
+ }), clearNum;
2758
+ }
2759
+ }, {
2760
+ key: "addLimitedTimestamp",
2761
+ value: function addLimitedTimestamp(cacheItem, t, params) {
2762
+ var _params$R_TIMESTAMP_M = params.R_TIMESTAMP_MAX_SIZE,
2763
+ R_TIMESTAMP_MAX_SIZE = _params$R_TIMESTAMP_M === void 0 ? this.R_TIMESTAMP_MAX_SIZE : _params$R_TIMESTAMP_M;
2764
+ cacheItem.timestamp.length > R_TIMESTAMP_MAX_SIZE && cacheItem.timestamp.shift(), cacheItem.timestamp.push(t);
2765
+ }
2766
+ }, {
2767
+ key: "clearTimeStamp",
2768
+ value: function clearTimeStamp(cache, params) {
2769
+ var _params$L_TIME2 = params.L_TIME,
2770
+ L_TIME = _params$L_TIME2 === void 0 ? this.L_TIME : _params$L_TIME2,
2771
+ now = Date.now();
2772
+ cache.forEach(function (item) {
2773
+ for (; now - item.timestamp[0] > L_TIME;) item.timestamp.shift();
2774
+ });
2775
+ }
2776
+ }, {
2777
+ key: "clearItemTimestamp",
2778
+ value: function clearItemTimestamp(cacheItem, params) {
2779
+ var _params$L_TIME3 = params.L_TIME,
2780
+ L_TIME = _params$L_TIME3 === void 0 ? this.L_TIME : _params$L_TIME3,
2781
+ now = Date.now();
2782
+ for (; now - cacheItem.timestamp[0] > L_TIME;) cacheItem.timestamp.shift();
2783
+ }
2784
+ }]);
2785
+ return LRU;
2786
+ }();
2787
+
2731
2788
  function hslToRgb(h, s, l) {
2732
2789
  s /= 100, l /= 100;
2733
2790
  var c = (1 - Math.abs(2 * l - 1)) * s,
@@ -3264,7 +3321,7 @@
3264
3321
  key: "initContext",
3265
3322
  value: function initContext() {
3266
3323
  if (this._notSupportCanvas) return !1;
3267
- if (isNil$1(this._canvas) && (isValid$1(this._option.getCanvasForMeasure) && (this._canvas = this._option.getCanvasForMeasure()), isNil$1(this._canvas) && "undefined" != typeof window && void 0 !== window.document && isValid$1(globalThis.document) && (this._canvas = globalThis.document.createElement("canvas"))), isNil$1(this._context) && isValid$1(this._canvas)) {
3324
+ if (isNil$1(this._canvas) && (isValid$1(this._option.getCanvasForMeasure) && (this._canvas = this._option.getCanvasForMeasure()), isNil$1(this._canvas) && "undefined" != typeof window && void 0 !== window.document && globalThis && isValid$1(globalThis.document) && (this._canvas = globalThis.document.createElement("canvas"))), isNil$1(this._context) && isValid$1(this._canvas)) {
3268
3325
  var context = this._canvas.getContext("2d");
3269
3326
  isValid$1(context) && (context.save(), context.font = getContextFont$1(this.textSpec), this._contextSaved = !0, this._context = context);
3270
3327
  }
@@ -6196,6 +6253,168 @@
6196
6253
  },
6197
6254
  __metadata$1d = undefined && undefined.__metadata || function (k, v) {
6198
6255
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
6256
+ };
6257
+ var VWindow = Symbol["for"]("VWindow");
6258
+ var WindowHandlerContribution = Symbol["for"]("WindowHandlerContribution");
6259
+ exports.DefaultWindow = /*#__PURE__*/function () {
6260
+ function DefaultWindow() {
6261
+ _classCallCheck(this, DefaultWindow);
6262
+ this.hooks = {
6263
+ onChange: new SyncHook(["x", "y", "width", "height"])
6264
+ }, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
6265
+ }
6266
+ _createClass(DefaultWindow, [{
6267
+ key: "width",
6268
+ get: function get() {
6269
+ if (this._handler) {
6270
+ var wh = this._handler.getWH();
6271
+ return this._width = wh.width;
6272
+ }
6273
+ return this._width;
6274
+ }
6275
+ }, {
6276
+ key: "height",
6277
+ get: function get() {
6278
+ if (this._handler) {
6279
+ var wh = this._handler.getWH();
6280
+ return this._height = wh.height;
6281
+ }
6282
+ return this._height;
6283
+ }
6284
+ }, {
6285
+ key: "dpr",
6286
+ get: function get() {
6287
+ return this._handler.getDpr();
6288
+ }
6289
+ }, {
6290
+ key: "postInit",
6291
+ value: function postInit() {
6292
+ var _this = this;
6293
+ this.global.hooks.onSetEnv.tap("window", function () {
6294
+ _this.active();
6295
+ }), this.active();
6296
+ }
6297
+ }, {
6298
+ key: "active",
6299
+ value: function active() {
6300
+ var global = this.global;
6301
+ if (!global.env || this.actived) return;
6302
+ container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
6303
+ }
6304
+ }, {
6305
+ key: "style",
6306
+ get: function get() {
6307
+ return this._handler.getStyle();
6308
+ },
6309
+ set: function set(style) {
6310
+ this._handler.setStyle(style);
6311
+ }
6312
+ }, {
6313
+ key: "create",
6314
+ value: function create(params) {
6315
+ this._handler.createWindow(params);
6316
+ var windowWH = this._handler.getWH();
6317
+ this._width = windowWH.width, this._height = windowWH.height, this.title = this._handler.getTitle(), this.resizable = !0;
6318
+ }
6319
+ }, {
6320
+ key: "setWindowHandler",
6321
+ value: function setWindowHandler(handler) {
6322
+ this._handler = handler;
6323
+ }
6324
+ }, {
6325
+ key: "setDpr",
6326
+ value: function setDpr(dpr) {
6327
+ return this._handler.setDpr(dpr);
6328
+ }
6329
+ }, {
6330
+ key: "resize",
6331
+ value: function resize(w, h) {
6332
+ return this._handler.resizeWindow(w, h);
6333
+ }
6334
+ }, {
6335
+ key: "configure",
6336
+ value: function configure() {
6337
+ throw new Error("暂不支持");
6338
+ }
6339
+ }, {
6340
+ key: "release",
6341
+ value: function release() {
6342
+ return this._handler.releaseWindow();
6343
+ }
6344
+ }, {
6345
+ key: "getContext",
6346
+ value: function getContext() {
6347
+ return this._handler.getContext();
6348
+ }
6349
+ }, {
6350
+ key: "getNativeHandler",
6351
+ value: function getNativeHandler() {
6352
+ return this._handler.getNativeHandler();
6353
+ }
6354
+ }, {
6355
+ key: "getImageBuffer",
6356
+ value: function getImageBuffer(type) {
6357
+ return this._handler.getImageBuffer ? this._handler.getImageBuffer(type) : null;
6358
+ }
6359
+ }, {
6360
+ key: "addEventListener",
6361
+ value: function addEventListener(type, listener, options) {
6362
+ return this._handler.addEventListener(type, listener, options);
6363
+ }
6364
+ }, {
6365
+ key: "removeEventListener",
6366
+ value: function removeEventListener(type, listener, options) {
6367
+ return this._handler.removeEventListener(type, listener, options);
6368
+ }
6369
+ }, {
6370
+ key: "dispatchEvent",
6371
+ value: function dispatchEvent(event) {
6372
+ return this._handler.dispatchEvent(event);
6373
+ }
6374
+ }, {
6375
+ key: "getBoundingClientRect",
6376
+ value: function getBoundingClientRect() {
6377
+ return this._handler.getBoundingClientRect();
6378
+ }
6379
+ }, {
6380
+ key: "getContainer",
6381
+ value: function getContainer() {
6382
+ return this._handler.container;
6383
+ }
6384
+ }, {
6385
+ key: "clearViewBox",
6386
+ value: function clearViewBox(viewBox, color) {
6387
+ this._handler.clearViewBox(viewBox, color);
6388
+ }
6389
+ }, {
6390
+ key: "isVisible",
6391
+ value: function isVisible(bbox) {
6392
+ return this._handler.isVisible(bbox);
6393
+ }
6394
+ }, {
6395
+ key: "onVisibleChange",
6396
+ value: function onVisibleChange(cb) {
6397
+ return this._handler.onVisibleChange(cb);
6398
+ }
6399
+ }, {
6400
+ key: "getTopLeft",
6401
+ value: function getTopLeft(baseWindow) {
6402
+ return this._handler.getTopLeft(baseWindow);
6403
+ }
6404
+ }]);
6405
+ return DefaultWindow;
6406
+ }();
6407
+ exports.DefaultWindow = __decorate$1A([injectable(), __metadata$1d("design:paramtypes", [])], exports.DefaultWindow);
6408
+
6409
+ var __decorate$1z = undefined && undefined.__decorate || function (decorators, target, key, desc) {
6410
+ var d,
6411
+ c = arguments.length,
6412
+ r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
6413
+ if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
6414
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6415
+ },
6416
+ __metadata$1c = undefined && undefined.__metadata || function (k, v) {
6417
+ if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
6199
6418
  },
6200
6419
  __param$Q = undefined && undefined.__param || function (paramIndex, decorator) {
6201
6420
  return function (target, key) {
@@ -6276,10 +6495,45 @@
6276
6495
  specialCharSet: "-/: .,@%'\"~" + TextMeasure.ALPHABET_CHAR_SET + TextMeasure.ALPHABET_CHAR_SET.toUpperCase()
6277
6496
  }, null != option ? option : {}), textSpec);
6278
6497
  }
6498
+ }, {
6499
+ key: "drawGraphicToCanvas",
6500
+ value: function drawGraphicToCanvas(graphic, stage, canvas) {
6501
+ if (!stage.defaultLayer) return null;
6502
+ var window = container.get(VWindow),
6503
+ bounds = graphic.AABBBounds,
6504
+ width = bounds.width(),
6505
+ height = bounds.height();
6506
+ window.create({
6507
+ width: width,
6508
+ height: height,
6509
+ canvas: canvas,
6510
+ dpr: stage.window.dpr,
6511
+ canvasControled: !0,
6512
+ offscreen: !0,
6513
+ title: ""
6514
+ });
6515
+ var x = -bounds.x1,
6516
+ y = -bounds.y1,
6517
+ disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
6518
+ stage.params.optimize.disableCheckGraphicWidthOutRange = !0, stage.defaultLayer.getNativeHandler().drawTo(window, [graphic], {
6519
+ x: x,
6520
+ y: y,
6521
+ width: width,
6522
+ height: height,
6523
+ stage: stage,
6524
+ layer: stage.defaultLayer,
6525
+ renderService: stage.renderService,
6526
+ background: "transparent",
6527
+ clear: !0,
6528
+ updateBounds: !1
6529
+ }), stage.params.optimize.disableCheckGraphicWidthOutRange = disableCheckGraphicWidthOutRange;
6530
+ var c = window.getNativeHandler();
6531
+ return c.nativeCanvas ? c.nativeCanvas : null;
6532
+ }
6279
6533
  }]);
6280
6534
  return DefaultGraphicUtil;
6281
6535
  }();
6282
- exports.DefaultGraphicUtil = __decorate$1A([injectable(), __param$Q(0, inject(ContributionProvider)), __param$Q(0, named(TextMeasureContribution)), __metadata$1d("design:paramtypes", [Object])], exports.DefaultGraphicUtil);
6536
+ exports.DefaultGraphicUtil = __decorate$1z([injectable(), __param$Q(0, inject(ContributionProvider)), __param$Q(0, named(TextMeasureContribution)), __metadata$1c("design:paramtypes", [Object])], exports.DefaultGraphicUtil);
6283
6537
  var TransformMode;
6284
6538
  !function (TransformMode) {
6285
6539
  TransformMode[TransformMode.transform = 0] = "transform", TransformMode[TransformMode.matrix = 1] = "matrix";
@@ -6356,7 +6610,7 @@
6356
6610
  }]);
6357
6611
  return DefaultTransformUtil;
6358
6612
  }();
6359
- exports.DefaultTransformUtil = __decorate$1A([injectable(), __metadata$1d("design:paramtypes", [])], exports.DefaultTransformUtil);
6613
+ exports.DefaultTransformUtil = __decorate$1z([injectable(), __metadata$1c("design:paramtypes", [])], exports.DefaultTransformUtil);
6360
6614
 
6361
6615
  var defaultThemeObj = {
6362
6616
  arc: DefaultArcAttribute,
@@ -12871,14 +13125,14 @@
12871
13125
  var VirtualLayerHandlerContribution = Symbol["for"]("VirtualLayerHandlerContribution");
12872
13126
 
12873
13127
  var _DefaultLayerService_,
12874
- __decorate$1z = undefined && undefined.__decorate || function (decorators, target, key, desc) {
13128
+ __decorate$1y = undefined && undefined.__decorate || function (decorators, target, key, desc) {
12875
13129
  var d,
12876
13130
  c = arguments.length,
12877
13131
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
12878
13132
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
12879
13133
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12880
13134
  },
12881
- __metadata$1c = undefined && undefined.__metadata || function (k, v) {
13135
+ __metadata$1b = undefined && undefined.__metadata || function (k, v) {
12882
13136
  if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
12883
13137
  };
12884
13138
  exports.DefaultLayerService = _DefaultLayerService_ = /*#__PURE__*/function () {
@@ -12964,169 +13218,7 @@
12964
13218
  }]);
12965
13219
  return DefaultLayerService_1;
12966
13220
  }();
12967
- exports.DefaultLayerService.idprefix = "visactor_layer", exports.DefaultLayerService.prefix_count = 0, exports.DefaultLayerService = _DefaultLayerService_ = __decorate$1z([injectable(), __metadata$1c("design:paramtypes", [])], exports.DefaultLayerService);
12968
-
12969
- var __decorate$1y = undefined && undefined.__decorate || function (decorators, target, key, desc) {
12970
- var d,
12971
- c = arguments.length,
12972
- r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
12973
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
12974
- return c > 3 && r && Object.defineProperty(target, key, r), r;
12975
- },
12976
- __metadata$1b = undefined && undefined.__metadata || function (k, v) {
12977
- if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
12978
- };
12979
- var VWindow = Symbol["for"]("VWindow");
12980
- var WindowHandlerContribution = Symbol["for"]("WindowHandlerContribution");
12981
- exports.DefaultWindow = /*#__PURE__*/function () {
12982
- function DefaultWindow() {
12983
- _classCallCheck(this, DefaultWindow);
12984
- this.hooks = {
12985
- onChange: new SyncHook(["x", "y", "width", "height"])
12986
- }, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
12987
- }
12988
- _createClass(DefaultWindow, [{
12989
- key: "width",
12990
- get: function get() {
12991
- if (this._handler) {
12992
- var wh = this._handler.getWH();
12993
- return this._width = wh.width;
12994
- }
12995
- return this._width;
12996
- }
12997
- }, {
12998
- key: "height",
12999
- get: function get() {
13000
- if (this._handler) {
13001
- var wh = this._handler.getWH();
13002
- return this._height = wh.height;
13003
- }
13004
- return this._height;
13005
- }
13006
- }, {
13007
- key: "dpr",
13008
- get: function get() {
13009
- return this._handler.getDpr();
13010
- }
13011
- }, {
13012
- key: "postInit",
13013
- value: function postInit() {
13014
- var _this = this;
13015
- this.global.hooks.onSetEnv.tap("window", function () {
13016
- _this.active();
13017
- }), this.active();
13018
- }
13019
- }, {
13020
- key: "active",
13021
- value: function active() {
13022
- var global = this.global;
13023
- if (!global.env || this.actived) return;
13024
- container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
13025
- }
13026
- }, {
13027
- key: "style",
13028
- get: function get() {
13029
- return this._handler.getStyle();
13030
- },
13031
- set: function set(style) {
13032
- this._handler.setStyle(style);
13033
- }
13034
- }, {
13035
- key: "create",
13036
- value: function create(params) {
13037
- this._handler.createWindow(params);
13038
- var windowWH = this._handler.getWH();
13039
- this._width = windowWH.width, this._height = windowWH.height, this.title = this._handler.getTitle(), this.resizable = !0;
13040
- }
13041
- }, {
13042
- key: "setWindowHandler",
13043
- value: function setWindowHandler(handler) {
13044
- this._handler = handler;
13045
- }
13046
- }, {
13047
- key: "setDpr",
13048
- value: function setDpr(dpr) {
13049
- return this._handler.setDpr(dpr);
13050
- }
13051
- }, {
13052
- key: "resize",
13053
- value: function resize(w, h) {
13054
- return this._handler.resizeWindow(w, h);
13055
- }
13056
- }, {
13057
- key: "configure",
13058
- value: function configure() {
13059
- throw new Error("暂不支持");
13060
- }
13061
- }, {
13062
- key: "release",
13063
- value: function release() {
13064
- return this._handler.releaseWindow();
13065
- }
13066
- }, {
13067
- key: "getContext",
13068
- value: function getContext() {
13069
- return this._handler.getContext();
13070
- }
13071
- }, {
13072
- key: "getNativeHandler",
13073
- value: function getNativeHandler() {
13074
- return this._handler.getNativeHandler();
13075
- }
13076
- }, {
13077
- key: "getImageBuffer",
13078
- value: function getImageBuffer(type) {
13079
- return this._handler.getImageBuffer ? this._handler.getImageBuffer(type) : null;
13080
- }
13081
- }, {
13082
- key: "addEventListener",
13083
- value: function addEventListener(type, listener, options) {
13084
- return this._handler.addEventListener(type, listener, options);
13085
- }
13086
- }, {
13087
- key: "removeEventListener",
13088
- value: function removeEventListener(type, listener, options) {
13089
- return this._handler.removeEventListener(type, listener, options);
13090
- }
13091
- }, {
13092
- key: "dispatchEvent",
13093
- value: function dispatchEvent(event) {
13094
- return this._handler.dispatchEvent(event);
13095
- }
13096
- }, {
13097
- key: "getBoundingClientRect",
13098
- value: function getBoundingClientRect() {
13099
- return this._handler.getBoundingClientRect();
13100
- }
13101
- }, {
13102
- key: "getContainer",
13103
- value: function getContainer() {
13104
- return this._handler.container;
13105
- }
13106
- }, {
13107
- key: "clearViewBox",
13108
- value: function clearViewBox(viewBox, color) {
13109
- this._handler.clearViewBox(viewBox, color);
13110
- }
13111
- }, {
13112
- key: "isVisible",
13113
- value: function isVisible(bbox) {
13114
- return this._handler.isVisible(bbox);
13115
- }
13116
- }, {
13117
- key: "onVisibleChange",
13118
- value: function onVisibleChange(cb) {
13119
- return this._handler.onVisibleChange(cb);
13120
- }
13121
- }, {
13122
- key: "getTopLeft",
13123
- value: function getTopLeft(baseWindow) {
13124
- return this._handler.getTopLeft(baseWindow);
13125
- }
13126
- }]);
13127
- return DefaultWindow;
13128
- }();
13129
- exports.DefaultWindow = __decorate$1y([injectable(), __metadata$1b("design:paramtypes", [])], exports.DefaultWindow);
13221
+ exports.DefaultLayerService.idprefix = "visactor_layer", exports.DefaultLayerService.prefix_count = 0, exports.DefaultLayerService = _DefaultLayerService_ = __decorate$1y([injectable(), __metadata$1b("design:paramtypes", [])], exports.DefaultLayerService);
13130
13222
 
13131
13223
  var coreModule = new ContainerModule(function (bind) {
13132
13224
  bind(VGlobal).to(exports.DefaultGlobal).inSingletonScope(), bind(VWindow).to(exports.DefaultWindow), bind(GraphicUtil).to(exports.DefaultGraphicUtil).inSingletonScope(), bind(TransformUtil).to(exports.DefaultTransformUtil).inSingletonScope(), bind(LayerService).to(exports.DefaultLayerService).inSingletonScope();
@@ -13316,19 +13408,27 @@
13316
13408
  }]);
13317
13409
  return ConicalCanvas;
13318
13410
  }();
13319
- var ColorInterpolate = /*#__PURE__*/function () {
13411
+ var ColorInterpolate = /*#__PURE__*/function (_LRU) {
13412
+ _inherits(ColorInterpolate, _LRU);
13413
+ var _super = _createSuper(ColorInterpolate);
13320
13414
  function ColorInterpolate() {
13415
+ var _this;
13321
13416
  var stops = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
13322
13417
  var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
13323
13418
  _classCallCheck(this, ColorInterpolate);
13419
+ _this = _super.call(this), _this.cacheParams = {
13420
+ CLEAN_THRESHOLD: 100,
13421
+ L_TIME: 1e3
13422
+ }, _this.dataMap = new Map();
13324
13423
  var canvas = ConicalCanvas.GetCanvas(),
13325
13424
  conicalCtx = ConicalCanvas.GetCtx();
13326
- if (canvas.width = precision, canvas.height = 1, !conicalCtx) return;
13425
+ if (canvas.width = precision, canvas.height = 1, !conicalCtx) return _possibleConstructorReturn(_this);
13327
13426
  if (conicalCtx.translate(0, 0), !conicalCtx) throw new Error("获取ctx发生错误");
13328
13427
  var gradient = conicalCtx.createLinearGradient(0, 0, precision, 0);
13329
13428
  stops.forEach(function (stop) {
13330
13429
  gradient.addColorStop(stop[0], stop[1]);
13331
- }), conicalCtx.fillStyle = gradient, conicalCtx.fillRect(0, 0, precision, 1), this.rgbaSet = conicalCtx.getImageData(0, 0, precision, 1).data;
13430
+ }), conicalCtx.fillStyle = gradient, conicalCtx.fillRect(0, 0, precision, 1), _this.rgbaSet = conicalCtx.getImageData(0, 0, precision, 1).data;
13431
+ return _this;
13332
13432
  }
13333
13433
  _createClass(ColorInterpolate, [{
13334
13434
  key: "getColor",
@@ -13336,32 +13436,32 @@
13336
13436
  var rgba = this.rgbaSet.slice(4 * offset, 4 * offset + 4);
13337
13437
  return "rgba(".concat(rgba[0], ", ").concat(rgba[1], ", ").concat(rgba[2], ", ").concat(rgba[3] / 255, ")");
13338
13438
  }
13339
- }], [{
13439
+ }, {
13340
13440
  key: "GetOrCreate",
13341
- value: function GetOrCreate() {
13342
- var stops = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
13343
- var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
13344
- var str = "";
13441
+ value: function GetOrCreate(x, y, w, h) {
13442
+ var stops = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
13443
+ var precision = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 100;
13444
+ var str = "".concat(x).concat(y).concat(w).concat(h);
13345
13445
  stops.forEach(function (item) {
13346
13446
  return str += item.join();
13347
13447
  }), str += precision;
13348
- var colorInter = ColorInterpolate.dataMap.get(str);
13349
- return colorInter || (colorInter = new ColorInterpolate(stops, precision), ColorInterpolate.dataMap.set(str, colorInter)), colorInter;
13350
- }
13351
- }, {
13352
- key: "SetColorInterpolateInstance",
13353
- value: function SetColorInterpolateInstance(stops, ins) {
13354
- ColorInterpolate.dataMap.set(stops, ins);
13448
+ var colorInter = this.dataMap.get(str);
13449
+ if (!colorInter) {
13450
+ colorInter = {
13451
+ data: new ColorInterpolate(stops, precision),
13452
+ timestamp: []
13453
+ }, this.addLimitedTimestamp(colorInter, Date.now(), {}), this.dataMap.set(str, colorInter);
13454
+ }
13455
+ return this.clearCache(this.dataMap, this.cacheParams), colorInter.data;
13355
13456
  }
13356
- }, {
13357
- key: "GetColorInterpolateInstance",
13358
- value: function GetColorInterpolateInstance(stops) {
13359
- return ColorInterpolate.dataMap.get(stops);
13457
+ }], [{
13458
+ key: "getInstance",
13459
+ value: function getInstance() {
13460
+ return ColorInterpolate._instance || (ColorInterpolate._instance = new ColorInterpolate()), ColorInterpolate._instance;
13360
13461
  }
13361
13462
  }]);
13362
13463
  return ColorInterpolate;
13363
- }();
13364
- ColorInterpolate.dataMap = new Map();
13464
+ }(LRU);
13365
13465
  var ConicalPatternStore = /*#__PURE__*/function () {
13366
13466
  function ConicalPatternStore() {
13367
13467
  _classCallCheck(this, ConicalPatternStore);
@@ -13433,7 +13533,7 @@
13433
13533
  var r = Math.sqrt(Math.max(Math.max(Math.pow(x, 2) + Math.pow(y, 2), Math.pow(width - x, 2) + Math.pow(y, 2)), Math.max(Math.pow(width - x, 2) + Math.pow(height - y, 2), Math.pow(x, 2) + Math.pow(height - y, 2)))),
13434
13534
  stepNum = deltaDeg + 1,
13435
13535
  step = deltaAngle / Math.max(1, stepNum - 1),
13436
- colorInter = ColorInterpolate.GetOrCreate(stops, stepNum),
13536
+ colorInter = ColorInterpolate.getInstance().GetOrCreate(x, y, width, height, stops, stepNum),
13437
13537
  lineWidth = 2 * Math.PI * r / 360;
13438
13538
  conicalCanvas.width = width, conicalCanvas.height = height, conicalCtx.setTransform(1, 0, 0, 1, 0, 0), conicalCtx.clearRect(0, 0, width, height), conicalCtx.translate(x, y), conicalCtx.rotate(startAngle);
13439
13539
  for (var i = 0, len = stepNum - 1; i < len && !(startAngle + i * step > endAngle); i++) {
@@ -13701,7 +13801,7 @@
13701
13801
  var _a;
13702
13802
  var attribute = this.attribute,
13703
13803
  textTheme = getTheme(this).text;
13704
- if (this.isMultiLine) return;
13804
+ if (!this.isSimplify()) return;
13705
13805
  var _attribute$maxLineWid = attribute.maxLineWidth,
13706
13806
  maxLineWidth = _attribute$maxLineWid === void 0 ? textTheme.maxLineWidth : _attribute$maxLineWid;
13707
13807
  return Number.isFinite(maxLineWidth) ? (this.tryUpdateAABBBounds(), this.cache.clipedText) : (null !== (_a = attribute.text) && void 0 !== _a ? _a : textTheme.text).toString();
@@ -13709,23 +13809,28 @@
13709
13809
  }, {
13710
13810
  key: "clipedWidth",
13711
13811
  get: function get() {
13712
- if (!this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
13812
+ if (this.isSimplify()) return this.tryUpdateAABBBounds(), this.cache.clipedWidth;
13713
13813
  }
13714
13814
  }, {
13715
13815
  key: "cliped",
13716
13816
  get: function get() {
13717
13817
  var textTheme = getTheme(this).text,
13718
13818
  attribute = this.attribute;
13719
- if (this.isMultiLine) return;
13819
+ if (!this.isSimplify()) return;
13720
13820
  var _attribute$maxLineWid2 = attribute.maxLineWidth,
13721
13821
  maxLineWidth = _attribute$maxLineWid2 === void 0 ? textTheme.maxLineWidth : _attribute$maxLineWid2;
13722
- return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), this.clipedText !== attribute.text.toString());
13822
+ return !!Number.isFinite(maxLineWidth) && (this.tryUpdateAABBBounds(), null != this.clipedText && this.clipedText !== attribute.text.toString());
13723
13823
  }
13724
13824
  }, {
13725
13825
  key: "multilineLayout",
13726
13826
  get: function get() {
13727
13827
  if (this.isMultiLine) return this.tryUpdateAABBBounds(), this.cache.layoutData;
13728
13828
  }
13829
+ }, {
13830
+ key: "isSimplify",
13831
+ value: function isSimplify() {
13832
+ return !this.isMultiLine && "vertical" !== this.attribute.direction;
13833
+ }
13729
13834
  }, {
13730
13835
  key: "isMultiLine",
13731
13836
  get: function get() {
@@ -15439,7 +15544,14 @@
15439
15544
  }, {
15440
15545
  key: "toCustomPath",
15441
15546
  value: function toCustomPath() {
15442
- throw new Error("暂不支持");
15547
+ var attribute = this.attribute;
15548
+ var width = isNil$1(attribute.width) ? attribute.x1 - attribute.x : attribute.width,
15549
+ height = isNil$1(attribute.height) ? attribute.y1 - attribute.y : attribute.height,
15550
+ x = 0,
15551
+ y = 0;
15552
+ width < 0 && (x = width, width = -width), height < 0 && (y = height, height = -height);
15553
+ var path = new CustomPath2D();
15554
+ return path.moveTo(x, y), path.rect(x, y, width, height), path;
15443
15555
  }
15444
15556
  }, {
15445
15557
  key: "clone",
@@ -19959,7 +20071,7 @@
19959
20071
  y: null !== (_d = endPoint.y1) && void 0 !== _d ? _d : endPoint.y
19960
20072
  });
19961
20073
  }
19962
- lastBottomSeg = calcLineCache(bottomPoints, "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType), bottomCaches.unshift(lastBottomSeg);
20074
+ bottomPoints.length > 1 && (lastBottomSeg = calcLineCache(bottomPoints, "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType), bottomCaches.unshift(lastBottomSeg));
19963
20075
  }
19964
20076
  area.cacheArea = bottomCaches.map(function (item, index) {
19965
20077
  return {
@@ -21023,8 +21135,8 @@
21023
21135
  }();
21024
21136
  exports.Canvas3DPickItemInterceptor = __decorate$1i([injectable()], exports.Canvas3DPickItemInterceptor);
21025
21137
 
21026
- var pickModule = new ContainerModule(function (bind) {
21027
- bind(PickerService).toService(GlobalPickerService), bind(exports.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.Canvas3DPickItemInterceptor), bind(exports.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.ShadowRootPickItemInterceptorContribution), bind(exports.InteractivePickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.InteractivePickItemInterceptorContribution), bindContributionProvider(bind, PickItemInterceptor);
21138
+ var pickModule = new ContainerModule(function (bind, unbind, isBound) {
21139
+ isBound(PickerService) || (bind(GlobalPickerService).toSelf(), bind(PickerService).toService(GlobalPickerService)), bind(exports.Canvas3DPickItemInterceptor).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.Canvas3DPickItemInterceptor), bind(exports.ShadowRootPickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.ShadowRootPickItemInterceptorContribution), bind(exports.InteractivePickItemInterceptorContribution).toSelf().inSingletonScope(), bind(PickItemInterceptor).toService(exports.InteractivePickItemInterceptorContribution), bindContributionProvider(bind, PickItemInterceptor);
21028
21140
  });
21029
21141
 
21030
21142
  var graphicModule = new ContainerModule(function (bind) {
@@ -21836,12 +21948,12 @@
21836
21948
  }
21837
21949
  var d = context.dpr % 1;
21838
21950
  (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
21839
- var drawInArea = dirtyBounds.width() * context.dpr !== context.canvas.width || dirtyBounds.height() * context.dpr !== context.canvas.height;
21951
+ var drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
21840
21952
  context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip()), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
21841
21953
  var _a, _b;
21842
21954
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
21843
21955
  }).forEach(function (group) {
21844
- _this2.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0));
21956
+ group.isContainer ? _this2.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : _this2.renderItem(group, drawContext);
21845
21957
  }), context.restore(), context.restore(), context.draw(), context.inuse = !1;
21846
21958
  }
21847
21959
  }, {
@@ -22622,7 +22734,11 @@
22622
22734
  container.load(renderModule);
22623
22735
  }
22624
22736
 
22625
- container.load(coreModule), container.load(graphicModule), container.load(renderModule$1), container.load(pickModule), container.load(pluginModule), load$1(container), load(container);
22737
+ var loaded$r = !1;
22738
+ function preLoadAllModule() {
22739
+ loaded$r || (loaded$r = !0, container.load(coreModule), container.load(graphicModule), container.load(renderModule$1), container.load(pickModule), container.load(pluginModule), load$1(container), load(container));
22740
+ }
22741
+ preLoadAllModule();
22626
22742
  var vglobal = container.get(VGlobal);
22627
22743
  application.global = vglobal;
22628
22744
  var graphicUtil = container.get(GraphicUtil);
@@ -23279,11 +23395,26 @@
23279
23395
  return OrthoCamera;
23280
23396
  }();
23281
23397
 
23398
+ var _isBrowserEnv;
23399
+ function initIsBrowserEnv() {
23400
+ if (null == _isBrowserEnv) {
23401
+ try {
23402
+ _isBrowserEnv = !!window;
23403
+ } catch (err) {
23404
+ _isBrowserEnv = !1;
23405
+ }
23406
+ if (_isBrowserEnv) try {
23407
+ _isBrowserEnv = !tt;
23408
+ } catch (err) {
23409
+ _isBrowserEnv = !0;
23410
+ }
23411
+ }
23412
+ }
23282
23413
  function isBrowserEnv() {
23283
- return new Function("try {return this===window;}catch(e){ return false;}")();
23414
+ return initIsBrowserEnv(), _isBrowserEnv;
23284
23415
  }
23285
23416
  function isNodeEnv() {
23286
- return new Function("try {return this===global;}catch(e){return false;}")();
23417
+ return initIsBrowserEnv(), !_isBrowserEnv;
23287
23418
  }
23288
23419
  function getCurrentEnv() {
23289
23420
  return isBrowserEnv() ? "browser" : "node";
@@ -30829,7 +30960,7 @@
30829
30960
  key: "mapToCanvasPoint",
30830
30961
  value: function mapToCanvasPoint(event) {
30831
30962
  var _a;
30832
- return (null === (_a = null == event ? void 0 : event.type) || void 0 === _a ? void 0 : _a.startsWith("mouse")) ? event : null;
30963
+ return null === (_a = null == event ? void 0 : event.type) || void 0 === _a || _a.startsWith("mouse"), event;
30833
30964
  }
30834
30965
  }]);
30835
30966
  return FeishuEnvContribution;
@@ -31319,6 +31450,12 @@
31319
31450
  rafBasedSto.clear(h);
31320
31451
  };
31321
31452
  }
31453
+ }, {
31454
+ key: "mapToCanvasPoint",
31455
+ value: function mapToCanvasPoint(event) {
31456
+ var _a;
31457
+ return null === (_a = null == event ? void 0 : event.type) || void 0 === _a || _a.startsWith("mouse"), event;
31458
+ }
31322
31459
  }, {
31323
31460
  key: "addEventListener",
31324
31461
  value: function addEventListener(type, listener, options) {
@@ -32177,6 +32314,12 @@
32177
32314
  value: function getStaticCanvasCount() {
32178
32315
  return 9999;
32179
32316
  }
32317
+ }, {
32318
+ key: "mapToCanvasPoint",
32319
+ value: function mapToCanvasPoint(event) {
32320
+ var _a;
32321
+ return null === (_a = null == event ? void 0 : event.type) || void 0 === _a || _a.startsWith("mouse"), event;
32322
+ }
32180
32323
  }, {
32181
32324
  key: "configure",
32182
32325
  value: function configure(service, params) {
@@ -32748,7 +32891,7 @@
32748
32891
  key: "mapToCanvasPoint",
32749
32892
  value: function mapToCanvasPoint(event) {
32750
32893
  var _a;
32751
- return (null === (_a = null == event ? void 0 : event.type) || void 0 === _a ? void 0 : _a.startsWith("mouse")) ? event : null;
32894
+ return null === (_a = null == event ? void 0 : event.type) || void 0 === _a || _a.startsWith("mouse"), event;
32752
32895
  }
32753
32896
  }]);
32754
32897
  return WxEnvContribution;
@@ -34359,7 +34502,8 @@
34359
34502
 
34360
34503
  var roughModule = _roughModule;
34361
34504
 
34362
- const version = "0.17.8-alpha.0";
34505
+ const version = "0.17.9";
34506
+ preLoadAllModule();
34363
34507
  if (isBrowserEnv()) {
34364
34508
  loadBrowserEnv(container);
34365
34509
  }
@@ -34827,6 +34971,7 @@
34827
34971
  exports.polygonCanvasPickModule = polygonCanvasPickModule;
34828
34972
  exports.polygonMathPickModule = polygonMathPickModule;
34829
34973
  exports.polygonModule = polygonModule;
34974
+ exports.preLoadAllModule = preLoadAllModule;
34830
34975
  exports.pyramid3dCanvasPickModule = pyramid3dCanvasPickModule;
34831
34976
  exports.pyramid3dModule = pyramid3dModule;
34832
34977
  exports.rafBasedSto = rafBasedSto;