@visactor/vrender 0.16.13 → 0.16.14-alpha.11

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/cjs/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export declare const version = "0.16.13";
1
+ export declare const version = "0.16.14-alpha.11";
2
2
  export * from '@visactor/vrender-core';
3
3
  export * from '@visactor/vrender-kits';
package/cjs/index.js CHANGED
@@ -21,5 +21,5 @@ Object.defineProperty(exports, "__esModule", {
21
21
 
22
22
  const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits");
23
23
 
24
- exports.version = "0.16.13", (0, vrender_kits_1.loadAllModule)(vrender_core_1.container),
24
+ exports.version = "0.16.14-alpha.11", (0, vrender_kits_1.loadAllModule)(vrender_core_1.container),
25
25
  __exportStar(require("@visactor/vrender-core"), exports), __exportStar(require("@visactor/vrender-kits"), exports);
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,yDAAuD;AAG1C,QAAA,OAAO,GAAG,SAAS,CAAC;AAEjC,IAAA,4BAAa,EAAC,wBAAS,CAAC,CAAC;AAEzB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import { container } from '@visactor/vrender-core';\nimport { loadAllModule } from '@visactor/vrender-kits';\n\n// 导出版本号\nexport const version = \"0.16.13\";\n\nloadAllModule(container);\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,yDAAuD;AAG1C,QAAA,OAAO,GAAG,kBAAkB,CAAC;AAE1C,IAAA,4BAAa,EAAC,wBAAS,CAAC,CAAC;AAEzB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import { container } from '@visactor/vrender-core';\nimport { loadAllModule } from '@visactor/vrender-kits';\n\n// 导出版本号\nexport const version = \"0.16.14-alpha.11\";\n\nloadAllModule(container);\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
package/dist/index.js CHANGED
@@ -4591,9 +4591,13 @@
4591
4591
  _this$_userSpec$textB = _this$_userSpec.textBaseline,
4592
4592
  textBaseline = _this$_userSpec$textB === void 0 ? null != baseline ? baseline : "middle" : _this$_userSpec$textB,
4593
4593
  ellipsis = _this$_userSpec.ellipsis,
4594
- limit = _this$_userSpec.limit,
4595
- _this$_userSpec$lineH = _this$_userSpec.lineHeight,
4594
+ limit = _this$_userSpec.limit;
4595
+ var _this$_userSpec$lineH = this._userSpec.lineHeight,
4596
4596
  lineHeight = _this$_userSpec$lineH === void 0 ? fontSize : _this$_userSpec$lineH;
4597
+ if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
4598
+ var scale = Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100;
4599
+ lineHeight = fontSize * scale;
4600
+ }
4597
4601
  return {
4598
4602
  fontStyle: fontStyle,
4599
4603
  fontVariant: fontVariant,
@@ -4669,6 +4673,7 @@
4669
4673
  }, {
4670
4674
  key: "_measureWithNaiveCanvas",
4671
4675
  value: function _measureWithNaiveCanvas(text) {
4676
+ var _a;
4672
4677
  if (!this.initContext()) return this._quickMeasureWithoutCanvas(text);
4673
4678
  var metrics = this._context.measureText(text),
4674
4679
  _this$textSpec2 = this.textSpec,
@@ -4676,7 +4681,7 @@
4676
4681
  lineHeight = _this$textSpec2.lineHeight;
4677
4682
  return {
4678
4683
  width: metrics.width,
4679
- height: null != lineHeight ? lineHeight : fontSize
4684
+ height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
4680
4685
  };
4681
4686
  }
4682
4687
  }, {
@@ -4706,6 +4711,7 @@
4706
4711
  }, {
4707
4712
  key: "_quickMeasureWithoutCanvas",
4708
4713
  value: function _quickMeasureWithoutCanvas(text) {
4714
+ var _a;
4709
4715
  var totalSize = {
4710
4716
  width: 0,
4711
4717
  height: 0
@@ -4718,11 +4724,12 @@
4718
4724
  size = ["F", "W"].includes(eastAsianCharacterInfo(_char2)) ? 1 : .53;
4719
4725
  totalSize.width += size * fontSize;
4720
4726
  }
4721
- return totalSize.height = null != lineHeight ? lineHeight : fontSize, totalSize;
4727
+ return totalSize.height = null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize, totalSize;
4722
4728
  }
4723
4729
  }, {
4724
4730
  key: "_measureReduce",
4725
4731
  value: function _measureReduce(text, processor) {
4732
+ var _a;
4726
4733
  var _this$textSpec4 = this.textSpec,
4727
4734
  fontSize = _this$textSpec4.fontSize,
4728
4735
  lineHeight = _this$textSpec4.lineHeight,
@@ -4739,7 +4746,7 @@
4739
4746
  width: textArr.reduce(function (maxWidth, cur) {
4740
4747
  return Math.max(maxWidth, processor(cur).width);
4741
4748
  }, 0),
4742
- height: textArr.length * ((null != lineHeight ? lineHeight : fontSize) + 1) + 1
4749
+ height: textArr.length * ((null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize) + 1) + 1
4743
4750
  };
4744
4751
  }
4745
4752
  return processor(text.toString());
@@ -8254,7 +8261,7 @@
8254
8261
  return "mouse" === pointerType || "pen" === pointerType;
8255
8262
  }
8256
8263
  var EventManager = /*#__PURE__*/function () {
8257
- function EventManager(root) {
8264
+ function EventManager(root, config) {
8258
8265
  var _this = this;
8259
8266
  _classCallCheck(this, EventManager);
8260
8267
  this.dispatch = new EventEmitter(), this.mappingState = {
@@ -8322,6 +8329,7 @@
8322
8329
  }
8323
8330
  _this.cursor = "";
8324
8331
  }, this.onPointerUp = function (from, target) {
8332
+ var _a;
8325
8333
  if (!(from instanceof FederatedPointerEvent)) return void console.warn("EventManager cannot map a non-pointer event as a pointer event");
8326
8334
  var now = clock.now(),
8327
8335
  e = _this.createPointerEvent(from, from.type, target);
@@ -8351,7 +8359,7 @@
8351
8359
  timeStamp: now
8352
8360
  });
8353
8361
  var clickHistory = trackingData.clicksByButton[from.button];
8354
- clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < 200 ? ++clickHistory.clickCount : clickHistory.clickCount = 1, clickHistory.target = clickEvent.target, clickHistory.timeStamp = now, clickEvent.detail = clickHistory.clickCount, isMouseLike(clickEvent.pointerType) ? (_this.dispatchEvent(clickEvent, "click"), 2 === clickHistory.clickCount && _this.dispatchEvent(clickEvent, "dblclick")) : "touch" === clickEvent.pointerType && _this.dispatchEvent(clickEvent, "tap"), _this.dispatchEvent(clickEvent, "pointertap"), _this.freeEvent(clickEvent);
8362
+ clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < (null !== (_a = _this._config.clickInterval) && void 0 !== _a ? _a : 200) ? ++clickHistory.clickCount : clickHistory.clickCount = 1, clickHistory.target = clickEvent.target, clickHistory.timeStamp = now, clickEvent.detail = clickHistory.clickCount, isMouseLike(clickEvent.pointerType) ? (_this.dispatchEvent(clickEvent, "click"), 2 === clickHistory.clickCount && _this.dispatchEvent(clickEvent, "dblclick")) : "touch" === clickEvent.pointerType && _this.dispatchEvent(clickEvent, "tap"), _this.dispatchEvent(clickEvent, "pointertap"), _this.freeEvent(clickEvent);
8355
8363
  }
8356
8364
  _this.freeEvent(e);
8357
8365
  }, this.onPointerUpOutside = function (from, target) {
@@ -8369,7 +8377,9 @@
8369
8377
  if (!(from instanceof FederatedWheelEvent)) return void console.warn("EventManager cannot map a non-wheel event as a wheel event");
8370
8378
  var wheelEvent = _this.createWheelEvent(from, target);
8371
8379
  _this.dispatchEvent(wheelEvent), _this.freeEvent(wheelEvent);
8372
- }, this.rootTarget = root, this.mappingTable = {}, this.addEventMapping("pointerdown", this.onPointerDown), this.addEventMapping("pointermove", this.onPointerMove), this.addEventMapping("pointerout", this.onPointerOut), this.addEventMapping("pointerleave", this.onPointerOut), this.addEventMapping("pointerover", this.onPointerOver), this.addEventMapping("pointerup", this.onPointerUp), this.addEventMapping("pointerupoutside", this.onPointerUpOutside), this.addEventMapping("wheel", this.onWheel);
8380
+ }, this.rootTarget = root, this.mappingTable = {}, this._config = Object.assign({
8381
+ clickInterval: 200
8382
+ }, config), this.addEventMapping("pointerdown", this.onPointerDown), this.addEventMapping("pointermove", this.onPointerMove), this.addEventMapping("pointerout", this.onPointerOut), this.addEventMapping("pointerleave", this.onPointerOut), this.addEventMapping("pointerover", this.onPointerOver), this.addEventMapping("pointerup", this.onPointerUp), this.addEventMapping("pointerupoutside", this.onPointerUpOutside), this.addEventMapping("wheel", this.onWheel);
8373
8383
  }
8374
8384
  _createClass(EventManager, [{
8375
8385
  key: "addEventMapping",
@@ -8389,13 +8399,12 @@
8389
8399
  }, {
8390
8400
  key: "mapEvent",
8391
8401
  value: function mapEvent(e) {
8392
- var _this$_prePointTarget;
8393
8402
  var _a, _b, _c, _d, _e, _f, _g;
8394
8403
  if (!this.rootTarget) return;
8395
8404
  var mappers = this.mappingTable[e.type];
8396
8405
  var target;
8397
8406
  var cacheKey = "".concat(e.canvasX, "-").concat(e.canvasY);
8398
- if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY, e), e.pickParams || (this._prePointTargetCache = (_this$_prePointTarget = {}, _defineProperty(_this$_prePointTarget, cacheKey, target), _defineProperty(_this$_prePointTarget, "stageRenderCount", null !== (_g = null == target ? void 0 : target.stage.renderCount) && void 0 !== _g ? _g : -1), _this$_prePointTarget))), mappers) for (var i = 0, j = mappers.length; i < j; i++) mappers[i].fn(e, target);else console.warn("[EventManager]: Event mapping not defined for ".concat(e.type));
8407
+ if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY, e), e.pickParams || (this._prePointTargetCache = _defineProperty(_defineProperty({}, cacheKey, target), "stageRenderCount", null !== (_g = null == target ? void 0 : target.stage.renderCount) && void 0 !== _g ? _g : -1))), mappers) for (var i = 0, j = mappers.length; i < j; i++) mappers[i].fn(e, target);else console.warn("[EventManager]: Event mapping not defined for ".concat(e.type));
8399
8408
  }
8400
8409
  }, {
8401
8410
  key: "propagate",
@@ -8597,8 +8606,11 @@
8597
8606
  global = params.global,
8598
8607
  viewport = params.viewport,
8599
8608
  _params$autoPreventDe = params.autoPreventDefault,
8600
- autoPreventDefault = _params$autoPreventDe === void 0 ? !1 : _params$autoPreventDe;
8601
- this.manager = new EventManager(rootNode), this.globalObj = global, this.supportsPointerEvents = global.supportsPointerEvents, this.supportsTouchEvents = global.supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.viewport = viewport, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
8609
+ autoPreventDefault = _params$autoPreventDe === void 0 ? !1 : _params$autoPreventDe,
8610
+ clickInterval = params.clickInterval;
8611
+ this.manager = new EventManager(rootNode, {
8612
+ clickInterval: clickInterval
8613
+ }), this.globalObj = global, this.supportsPointerEvents = global.supportsPointerEvents, this.supportsTouchEvents = global.supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.viewport = viewport, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
8602
8614
  "default": "inherit",
8603
8615
  pointer: "pointer"
8604
8616
  }, this.resolution = resolution, this.setTargetElement(targetElement);
@@ -9948,6 +9960,12 @@
9948
9960
  }();
9949
9961
  RafBasedSTO.TimeOut = 1e3 / 60;
9950
9962
  var rafBasedSto = new RafBasedSTO();
9963
+ var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
9964
+ if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
9965
+ return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
9966
+ }
9967
+ return lineHeight;
9968
+ };
9951
9969
 
9952
9970
  var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
9953
9971
  _inherits(IncreaseCount, _ACustomAnimate);
@@ -12863,8 +12881,7 @@
12863
12881
  }, {
12864
12882
  key: "addChild",
12865
12883
  value: function addChild(node) {
12866
- var _this$child$push2;
12867
- "__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push((_this$child$push2 = {}, _defineProperty(_this$child$push2, node.tagname, node.child), _defineProperty(_this$child$push2, ":@", node[":@"]), _this$child$push2)) : this.child.push(_defineProperty({}, node.tagname, node.child));
12884
+ "__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push(_defineProperty(_defineProperty({}, node.tagname, node.child), ":@", node[":@"])) : this.child.push(_defineProperty({}, node.tagname, node.child));
12868
12885
  }
12869
12886
  }]);
12870
12887
  return XmlNode;
@@ -14562,7 +14579,7 @@
14562
14579
  }, {
14563
14580
  key: "updateWrapAABBBounds",
14564
14581
  value: function updateWrapAABBBounds(text) {
14565
- var _a, _b, _c;
14582
+ var _a, _b, _c, _d;
14566
14583
  var textTheme = getTheme(this).text,
14567
14584
  _this$attribute = this.attribute,
14568
14585
  _this$attribute$fontF = _this$attribute.fontFamily,
@@ -14573,8 +14590,6 @@
14573
14590
  textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
14574
14591
  _this$attribute$fontS = _this$attribute.fontSize,
14575
14592
  fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
14576
- _this$attribute$lineH = _this$attribute.lineHeight,
14577
- lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
14578
14593
  _this$attribute$ellip = _this$attribute.ellipsis,
14579
14594
  ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
14580
14595
  maxLineWidth = _this$attribute.maxLineWidth,
@@ -14591,8 +14606,9 @@
14591
14606
  _this$attribute$heigh = _this$attribute.heightLimit,
14592
14607
  heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
14593
14608
  lineClamp = _this$attribute.lineClamp,
14609
+ lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
14594
14610
  buf = ignoreBuf ? 0 : 2;
14595
- if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14611
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
14596
14612
  var _bbox = this.cache.layoutData.bbox;
14597
14613
  return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14598
14614
  }
@@ -14624,7 +14640,7 @@
14624
14640
  if ("" !== str && "" === clip.str) {
14625
14641
  if (ellipsis) {
14626
14642
  var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
14627
- clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
14643
+ clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
14628
14644
  } else clip.str = "", clip.width = 0;
14629
14645
  needCut = !1;
14630
14646
  }
@@ -14721,8 +14737,8 @@
14721
14737
  whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
14722
14738
  if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
14723
14739
  var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
14724
- _attribute$lineHeight = attribute.lineHeight,
14725
- lineHeight = _attribute$lineHeight === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight;
14740
+ textFontSize = attribute.fontSize || textTheme.fontSize,
14741
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
14726
14742
  if (!this.shouldUpdateShape() && this.cache) {
14727
14743
  width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
14728
14744
  var _dx = textDrawOffsetX(textAlign, width),
@@ -14792,12 +14808,11 @@
14792
14808
  fontFamily = _attribute$fontFamily2 === void 0 ? textTheme.fontFamily : _attribute$fontFamily2,
14793
14809
  _attribute$stroke2 = attribute.stroke,
14794
14810
  stroke = _attribute$stroke2 === void 0 ? textTheme.stroke : _attribute$stroke2,
14795
- _attribute$lineHeight2 = attribute.lineHeight,
14796
- lineHeight = _attribute$lineHeight2 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight2,
14797
14811
  _attribute$lineWidth2 = attribute.lineWidth,
14798
14812
  lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
14799
14813
  _attribute$verticalMo = attribute.verticalMode,
14800
- verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo;
14814
+ verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo,
14815
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14801
14816
  var _attribute$textAlign2 = attribute.textAlign,
14802
14817
  textAlign = _attribute$textAlign2 === void 0 ? textTheme.textAlign : _attribute$textAlign2,
14803
14818
  _attribute$textBaseli2 = attribute.textBaseline,
@@ -14847,7 +14862,7 @@
14847
14862
  }, {
14848
14863
  key: "updateHorizontalMultilineAABBBounds",
14849
14864
  value: function updateHorizontalMultilineAABBBounds(text) {
14850
- var _a;
14865
+ var _a, _b;
14851
14866
  var textTheme = getTheme(this).text,
14852
14867
  attribute = this.attribute,
14853
14868
  _attribute$fontFamily3 = attribute.fontFamily,
@@ -14860,8 +14875,6 @@
14860
14875
  fontSize = _attribute$fontSize3 === void 0 ? textTheme.fontSize : _attribute$fontSize3,
14861
14876
  _attribute$fontWeight3 = attribute.fontWeight,
14862
14877
  fontWeight = _attribute$fontWeight3 === void 0 ? textTheme.fontWeight : _attribute$fontWeight3,
14863
- _attribute$lineHeight3 = attribute.lineHeight,
14864
- lineHeight = _attribute$lineHeight3 === void 0 ? attribute.lineHeight || attribute.fontSize || textTheme.fontSize : _attribute$lineHeight3,
14865
14878
  _attribute$ellipsis3 = attribute.ellipsis,
14866
14879
  ellipsis = _attribute$ellipsis3 === void 0 ? textTheme.ellipsis : _attribute$ellipsis3,
14867
14880
  maxLineWidth = attribute.maxLineWidth,
@@ -14870,9 +14883,10 @@
14870
14883
  _attribute$lineWidth3 = attribute.lineWidth,
14871
14884
  lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
14872
14885
  _attribute$whiteSpace2 = attribute.whiteSpace,
14873
- whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2;
14886
+ whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2,
14887
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
14874
14888
  if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
14875
- if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
14889
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
14876
14890
  var _bbox2 = this.cache.layoutData.bbox;
14877
14891
  return this._AABBBounds.set(_bbox2.xOffset, _bbox2.yOffset, _bbox2.xOffset + _bbox2.width, _bbox2.yOffset + _bbox2.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14878
14892
  }
@@ -14908,12 +14922,11 @@
14908
14922
  fontWeight = _attribute$fontWeight4 === void 0 ? textTheme.fontWeight : _attribute$fontWeight4,
14909
14923
  _attribute$stroke4 = attribute.stroke,
14910
14924
  stroke = _attribute$stroke4 === void 0 ? textTheme.stroke : _attribute$stroke4,
14911
- _attribute$lineHeight4 = attribute.lineHeight,
14912
- lineHeight = _attribute$lineHeight4 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight4,
14913
14925
  _attribute$lineWidth4 = attribute.lineWidth,
14914
14926
  lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
14915
14927
  _attribute$verticalMo2 = attribute.verticalMode,
14916
- verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2;
14928
+ verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2,
14929
+ lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14917
14930
  var _attribute$textAlign4 = attribute.textAlign,
14918
14931
  textAlign = _attribute$textAlign4 === void 0 ? textTheme.textAlign : _attribute$textAlign4,
14919
14932
  _attribute$textBaseli4 = attribute.textBaseline,
@@ -15046,7 +15059,7 @@
15046
15059
  }, {
15047
15060
  key: "updateMultilineAABBBounds",
15048
15061
  value: function updateMultilineAABBBounds(text) {
15049
- var _a, _b, _c;
15062
+ var _a, _b, _c, _d;
15050
15063
  var textTheme = getTheme(this).text,
15051
15064
  _this$attribute = this.attribute,
15052
15065
  _this$attribute$fontF = _this$attribute.fontFamily,
@@ -15057,8 +15070,6 @@
15057
15070
  textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
15058
15071
  _this$attribute$fontS = _this$attribute.fontSize,
15059
15072
  fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
15060
- _this$attribute$lineH = _this$attribute.lineHeight,
15061
- lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
15062
15073
  _this$attribute$ellip = _this$attribute.ellipsis,
15063
15074
  ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
15064
15075
  maxLineWidth = _this$attribute.maxLineWidth,
@@ -15075,8 +15086,9 @@
15075
15086
  _this$attribute$heigh = _this$attribute.heightLimit,
15076
15087
  heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
15077
15088
  lineClamp = _this$attribute.lineClamp,
15089
+ lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
15078
15090
  buf = ignoreBuf ? 0 : 2;
15079
- if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
15091
+ if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
15080
15092
  var _bbox = this.cache.layoutData.bbox;
15081
15093
  return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
15082
15094
  }
@@ -15108,7 +15120,7 @@
15108
15120
  if ("" !== str && "" === clip.str) {
15109
15121
  if (ellipsis) {
15110
15122
  var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
15111
- clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
15123
+ clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
15112
15124
  } else clip.str = "", clip.width = 0;
15113
15125
  needCut = !1;
15114
15126
  }
@@ -15855,32 +15867,37 @@
15855
15867
  }(BaseSymbol);
15856
15868
  var close$1 = new CloseSymbol();
15857
15869
 
15858
- function rect(ctx, size, x, y) {
15870
+ function rectSizeArray(ctx, size, x, y) {
15859
15871
  return ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]), !1;
15860
15872
  }
15873
+ function rectSize(ctx, size, x, y) {
15874
+ var w = size,
15875
+ h = size / 2;
15876
+ return ctx.rect(x - w / 2, y - h / 2, w, h), !1;
15877
+ }
15861
15878
  var RectSymbol = /*#__PURE__*/function (_BaseSymbol) {
15862
15879
  _inherits(RectSymbol, _BaseSymbol);
15863
15880
  var _super = _createSuper(RectSymbol);
15864
15881
  function RectSymbol() {
15865
15882
  var _this;
15866
15883
  _classCallCheck(this, RectSymbol);
15867
- _this = _super.apply(this, arguments), _this.type = "rect", _this.pathStr = "M-0.5,-0.5h1v1h-1Z";
15884
+ _this = _super.apply(this, arguments), _this.type = "rect", _this.pathStr = "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z";
15868
15885
  return _this;
15869
15886
  }
15870
15887
  _createClass(RectSymbol, [{
15871
15888
  key: "draw",
15872
15889
  value: function draw(ctx, size, x, y) {
15873
- return rect(ctx, isNumber$2(size) ? [size, size] : size, x, y);
15890
+ return isNumber$2(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
15874
15891
  }
15875
15892
  }, {
15876
15893
  key: "drawOffset",
15877
15894
  value: function drawOffset(ctx, size, x, y, offset) {
15878
- return rect(ctx, isNumber$2(size) ? [size + 2 * offset, size + 2 * offset] : [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
15895
+ return isNumber$2(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
15879
15896
  }
15880
15897
  }]);
15881
15898
  return RectSymbol;
15882
15899
  }(BaseSymbol);
15883
- var rect$1 = new RectSymbol();
15900
+ var rect = new RectSymbol();
15884
15901
 
15885
15902
  var tempBounds = new AABBBounds();
15886
15903
  var CustomSymbolClass = /*#__PURE__*/function () {
@@ -15919,11 +15936,17 @@
15919
15936
  return CustomSymbolClass;
15920
15937
  }();
15921
15938
 
15922
- var builtinSymbols = [circle$1, cross$1, diamond$1, square$1, thinTriangle$1, triangle, star$1, arrow$1, wedge$1, stroke$1, wye$1, triangleLeft, triangleRight, triangleUp, triangleDown, arrow2Left$1, arrow2Right$1, arrow2Up$1, arrow2Down$1, rect$1, lineV$1, lineH$1, close$1];
15939
+ var builtinSymbols = [circle$1, cross$1, diamond$1, square$1, thinTriangle$1, triangle, star$1, arrow$1, wedge$1, stroke$1, wye$1, triangleLeft, triangleRight, triangleUp, triangleDown, arrow2Left$1, arrow2Right$1, arrow2Up$1, arrow2Down$1, rect, lineV$1, lineH$1, close$1];
15923
15940
  var builtinSymbolsMap = {};
15924
15941
  builtinSymbols.forEach(function (symbol) {
15925
15942
  builtinSymbolsMap[symbol.type] = symbol;
15926
15943
  });
15944
+ var builtInSymbolStrMap = {
15945
+ arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
15946
+ arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
15947
+ rectRound: "M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",
15948
+ roundLine: "M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"
15949
+ };
15927
15950
 
15928
15951
  var SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
15929
15952
  var _Symbol = /*#__PURE__*/function (_Graphic) {
@@ -15957,12 +15980,13 @@
15957
15980
  }, {
15958
15981
  key: "doUpdateParsedPath",
15959
15982
  value: function doUpdateParsedPath() {
15960
- var symbolTheme = getTheme(this).symbol,
15961
- _this$attribute$symbo = this.attribute.symbolType,
15962
- symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo;
15963
- var path = builtinSymbolsMap[symbolType];
15983
+ var symbolTheme = getTheme(this).symbol;
15984
+ var _this$attribute$symbo = this.attribute.symbolType,
15985
+ symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo,
15986
+ path = builtinSymbolsMap[symbolType];
15964
15987
  if (path) return this._parsedPath = path, path;
15965
15988
  if (path = _Symbol.userSymbolMap[symbolType], path) return this._parsedPath = path, path;
15989
+ symbolType = builtInSymbolStrMap[symbolType] || symbolType;
15966
15990
  if (!0 === isSvg(symbolType)) {
15967
15991
  var parser = new XMLParser(),
15968
15992
  _parser$parse = parser.parse(symbolType),
@@ -16621,7 +16645,9 @@
16621
16645
  var Paragraph = /*#__PURE__*/function () {
16622
16646
  function Paragraph(text, newLine, character) {
16623
16647
  _classCallCheck(this, Paragraph);
16624
- this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic", "number" == typeof character.lineHeight ? this.lineHeight = character.lineHeight > this.fontSize ? character.lineHeight : this.fontSize : this.lineHeight = Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
16648
+ this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
16649
+ var lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
16650
+ this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
16625
16651
  var _measureTextCanvas = measureTextCanvas(text, character),
16626
16652
  ascent = _measureTextCanvas.ascent,
16627
16653
  height = _measureTextCanvas.height,
@@ -17160,7 +17186,8 @@
17160
17186
  var _this2 = this;
17161
17187
  var _a;
17162
17188
  var _this$attribute = this.attribute,
17163
- textConfig = _this$attribute.textConfig,
17189
+ _this$attribute$textC = _this$attribute.textConfig,
17190
+ textConfig = _this$attribute$textC === void 0 ? [] : _this$attribute$textC,
17164
17191
  maxWidth = _this$attribute.maxWidth,
17165
17192
  maxHeight = _this$attribute.maxHeight,
17166
17193
  width = _this$attribute.width,
@@ -20350,7 +20377,7 @@
20350
20377
  var t = textAlign;
20351
20378
  textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
20352
20379
  }
20353
- var lineHeight = null !== (_c = text.attribute.lineHeight) && void 0 !== _c ? _c : fontSize,
20380
+ var lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
20354
20381
  data = this.valid(text, textAttribute, fillCb, strokeCb);
20355
20382
  if (!data) return;
20356
20383
  var fVisible = data.fVisible,
@@ -24858,7 +24885,7 @@
24858
24885
  canvasId: params.canvas
24859
24886
  } : {
24860
24887
  main: !0
24861
- })), _this.nextFrameRenderLayerSet = new Set(), _this.willNextFrameRender = !1, _this.stage = _assertThisInitialized(_this), _this.renderStyle = params.renderStyle, _this.global.supportEvent && (_this.eventSystem = new EventSystem({
24888
+ })), _this.nextFrameRenderLayerSet = new Set(), _this.willNextFrameRender = !1, _this.stage = _assertThisInitialized(_this), _this.renderStyle = params.renderStyle, _this.global.supportEvent && (_this.eventSystem = new EventSystem(Object.assign({
24862
24889
  targetElement: _this.window,
24863
24890
  resolution: _this.window.dpr || _this.global.devicePixelRatio,
24864
24891
  rootNode: _assertThisInitialized(_this),
@@ -24878,7 +24905,7 @@
24878
24905
  return this.viewBox.height();
24879
24906
  }
24880
24907
  }
24881
- })), params.autoRender && _this.enableAutoRender(), !1 === params.disableDirtyBounds && _this.enableDirtyBounds(), params.enableHtmlAttribute && _this.enableHtmlAttribute(params.enableHtmlAttribute), params.enableLayout && _this.enableLayout(), _this.hooks.beforeRender.tap("constructor", _this.beforeRender), _this.hooks.afterRender.tap("constructor", _this.afterRender), _this._beforeRender = params.beforeRender, _this._afterRender = params.afterRender, _this.ticker = params.ticker || defaultTicker, _this.supportInteractiveLayer = !1 !== params.interactiveLayer, _this.timeline = new DefaultTimeline(), _this.ticker.addTimeline(_this.timeline), _this.timeline.pause(), _this.optmize(params.optimize), _this._background && isString$1(_this._background) && _this.setAttributes({
24908
+ }, params.event))), params.autoRender && _this.enableAutoRender(), !1 === params.disableDirtyBounds && _this.enableDirtyBounds(), params.enableHtmlAttribute && _this.enableHtmlAttribute(params.enableHtmlAttribute), params.enableLayout && _this.enableLayout(), _this.hooks.beforeRender.tap("constructor", _this.beforeRender), _this.hooks.afterRender.tap("constructor", _this.afterRender), _this._beforeRender = params.beforeRender, _this._afterRender = params.afterRender, _this.ticker = params.ticker || defaultTicker, _this.supportInteractiveLayer = !1 !== params.interactiveLayer, _this.timeline = new DefaultTimeline(), _this.ticker.addTimeline(_this.timeline), _this.timeline.pause(), _this.optmize(params.optimize), params.background && isString$1(_this._background) && _this._background.includes("/") && _this.setAttributes({
24882
24909
  background: _this._background
24883
24910
  });
24884
24911
  return _this;
@@ -29160,7 +29187,7 @@
29160
29187
  var _this;
29161
29188
  var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29162
29189
  _classCallCheck(this, Gesture);
29163
- var _a, _b, _c, _d, _e, _f, _g, _h;
29190
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
29164
29191
  _this = _super.call(this), _this.cachedEvents = [], _this.startPoints = [], _this.processEvent = {}, _this.throttleTimer = 0, _this.emitThrottles = [], _this.onStart = function (ev) {
29165
29192
  _this.reset(), _this.startTime = clock.now();
29166
29193
  var _assertThisInitialize = _assertThisInitialized(_this),
@@ -29245,13 +29272,14 @@
29245
29272
  velocity > _this.config.swipe.velocity && distance > _this.config.swipe.threshold && (endEvent.velocity = velocity, endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), _this.triggerEvent("swipe", endEvent));
29246
29273
  }
29247
29274
  }
29275
+ now - _this.lastTapTime < _this.config.tap.interval ? _this.tapCount++ : _this.tapCount = 1, _this.lastTapTime = now, 1 === _this.tapCount ? _this.triggerEvent("tap", endEvent) : 2 === _this.tapCount && (_this.triggerEvent("doubletap", endEvent), _this.tapCount = 0);
29248
29276
  }
29249
29277
  for (var i = 0, len = cachedEvents.length; i < len; i++) if (cachedEvents[i].pointerId === endEvent.pointerId) {
29250
29278
  cachedEvents.splice(i, 1), startPoints.splice(i, 1);
29251
29279
  break;
29252
29280
  }
29253
29281
  _this.reset(), cachedEvents.length > 0 && _this.onStart();
29254
- }, _this.element = element, _this.config = {
29282
+ }, _this.element = element, _this.tapCount = 0, _this.lastTapTime = 0, _this.config = {
29255
29283
  press: {
29256
29284
  time: null !== (_b = null === (_a = null == config ? void 0 : config.press) || void 0 === _a ? void 0 : _a.time) && void 0 !== _b ? _b : 251,
29257
29285
  threshold: null !== (_d = null === (_c = null == config ? void 0 : config.press) || void 0 === _c ? void 0 : _c.threshold) && void 0 !== _d ? _d : 9
@@ -29259,6 +29287,9 @@
29259
29287
  swipe: {
29260
29288
  threshold: null !== (_f = null === (_e = null == config ? void 0 : config.swipe) || void 0 === _e ? void 0 : _e.threshold) && void 0 !== _f ? _f : 10,
29261
29289
  velocity: null !== (_h = null === (_g = null == config ? void 0 : config.swipe) || void 0 === _g ? void 0 : _g.velocity) && void 0 !== _h ? _h : .3
29290
+ },
29291
+ tap: {
29292
+ interval: null !== (_k = null === (_j = null == config ? void 0 : config.tap) || void 0 === _j ? void 0 : _j.interval) && void 0 !== _k ? _k : 300
29262
29293
  }
29263
29294
  }, _this.initEvents();
29264
29295
  return _this;
@@ -29456,7 +29487,7 @@
29456
29487
  var scaleX, scaleY;
29457
29488
  return nativeCanvas && (scaleX = rect.width / nativeCanvas.offsetWidth, scaleY = rect.height / nativeCanvas.offsetHeight), {
29458
29489
  x: (x - rect.left) / (isValidNumber$1(scaleX) ? scaleX : 1),
29459
- y: (y - rect.top) / (isValidNumber$1(scaleY) ? scaleX : 1)
29490
+ y: (y - rect.top) / (isValidNumber$1(scaleY) ? scaleY : 1)
29460
29491
  };
29461
29492
  }
29462
29493
  return {
@@ -31979,6 +32010,7 @@
31979
32010
  key: "contains",
31980
32011
  value: function contains(polygon, point, params) {
31981
32012
  if (!polygon.AABBBounds.contains(point.x, point.y)) return !1;
32013
+ if ("imprecise" === polygon.attribute.pickMode) return !0;
31982
32014
  var _ref = null != params ? params : {},
31983
32015
  pickContext = _ref.pickContext;
31984
32016
  if (!pickContext) return !1;
@@ -32396,7 +32428,7 @@
32396
32428
  width = data.width, height = data.height;
32397
32429
  }
32398
32430
  var dpr = params.dpr;
32399
- if (!1 === params.canvasControled && (dpr && console.warn("canvasControled为false后,dpr参数将无效"), dpr = null), null == dpr) {
32431
+ if (null == dpr) {
32400
32432
  dpr = null !== (_a = canvas.getContext("2d").pixelRatio) && void 0 !== _a ? _a : canvas.width / width;
32401
32433
  }
32402
32434
  this.canvas = new BrowserCanvas({
@@ -34626,7 +34658,7 @@
34626
34658
 
34627
34659
  var roughModule = _roughModule;
34628
34660
 
34629
- const version = "0.16.13";
34661
+ const version = "0.16.14-alpha.11";
34630
34662
  loadAllModule(container);
34631
34663
 
34632
34664
  exports.ACustomAnimate = ACustomAnimate;
@@ -34856,9 +34888,11 @@
34856
34888
  exports.bindContributionProvider = bindContributionProvider;
34857
34889
  exports.bindContributionProviderNoSingletonScope = bindContributionProviderNoSingletonScope;
34858
34890
  exports.boundStroke = boundStroke;
34891
+ exports.builtInSymbolStrMap = builtInSymbolStrMap;
34859
34892
  exports.builtinSymbols = builtinSymbols;
34860
34893
  exports.builtinSymbolsMap = builtinSymbolsMap;
34861
34894
  exports.calcLineCache = calcLineCache$1;
34895
+ exports.calculateLineHeight = calculateLineHeight;
34862
34896
  exports.centroidOfSubpath = centroidOfSubpath;
34863
34897
  exports.circleBounds = circleBounds;
34864
34898
  exports.clock = clock;