@visactor/vrender 0.16.17 → 0.16.18

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
@@ -4795,6 +4795,130 @@
4795
4795
  }();
4796
4796
  TextMeasure.ALPHABET_CHAR_SET = "abcdefghijklmnopqrstuvwxyz", TextMeasure.NUMBERS_CHAR_SET = "0123456789", TextMeasure.FULL_SIZE_CHAR = "字";
4797
4797
 
4798
+ var hasConsole = "undefined" != typeof console;
4799
+ function log(method, level, input) {
4800
+ var args = [level].concat([].slice.call(input));
4801
+ hasConsole && console[method].apply(console, args);
4802
+ }
4803
+ var LoggerLevel;
4804
+ !function (LoggerLevel) {
4805
+ LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
4806
+ }(LoggerLevel || (LoggerLevel = {}));
4807
+ var Logger = /*#__PURE__*/function () {
4808
+ function Logger() {
4809
+ var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
4810
+ var method = arguments.length > 1 ? arguments[1] : undefined;
4811
+ _classCallCheck(this, Logger);
4812
+ this._onErrorHandler = [], this._level = level, this._method = method;
4813
+ }
4814
+ _createClass(Logger, [{
4815
+ key: "addErrorHandler",
4816
+ value: function addErrorHandler(handler) {
4817
+ this._onErrorHandler.find(function (h) {
4818
+ return h === handler;
4819
+ }) || this._onErrorHandler.push(handler);
4820
+ }
4821
+ }, {
4822
+ key: "removeErrorHandler",
4823
+ value: function removeErrorHandler(handler) {
4824
+ var index = this._onErrorHandler.findIndex(function (h) {
4825
+ return h === handler;
4826
+ });
4827
+ index < 0 || this._onErrorHandler.splice(index, 1);
4828
+ }
4829
+ }, {
4830
+ key: "callErrorHandler",
4831
+ value: function callErrorHandler() {
4832
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4833
+ args[_key] = arguments[_key];
4834
+ }
4835
+ this._onErrorHandler.forEach(function (h) {
4836
+ return h.apply(void 0, args);
4837
+ });
4838
+ }
4839
+ }, {
4840
+ key: "canLogInfo",
4841
+ value: function canLogInfo() {
4842
+ return this._level >= LoggerLevel.Info;
4843
+ }
4844
+ }, {
4845
+ key: "canLogDebug",
4846
+ value: function canLogDebug() {
4847
+ return this._level >= LoggerLevel.Debug;
4848
+ }
4849
+ }, {
4850
+ key: "canLogError",
4851
+ value: function canLogError() {
4852
+ return this._level >= LoggerLevel.Error;
4853
+ }
4854
+ }, {
4855
+ key: "canLogWarn",
4856
+ value: function canLogWarn() {
4857
+ return this._level >= LoggerLevel.Warn;
4858
+ }
4859
+ }, {
4860
+ key: "level",
4861
+ value: function level(levelValue) {
4862
+ return arguments.length ? (this._level = +levelValue, this) : this._level;
4863
+ }
4864
+ }, {
4865
+ key: "error",
4866
+ value: function error() {
4867
+ var _a;
4868
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
4869
+ args[_key2] = arguments[_key2];
4870
+ }
4871
+ return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler.apply(this, args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
4872
+ }
4873
+ }, {
4874
+ key: "warn",
4875
+ value: function warn() {
4876
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
4877
+ args[_key3] = arguments[_key3];
4878
+ }
4879
+ return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
4880
+ }
4881
+ }, {
4882
+ key: "info",
4883
+ value: function info() {
4884
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
4885
+ args[_key4] = arguments[_key4];
4886
+ }
4887
+ return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
4888
+ }
4889
+ }, {
4890
+ key: "debug",
4891
+ value: function debug() {
4892
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
4893
+ args[_key5] = arguments[_key5];
4894
+ }
4895
+ return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
4896
+ }
4897
+ }], [{
4898
+ key: "getInstance",
4899
+ value: function getInstance(level, method) {
4900
+ return Logger._instance && isNumber$2(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
4901
+ }
4902
+ }, {
4903
+ key: "setInstance",
4904
+ value: function setInstance(logger) {
4905
+ return Logger._instance = logger;
4906
+ }
4907
+ }, {
4908
+ key: "setInstanceLevel",
4909
+ value: function setInstanceLevel(level) {
4910
+ Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
4911
+ }
4912
+ }, {
4913
+ key: "clearInstance",
4914
+ value: function clearInstance() {
4915
+ Logger._instance = null;
4916
+ }
4917
+ }]);
4918
+ return Logger;
4919
+ }();
4920
+ Logger._instance = null;
4921
+
4798
4922
  var circleThreshold = tau - 1e-8;
4799
4923
  var BoundsContext = /*#__PURE__*/function () {
4800
4924
  function BoundsContext(bounds) {
@@ -6295,7 +6419,8 @@
6295
6419
  verticalMode: 0,
6296
6420
  whiteSpace: "no-wrap",
6297
6421
  heightLimit: 1 / 0,
6298
- lineClamp: 1 / 0
6422
+ lineClamp: 1 / 0,
6423
+ suffixPosition: "end"
6299
6424
  };
6300
6425
  var DefaultStyle = Object.assign(Object.assign(Object.assign({
6301
6426
  opacity: 1,
@@ -6304,7 +6429,7 @@
6304
6429
  textureColor: "black",
6305
6430
  textureSize: 10,
6306
6431
  texturePadding: 2,
6307
- backgroundMode: 0,
6432
+ backgroundMode: "no-repeat",
6308
6433
  blur: 0,
6309
6434
  cursor: null,
6310
6435
  html: null
@@ -6398,7 +6523,7 @@
6398
6523
  var DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
6399
6524
  path: new CustomPath2D(),
6400
6525
  customPath: function customPath() {
6401
- console.warn("空函数");
6526
+ Logger.getInstance().warn("空函数");
6402
6527
  }
6403
6528
  });
6404
6529
  var DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
@@ -6662,7 +6787,7 @@
6662
6787
  i = 0;
6663
6788
  for (; i < verticalList.length && length + verticalList[i].width < width; i++) length += verticalList[i].width, out.push(verticalList[i]);
6664
6789
  if (verticalList[i] && verticalList[i].text.length > 1) {
6665
- var clipedData = this._clipText(verticalList[i].text, options, width - length, 0, verticalList[i].text.length - 1);
6790
+ var clipedData = this._clipText(verticalList[i].text, options, width - length, 0, verticalList[i].text.length - 1, "end", !1);
6666
6791
  if (wordBreak && clipedData.str !== verticalList[i].text) {
6667
6792
  var text = "",
6668
6793
  _length = 0;
@@ -6701,7 +6826,7 @@
6701
6826
  str: "",
6702
6827
  width: 0
6703
6828
  };
6704
- var data = this._clipText(text, options, width, 0, text.length - 1);
6829
+ var data = this._clipText(text, options, width, 0, text.length - 1, "end", !1);
6705
6830
  if (wordBreak && data.str !== text) {
6706
6831
  var index = testLetter(text, data.str.length);
6707
6832
  index !== data.str.length && (data.str = text.substring(0, index), data.width = this.measureTextWidth(data.str, options));
@@ -6710,7 +6835,21 @@
6710
6835
  }
6711
6836
  }, {
6712
6837
  key: "_clipText",
6713
- value: function _clipText(text, options, width, leftIdx, rightIdx) {
6838
+ value: function _clipText(text, options, width, leftIdx, rightIdx, position, suffix) {
6839
+ var data;
6840
+ if ("end" === position) data = this._clipTextEnd(text, options, width, leftIdx, rightIdx), suffix && (data.result = data.str + suffix);else if ("start" === position) data = this._clipTextStart(text, options, width, leftIdx, rightIdx), suffix && (data.result = suffix + data.str);else if ("middle" === position) {
6841
+ var d = this._clipTextMiddle(text, options, width, "", "", 0, 0, 1);
6842
+ data = {
6843
+ str: "none",
6844
+ width: d.width,
6845
+ result: d.left + suffix + d.right
6846
+ };
6847
+ }
6848
+ return data;
6849
+ }
6850
+ }, {
6851
+ key: "_clipTextEnd",
6852
+ value: function _clipTextEnd(text, options, width, leftIdx, rightIdx) {
6714
6853
  var middleIdx = Math.floor((leftIdx + rightIdx) / 2),
6715
6854
  subText = text.substring(0, middleIdx + 1),
6716
6855
  strWidth = this.measureTextWidth(subText, options);
@@ -6724,7 +6863,7 @@
6724
6863
  return length = this.measureTextWidth(str, options), length <= width ? {
6725
6864
  str: str,
6726
6865
  width: length
6727
- } : this._clipText(text, options, width, leftIdx, middleIdx);
6866
+ } : this._clipTextEnd(text, options, width, leftIdx, middleIdx);
6728
6867
  }
6729
6868
  if (strWidth < width) {
6730
6869
  if (middleIdx >= text.length - 1) return {
@@ -6735,16 +6874,68 @@
6735
6874
  return length = this.measureTextWidth(_str, options), length >= width ? {
6736
6875
  str: subText,
6737
6876
  width: strWidth
6738
- } : this._clipText(text, options, width, middleIdx, rightIdx);
6877
+ } : this._clipTextEnd(text, options, width, middleIdx, rightIdx);
6878
+ }
6879
+ return {
6880
+ str: subText,
6881
+ width: strWidth
6882
+ };
6883
+ }
6884
+ }, {
6885
+ key: "_clipTextStart",
6886
+ value: function _clipTextStart(text, options, width, leftIdx, rightIdx) {
6887
+ var middleIdx = Math.ceil((leftIdx + rightIdx) / 2),
6888
+ subText = text.substring(middleIdx - 1, text.length - 1),
6889
+ strWidth = this.measureTextWidth(subText, options);
6890
+ var length;
6891
+ if (strWidth > width) {
6892
+ if (subText.length <= 1) return {
6893
+ str: "",
6894
+ width: 0
6895
+ };
6896
+ var str = text.substring(middleIdx, text.length - 1);
6897
+ return length = this.measureTextWidth(str, options), length <= width ? {
6898
+ str: str,
6899
+ width: length
6900
+ } : this._clipTextStart(text, options, width, middleIdx, text.length - 1);
6901
+ }
6902
+ if (strWidth < width) {
6903
+ if (middleIdx <= 0) return {
6904
+ str: text,
6905
+ width: this.measureTextWidth(text, options)
6906
+ };
6907
+ var _str2 = text.substring(middleIdx - 2, text.length - 1);
6908
+ return length = this.measureTextWidth(_str2, options), length >= width ? {
6909
+ str: subText,
6910
+ width: strWidth
6911
+ } : this._clipTextStart(text, options, width, leftIdx, middleIdx);
6739
6912
  }
6740
6913
  return {
6741
6914
  str: subText,
6742
6915
  width: strWidth
6743
6916
  };
6744
6917
  }
6918
+ }, {
6919
+ key: "_clipTextMiddle",
6920
+ value: function _clipTextMiddle(text, options, width, left, right, leftW, rightW, buffer) {
6921
+ var subLeftText = text.substring(0, buffer),
6922
+ strLeftWidth = this.measureTextWidth(subLeftText, options);
6923
+ if (strLeftWidth + rightW > width) return {
6924
+ left: left,
6925
+ right: right,
6926
+ width: leftW + rightW
6927
+ };
6928
+ var subRightText = text.substring(text.length - buffer, text.length),
6929
+ strRightWidth = this.measureTextWidth(subRightText, options);
6930
+ return strLeftWidth + strRightWidth > width ? {
6931
+ left: subLeftText,
6932
+ right: right,
6933
+ width: strLeftWidth + rightW
6934
+ } : this._clipTextMiddle(text, options, width, subLeftText, subRightText, strLeftWidth, strRightWidth, buffer + 1);
6935
+ }
6745
6936
  }, {
6746
6937
  key: "clipTextWithSuffixVertical",
6747
- value: function clipTextWithSuffixVertical(verticalList, options, width, suffix, wordBreak) {
6938
+ value: function clipTextWithSuffixVertical(verticalList, options, width, suffix, wordBreak, suffixPosition) {
6748
6939
  if ("" === suffix) return this.clipTextVertical(verticalList, options, width, wordBreak);
6749
6940
  if (0 === verticalList.length) return {
6750
6941
  verticalList: verticalList,
@@ -6754,17 +6945,50 @@
6754
6945
  if (output.verticalList.length === verticalList.length && output.verticalList[output.verticalList.length - 1].width === verticalList[verticalList.length - 1].width) return output;
6755
6946
  var suffixWidth = this.measureTextWidth(suffix, options);
6756
6947
  if (suffixWidth > width) return output;
6757
- width -= suffixWidth;
6758
- var out = this.clipTextVertical(verticalList, options, width, wordBreak);
6759
- return out.width += suffixWidth, out.verticalList.push({
6948
+ var out;
6949
+ if (width -= suffixWidth, "start" === suffixPosition) {
6950
+ var nextVerticalList = this.revertVerticalList(verticalList);
6951
+ out = this.clipTextVertical(nextVerticalList, options, width, wordBreak);
6952
+ var v = this.revertVerticalList(out.verticalList);
6953
+ v.unshift({
6954
+ text: suffix,
6955
+ direction: 1,
6956
+ width: suffixWidth
6957
+ }), out.verticalList = v;
6958
+ } else if ("middle" === suffixPosition) {
6959
+ var leftOut = this.clipTextVertical(verticalList, options, width / 2, wordBreak),
6960
+ _nextVerticalList = this.revertVerticalList(verticalList),
6961
+ rightOut = this.clipTextVertical(_nextVerticalList, options, width / 2, wordBreak);
6962
+ leftOut.verticalList.push({
6963
+ text: suffix,
6964
+ direction: 1,
6965
+ width: suffixWidth
6966
+ }), this.revertVerticalList(rightOut.verticalList).forEach(function (v) {
6967
+ return leftOut.verticalList.push(v);
6968
+ }), out = {
6969
+ verticalList: leftOut.verticalList,
6970
+ width: leftOut.width + rightOut.width
6971
+ };
6972
+ } else out = this.clipTextVertical(verticalList, options, width, wordBreak), out.verticalList.push({
6760
6973
  text: suffix,
6761
6974
  direction: 1,
6762
6975
  width: suffixWidth
6763
- }), out;
6976
+ });
6977
+ return out.width += suffixWidth, out;
6978
+ }
6979
+ }, {
6980
+ key: "revertVerticalList",
6981
+ value: function revertVerticalList(verticalList) {
6982
+ return verticalList.reverse().map(function (l) {
6983
+ var t = l.text.split("").reverse().join("");
6984
+ return Object.assign(Object.assign({}, l), {
6985
+ text: t
6986
+ });
6987
+ });
6764
6988
  }
6765
6989
  }, {
6766
6990
  key: "clipTextWithSuffix",
6767
- value: function clipTextWithSuffix(text, options, width, suffix, wordBreak) {
6991
+ value: function clipTextWithSuffix(text, options, width, suffix, wordBreak, position) {
6768
6992
  if ("" === suffix) return this.clipText(text, options, width, wordBreak);
6769
6993
  if (0 === text.length) return {
6770
6994
  str: "",
@@ -6781,12 +7005,12 @@
6781
7005
  width: 0
6782
7006
  };
6783
7007
  width -= suffixWidth;
6784
- var data = this._clipText(text, options, width, 0, text.length - 1);
7008
+ var data = this._clipText(text, options, width, 0, text.length - 1, position, suffix);
6785
7009
  if (wordBreak && data.str !== text) {
6786
7010
  var index = testLetter(text, data.str.length);
6787
7011
  index !== data.str.length && (data.str = text.substring(0, index), data.width = this.measureTextWidth(data.str, options));
6788
7012
  }
6789
- return data.str += suffix, data.width += suffixWidth, data;
7013
+ return data.str = data.result, data.width += suffixWidth, data;
6790
7014
  }
6791
7015
  }]);
6792
7016
  return ATextMeasure;
@@ -7429,7 +7653,7 @@
7429
7653
  var parentTheme = parentGroup.theme;
7430
7654
  (parentTheme.dirty || force) && parentTheme.applyTheme(parentGroup, pt, !0), this.userTheme ? combineTheme(this.userTheme, parentTheme.userTheme, !1) : this.userTheme = clone(parentTheme.userTheme), combineTheme(pt, parentTheme.userTheme);
7431
7655
  }
7432
- this.userTheme ? this.doCombine(pt) : (parentGroup ? this.combinedTheme = parentGroup.theme.combinedTheme : (this.combinedTheme = this._defaultTheme, console.warn("未知错误,走到不应该走的区域里")), this.dirty = !1);
7656
+ this.userTheme ? this.doCombine(pt) : (parentGroup ? this.combinedTheme = parentGroup.theme.combinedTheme : (this.combinedTheme = this._defaultTheme, Logger.getInstance().warn("未知错误,走到不应该走的区域里")), this.dirty = !1);
7433
7657
  }
7434
7658
  return this.combinedTheme;
7435
7659
  }
@@ -7701,7 +7925,7 @@
7701
7925
  }, {
7702
7926
  key: "insertInto",
7703
7927
  value: function insertInto(newNode, idx) {
7704
- if (!this._ignoreWarn && this._nodeList && console.warn("insertIntoKeepIdx和insertInto混用可能会存在错误"), idx >= this.childrenCount) return this.appendChild(newNode);
7928
+ if (!this._ignoreWarn && this._nodeList && Logger.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"), idx >= this.childrenCount) return this.appendChild(newNode);
7705
7929
  if (this._uid === newNode._uid) return null;
7706
7930
  if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
7707
7931
  if (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, 0 === idx) newNode._next = this._firstChild, this._firstChild && (this._firstChild._prev = newNode), newNode._prev = null, this._firstChild = newNode;else {
@@ -8030,7 +8254,19 @@
8030
8254
  var FederatedEvent = /*#__PURE__*/function () {
8031
8255
  function FederatedEvent(manager) {
8032
8256
  _classCallCheck(this, FederatedEvent);
8033
- this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = FederatedEvent.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = new Point(), this.page = new Point(), this.canvas = new Point(), this.viewport = new Point(), this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = manager;
8257
+ this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = FederatedEvent.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = {
8258
+ x: 0,
8259
+ y: 0
8260
+ }, this.page = {
8261
+ x: 0,
8262
+ y: 0
8263
+ }, this.canvas = {
8264
+ x: 0,
8265
+ y: 0
8266
+ }, this.viewport = {
8267
+ x: 0,
8268
+ y: 0
8269
+ }, this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = manager;
8034
8270
  }
8035
8271
  _createClass(FederatedEvent, [{
8036
8272
  key: "layerX",
@@ -8123,7 +8359,22 @@
8123
8359
  function FederatedMouseEvent() {
8124
8360
  var _this;
8125
8361
  _classCallCheck(this, FederatedMouseEvent);
8126
- _this = _super.apply(this, arguments), _this.client = new Point(), _this.movement = new Point(), _this.offset = new Point(), _this.global = new Point(), _this.screen = new Point();
8362
+ _this = _super.apply(this, arguments), _this.client = {
8363
+ x: 0,
8364
+ y: 0
8365
+ }, _this.movement = {
8366
+ x: 0,
8367
+ y: 0
8368
+ }, _this.offset = {
8369
+ x: 0,
8370
+ y: 0
8371
+ }, _this.global = {
8372
+ x: 0,
8373
+ y: 0
8374
+ }, _this.screen = {
8375
+ x: 0,
8376
+ y: 0
8377
+ };
8127
8378
  return _this;
8128
8379
  }
8129
8380
  _createClass(FederatedMouseEvent, [{
@@ -8267,7 +8518,7 @@
8267
8518
  this.dispatch = new EventEmitter(), this.mappingState = {
8268
8519
  trackingData: {}
8269
8520
  }, this.eventPool = new Map(), this.onPointerDown = function (from, target) {
8270
- if (!(from instanceof FederatedPointerEvent)) return void console.warn("EventManager cannot map a non-pointer event as a pointer event");
8521
+ if (!(from instanceof FederatedPointerEvent)) return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");
8271
8522
  var e = _this.createPointerEvent(from, from.type, target);
8272
8523
  if (_this.dispatchEvent(e, "pointerdown"), "touch" === e.pointerType) _this.dispatchEvent(e, "touchstart");else if (isMouseLike(e.pointerType)) {
8273
8524
  var isRightButton = 2 === e.button;
@@ -8276,7 +8527,7 @@
8276
8527
  _this.trackingData(from.pointerId).pressTargetsByButton[from.button] = e.composedPath(), _this.freeEvent(e);
8277
8528
  }, this.onPointerMove = function (from, target) {
8278
8529
  var _a, _b;
8279
- if (!(from instanceof FederatedPointerEvent)) return void console.warn("EventManager cannot map a non-pointer event as a pointer event");
8530
+ if (!(from instanceof FederatedPointerEvent)) return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");
8280
8531
  var e = _this.createPointerEvent(from, from.type, target),
8281
8532
  isMouse = isMouseLike(e.pointerType),
8282
8533
  trackingData = _this.trackingData(from.pointerId),
@@ -8307,7 +8558,7 @@
8307
8558
  _this.dispatchEvent(e, "pointermove"), "touch" === e.pointerType && _this.dispatchEvent(e, "touchmove"), isMouse && (_this.dispatchEvent(e, "mousemove"), _this.cursor = (null === (_b = null === (_a = e.target) || void 0 === _a ? void 0 : _a.attribute) || void 0 === _b ? void 0 : _b.cursor) || _this.rootTarget.getCursor()), trackingData.overTargets = e.composedPath(), _this.freeEvent(e);
8308
8559
  }, this.onPointerOver = function (from, target) {
8309
8560
  var _a, _b;
8310
- if (!(from instanceof FederatedPointerEvent)) return void console.warn("EventManager cannot map a non-pointer event as a pointer event");
8561
+ if (!(from instanceof FederatedPointerEvent)) return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");
8311
8562
  var trackingData = _this.trackingData(from.pointerId),
8312
8563
  e = _this.createPointerEvent(from, from.type, target),
8313
8564
  isMouse = isMouseLike(e.pointerType);
@@ -8316,7 +8567,7 @@
8316
8567
  for (enterEvent.eventPhase = enterEvent.AT_TARGET; enterEvent.target && enterEvent.target !== _this.rootTarget.parent;) enterEvent.currentTarget = enterEvent.target, _this.notifyTarget(enterEvent), isMouse && _this.notifyTarget(enterEvent, "mouseenter"), enterEvent.target = enterEvent.target.parent;
8317
8568
  trackingData.overTargets = e.composedPath(), _this.freeEvent(e), _this.freeEvent(enterEvent);
8318
8569
  }, this.onPointerOut = function (from, target) {
8319
- if (!(from instanceof FederatedPointerEvent)) return void console.warn("EventManager cannot map a non-pointer event as a pointer event");
8570
+ if (!(from instanceof FederatedPointerEvent)) return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");
8320
8571
  var trackingData = _this.trackingData(from.pointerId);
8321
8572
  if (trackingData.overTargets) {
8322
8573
  var isMouse = isMouseLike(from.pointerType),
@@ -8330,7 +8581,7 @@
8330
8581
  _this.cursor = "";
8331
8582
  }, this.onPointerUp = function (from, target) {
8332
8583
  var _a;
8333
- if (!(from instanceof FederatedPointerEvent)) return void console.warn("EventManager cannot map a non-pointer event as a pointer event");
8584
+ if (!(from instanceof FederatedPointerEvent)) return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");
8334
8585
  var now = clock.now(),
8335
8586
  e = _this.createPointerEvent(from, from.type, target);
8336
8587
  if (_this.dispatchEvent(e, "pointerup"), "touch" === e.pointerType) _this.dispatchEvent(e, "touchend");else if (isMouseLike(e.pointerType)) {
@@ -8363,7 +8614,7 @@
8363
8614
  }
8364
8615
  _this.freeEvent(e);
8365
8616
  }, this.onPointerUpOutside = function (from, target) {
8366
- if (!(from instanceof FederatedPointerEvent)) return void console.warn("EventManager cannot map a non-pointer event as a pointer event");
8617
+ if (!(from instanceof FederatedPointerEvent)) return void Logger.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");
8367
8618
  var trackingData = _this.trackingData(from.pointerId),
8368
8619
  pressTarget = _this.findMountedTarget(trackingData.pressTargetsByButton[from.button]),
8369
8620
  e = _this.createPointerEvent(from, from.type, target);
@@ -8374,7 +8625,7 @@
8374
8625
  }
8375
8626
  _this.freeEvent(e);
8376
8627
  }, this.onWheel = function (from, target) {
8377
- if (!(from instanceof FederatedWheelEvent)) return void console.warn("EventManager cannot map a non-wheel event as a wheel event");
8628
+ if (!(from instanceof FederatedWheelEvent)) return void Logger.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");
8378
8629
  var wheelEvent = _this.createWheelEvent(from, target);
8379
8630
  _this.dispatchEvent(wheelEvent), _this.freeEvent(wheelEvent);
8380
8631
  }, this.rootTarget = root, this.mappingTable = {}, this._config = Object.assign({
@@ -8404,7 +8655,7 @@
8404
8655
  var mappers = this.mappingTable[e.type];
8405
8656
  var target;
8406
8657
  var cacheKey = "".concat(e.canvasX, "-").concat(e.canvasY);
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));
8658
+ 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 Logger.getInstance().warn("[EventManager]: Event mapping not defined for ".concat(e.type));
8408
8659
  }
8409
8660
  }, {
8410
8661
  key: "propagate",
@@ -8474,12 +8725,14 @@
8474
8725
  }, {
8475
8726
  key: "copyMouseData",
8476
8727
  value: function copyMouseData(from, to) {
8477
- from instanceof FederatedMouseEvent && to instanceof FederatedMouseEvent && (to.altKey = from.altKey, to.button = from.button, to.buttons = from.buttons, to.client.copyFrom(from.client), to.ctrlKey = from.ctrlKey, to.shiftKey = from.shiftKey, to.metaKey = from.metaKey, to.movement.copyFrom(from.movement), to.canvas.copyFrom(from.canvas), to.screen.copyFrom(from.screen), to.global.copyFrom(from.global), to.offset.copyFrom(from.offset), to.viewport.copyFrom(from.viewport));
8728
+ from instanceof FederatedMouseEvent && to instanceof FederatedMouseEvent && (to.altKey = from.altKey, to.button = from.button, to.buttons = from.buttons, to.ctrlKey = from.ctrlKey, to.shiftKey = from.shiftKey, to.metaKey = from.metaKey, ["client", "movement", "canvas", "screen", "global", "offset", "viewport"].forEach(function (key) {
8729
+ to[key].x = from[key].x, to[key].y = from[key].y;
8730
+ }));
8478
8731
  }
8479
8732
  }, {
8480
8733
  key: "copyData",
8481
8734
  value: function copyData(from, to) {
8482
- to.isTrusted = from.isTrusted, to.srcElement = from.srcElement, to.timeStamp = clock.now(), to.type = from.type, to.detail = from.detail, to.view = from.view, to.which = from.which, to.layer.copyFrom(from.layer), to.page.copyFrom(from.page), to.pickParams = from.pickParams;
8735
+ to.isTrusted = from.isTrusted, to.srcElement = from.srcElement, to.timeStamp = clock.now(), to.type = from.type, to.detail = from.detail, to.view = from.view, to.which = from.which, to.layer.x = from.layer.x, to.layer.y = from.layer.y, to.page.x = from.page.x, to.page.y = from.page.y, to.pickParams = from.pickParams;
8483
8736
  }
8484
8737
  }, {
8485
8738
  key: "trackingData",
@@ -8700,7 +8953,7 @@
8700
8953
  var _this$mapToCanvasPoin = this.mapToCanvasPoint(nativeEvent),
8701
8954
  canvasX = _this$mapToCanvasPoin.x,
8702
8955
  canvasY = _this$mapToCanvasPoin.y;
8703
- event.canvas.x = canvasX, event.canvas.y = canvasY, event.global.copyFrom(event.canvas), event.offset.copyFrom(event.canvas);
8956
+ event.canvas.x = canvasX, event.canvas.y = canvasY, event.global.x = canvasX, event.global.y = canvasY, event.offset.x = canvasX, event.offset.y = canvasY;
8704
8957
  var _this$mapToViewportPo = this.mapToViewportPoint(event),
8705
8958
  viewX = _this$mapToViewportPo.x,
8706
8959
  viewY = _this$mapToViewportPo.y;
@@ -8713,7 +8966,7 @@
8713
8966
  var _this$mapToCanvasPoin2 = this.mapToCanvasPoint(nativeEvent),
8714
8967
  canvasX = _this$mapToCanvasPoin2.x,
8715
8968
  canvasY = _this$mapToCanvasPoin2.y;
8716
- event.canvas.x = canvasX, event.canvas.y = canvasY, event.global.copyFrom(event.canvas), event.offset.copyFrom(event.canvas);
8969
+ event.canvas.x = canvasX, event.canvas.y = canvasY, event.global.x = canvasX, event.global.y = canvasY, event.offset.x = canvasX, event.offset.y = canvasY;
8717
8970
  var _this$mapToViewportPo2 = this.mapToViewportPoint(event),
8718
8971
  viewX = _this$mapToViewportPo2.x,
8719
8972
  viewY = _this$mapToViewportPo2.y;
@@ -8932,7 +9185,7 @@
8932
9185
  handler = new ManualTickHandler();
8933
9186
  break;
8934
9187
  default:
8935
- console.warn("非法的计时器模式"), handler = new RAFTickHandler();
9188
+ Logger.getInstance().warn("非法的计时器模式"), handler = new RAFTickHandler();
8936
9189
  }
8937
9190
  return !!handler.avaliable() && (this.tickerHandler && this.tickerHandler.release(), this.tickerHandler = handler, !0);
8938
9191
  }
@@ -9771,7 +10024,7 @@
9771
10024
  }
9772
10025
  lastStep = lastStep.prev;
9773
10026
  }
9774
- return console.warn("未知错误,step中找不到属性"), step.props[name];
10027
+ return Logger.getInstance().warn("未知错误,step中找不到属性"), step.props[name];
9775
10028
  }
9776
10029
  }, {
9777
10030
  key: "updateTarget",
@@ -10200,6 +10453,19 @@
10200
10453
  }, {
10201
10454
  key: "onStart",
10202
10455
  value: function onStart() {
10456
+ this.target && ("rect" === this.target.type ? this.onStartRect() : "line" === this.target.type ? this.onStartLineOrArea("line") : "area" === this.target.type && this.onStartLineOrArea("area"));
10457
+ }
10458
+ }, {
10459
+ key: "onStartLineOrArea",
10460
+ value: function onStartLineOrArea(type) {
10461
+ var _a;
10462
+ var root = this.target.attachShadow(),
10463
+ line = application.graphicService.creator[type](Object.assign({}, null === (_a = this.params) || void 0 === _a ? void 0 : _a.attribute));
10464
+ this[type] = line, line.pathProxy = new CustomPath2D(), root.add(line);
10465
+ }
10466
+ }, {
10467
+ key: "onStartRect",
10468
+ value: function onStartRect() {
10203
10469
  var _a;
10204
10470
  var root = this.target.attachShadow(),
10205
10471
  height = this.target.AABBBounds.height(),
@@ -10226,6 +10492,11 @@
10226
10492
  }, {
10227
10493
  key: "onUpdate",
10228
10494
  value: function onUpdate(end, ratio, out) {
10495
+ return this.rect ? this.onUpdateRect(end, ratio, out) : this.line || this.area ? this.onUpdateLineOrArea(end, ratio, out) : void 0;
10496
+ }
10497
+ }, {
10498
+ key: "onUpdateRect",
10499
+ value: function onUpdateRect(end, ratio, out) {
10229
10500
  var _a, _b, _c, _d, _e, _f;
10230
10501
  var parentWidth = null !== (_a = this.target.attribute.width) && void 0 !== _a ? _a : 250,
10231
10502
  streamLength = null !== (_c = null === (_b = this.params) || void 0 === _b ? void 0 : _b.streamLength) && void 0 !== _c ? _c : parentWidth,
@@ -10246,6 +10517,114 @@
10246
10517
  }
10247
10518
  });
10248
10519
  }
10520
+ }, {
10521
+ key: "onUpdateLineOrArea",
10522
+ value: function onUpdateLineOrArea(end, ratio, out) {
10523
+ var target = this.line || this.area;
10524
+ if (!target) return;
10525
+ var customPath = target.pathProxy,
10526
+ targetLine = this.target;
10527
+ targetLine.cache || targetLine.cacheArea ? this._onUpdateLineOrAreaWithCache(customPath, targetLine, end, ratio, out) : this._onUpdateLineWithoutCache(customPath, targetLine, end, ratio, out);
10528
+ var targetAttrs = targetLine.attribute;
10529
+ target.setAttributes(Object.assign({
10530
+ stroke: targetAttrs.stroke
10531
+ }, target.attribute)), target.addUpdateBoundTag();
10532
+ }
10533
+ }, {
10534
+ key: "_onUpdateLineOrAreaWithCache",
10535
+ value: function _onUpdateLineOrAreaWithCache(customPath, g, end, ratio, out) {
10536
+ if (customPath.clear(), "line" === g.type) {
10537
+ var cache = g.cache;
10538
+ Array.isArray(cache) || (cache = [cache]);
10539
+ var totalLen = cache.reduce(function (l, c) {
10540
+ return l + c.getLength();
10541
+ }, 0),
10542
+ curves = [];
10543
+ return cache.forEach(function (c) {
10544
+ c.curves.forEach(function (ci) {
10545
+ return curves.push(ci);
10546
+ });
10547
+ }), this._updateCurves(customPath, curves, totalLen, ratio);
10548
+ }
10549
+ if ("area" === g.type) {
10550
+ var _cache = g.cacheArea,
10551
+ _totalLen = _cache.top.curves.reduce(function (a, b) {
10552
+ return a + b.getLength();
10553
+ }, 0);
10554
+ return this._updateCurves(customPath, _cache.top.curves, _totalLen, ratio);
10555
+ }
10556
+ }
10557
+ }, {
10558
+ key: "_updateCurves",
10559
+ value: function _updateCurves(customPath, curves, totalLen, ratio) {
10560
+ var _a, _b;
10561
+ var startLen = totalLen * ratio,
10562
+ endLen = Math.min(null !== (_b = startLen + (null === (_a = this.params) || void 0 === _a ? void 0 : _a.streamLength)) && void 0 !== _b ? _b : 10, totalLen);
10563
+ var lastLen = 0,
10564
+ start = !1;
10565
+ for (var i = 0; i < curves.length; i++) {
10566
+ var curveItem = curves[i],
10567
+ len = curveItem.getLength(),
10568
+ startPercent = 1 - (lastLen + len - startLen) / len;
10569
+ var curveForStart = void 0,
10570
+ endPercent = 1 - (lastLen + len - endLen) / len;
10571
+ if (lastLen < startLen && lastLen + len > startLen) if (start = !0, curveItem.p2 && curveItem.p3) {
10572
+ var _divideCubic = divideCubic(curveItem, startPercent),
10573
+ _divideCubic2 = _slicedToArray(_divideCubic, 2);
10574
+ _divideCubic2[0];
10575
+ var curve2 = _divideCubic2[1];
10576
+ customPath.moveTo(curve2.p0.x, curve2.p0.y), curveForStart = curve2;
10577
+ } else {
10578
+ var p = curveItem.getPointAt(startPercent);
10579
+ customPath.moveTo(p.x, p.y);
10580
+ }
10581
+ if (lastLen < endLen && lastLen + len > endLen) {
10582
+ if (curveItem.p2 && curveItem.p3) {
10583
+ curveForStart && (endPercent = (endLen - startLen) / curveForStart.getLength());
10584
+ var _divideCubic3 = divideCubic(curveForStart || curveItem, endPercent),
10585
+ _divideCubic4 = _slicedToArray(_divideCubic3, 1),
10586
+ curve1 = _divideCubic4[0];
10587
+ customPath.bezierCurveTo(curve1.p1.x, curve1.p1.y, curve1.p2.x, curve1.p2.y, curve1.p3.x, curve1.p3.y);
10588
+ } else {
10589
+ var _p = curveItem.getPointAt(endPercent);
10590
+ customPath.lineTo(_p.x, _p.y);
10591
+ }
10592
+ break;
10593
+ }
10594
+ if (start) if (curveItem.p2 && curveItem.p3) {
10595
+ var curve = curveForStart || curveItem;
10596
+ customPath.bezierCurveTo(curve.p1.x, curve.p1.y, curve.p2.x, curve.p2.y, curve.p3.x, curve.p3.y);
10597
+ } else customPath.lineTo(curveItem.p1.x, curveItem.p1.y);
10598
+ lastLen += len;
10599
+ }
10600
+ }
10601
+ }, {
10602
+ key: "_onUpdateLineWithoutCache",
10603
+ value: function _onUpdateLineWithoutCache(customPath, line, end, ratio, out) {
10604
+ var _a, _b;
10605
+ var _line$attribute = line.attribute,
10606
+ points = _line$attribute.points,
10607
+ curveType = _line$attribute.curveType;
10608
+ if (!points || points.length < 2 || "linear" !== curveType) return;
10609
+ var totalLen = 0;
10610
+ for (var i = 1; i < points.length; i++) totalLen += PointService.distancePP(points[i], points[i - 1]);
10611
+ var startLen = totalLen * ratio,
10612
+ endLen = Math.min(null !== (_b = startLen + (null === (_a = this.params) || void 0 === _a ? void 0 : _a.streamLength)) && void 0 !== _b ? _b : 10, totalLen),
10613
+ nextPoints = [];
10614
+ var lastLen = 0;
10615
+ for (var _i = 1; _i < points.length; _i++) {
10616
+ var len = PointService.distancePP(points[_i], points[_i - 1]);
10617
+ if (lastLen < startLen && lastLen + len > startLen && nextPoints.push(PointService.pointAtPP(points[_i - 1], points[_i], 1 - (lastLen + len - startLen) / len)), lastLen < endLen && lastLen + len > endLen) {
10618
+ nextPoints.push(PointService.pointAtPP(points[_i - 1], points[_i], 1 - (lastLen + len - endLen) / len));
10619
+ break;
10620
+ }
10621
+ nextPoints.length && nextPoints.push(points[_i]), lastLen += len;
10622
+ }
10623
+ if (nextPoints.length && !(nextPoints.length < 2)) {
10624
+ customPath.clear(), customPath.moveTo(nextPoints[0].x, nextPoints[0].y);
10625
+ for (var _i2 = 1; _i2 < nextPoints.length; _i2++) customPath.lineTo(nextPoints[_i2].x, nextPoints[_i2].y);
10626
+ }
10627
+ }
10249
10628
  }]);
10250
10629
  return StreamLight;
10251
10630
  }(ACustomAnimate);
@@ -10355,8 +10734,8 @@
10355
10734
  firstMatchedIndex = i, firstMatchedPoint = tagMap.get(this.toPoints[i].context);
10356
10735
  break;
10357
10736
  }
10358
- for (var _i = this.toPoints.length - 1; _i >= 0; _i -= 1) if (tagMap.has(this.toPoints[_i].context)) {
10359
- lastMatchedIndex = _i, lastMatchedPoint = tagMap.get(this.toPoints[_i].context);
10737
+ for (var _i3 = this.toPoints.length - 1; _i3 >= 0; _i3 -= 1) if (tagMap.has(this.toPoints[_i3].context)) {
10738
+ lastMatchedIndex = _i3, lastMatchedPoint = tagMap.get(this.toPoints[_i3].context);
10360
10739
  break;
10361
10740
  }
10362
10741
  var prevMatchedPoint = this.toPoints[0];
@@ -12700,6 +13079,7 @@
12700
13079
  if (!animate.validAttr(key)) return;
12701
13080
  var nextStepVal = nextProps[key],
12702
13081
  lastStepVal = null !== (_a = lastProps && lastProps[key]) && void 0 !== _a ? _a : subAnimate.getLastPropByName(key, step);
13082
+ if (null == nextStepVal || null == lastStepVal) return void (nextAttributes[key] = nextStepVal);
12703
13083
  var match;
12704
13084
  match = animate.interpolateFunc && animate.interpolateFunc(key, ratio, lastStepVal, nextStepVal, nextAttributes), match || (match = animate.customInterpolate(key, ratio, lastStepVal, nextStepVal, _this7, nextAttributes), match || _this7.defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio) || _this7._interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes));
12705
13085
  }), step.parsedProps = nextParsedProps;
@@ -14416,12 +14796,12 @@
14416
14796
  }
14417
14797
  }, {
14418
14798
  key: "GetLayout",
14419
- value: function GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, miniApp) {
14799
+ value: function GetLayout(str, width, height, textAlign, textBaseline, lineHeight, suffix, wordBreak, suffixPosition) {
14420
14800
  var linesLayout = [],
14421
14801
  bboxWH = [width, height],
14422
14802
  bboxOffset = [0, 0];
14423
14803
  for (; str.length > 0;) {
14424
- var _this$textMeasure$cli = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak),
14804
+ var _this$textMeasure$cli = this.textMeasure.clipTextWithSuffix(str, this.textOptions, width, suffix, wordBreak, suffixPosition),
14425
14805
  clipText = _this$textMeasure$cli.str;
14426
14806
  linesLayout.push({
14427
14807
  str: clipText,
@@ -14443,6 +14823,7 @@
14443
14823
  var suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
14444
14824
  var wordBreak = arguments.length > 5 ? arguments[5] : undefined;
14445
14825
  var lineWidth = arguments.length > 6 ? arguments[6] : undefined;
14826
+ var suffixPosition = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : "end";
14446
14827
  lines = lines.map(function (l) {
14447
14828
  return l.toString();
14448
14829
  });
@@ -14451,7 +14832,7 @@
14451
14832
  if ("number" == typeof lineWidth && lineWidth !== 1 / 0) {
14452
14833
  var width;
14453
14834
  for (var i = 0, len = lines.length; i < len; i++) width = Math.min(this.textMeasure.measureTextWidth(lines[i], this.textOptions), lineWidth), linesLayout.push({
14454
- str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak).str,
14835
+ str: this.textMeasure.clipTextWithSuffix(lines[i], this.textOptions, width, suffix, wordBreak, suffixPosition).str,
14455
14836
  width: width
14456
14837
  });
14457
14838
  bboxWH[0] = lineWidth;
@@ -14729,12 +15110,12 @@
14729
15110
  stroke = _attribute$stroke === void 0 ? textTheme.stroke : _attribute$stroke,
14730
15111
  _attribute$lineWidth = attribute.lineWidth,
14731
15112
  lineWidth = _attribute$lineWidth === void 0 ? textTheme.lineWidth : _attribute$lineWidth,
14732
- _attribute$wordBreak = attribute.wordBreak;
14733
- _attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
14734
- var _attribute$ignoreBuf = attribute.ignoreBuf,
15113
+ _attribute$ignoreBuf = attribute.ignoreBuf,
14735
15114
  ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
14736
15115
  _attribute$whiteSpace = attribute.whiteSpace,
14737
- whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
15116
+ whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace,
15117
+ _attribute$suffixPosi = attribute.suffixPosition,
15118
+ suffixPosition = _attribute$suffixPosi === void 0 ? textTheme.suffixPosition : _attribute$suffixPosi;
14738
15119
  if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
14739
15120
  var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
14740
15121
  textFontSize = attribute.fontSize || textTheme.fontSize,
@@ -14752,7 +15133,7 @@
14752
15133
  fontSize: fontSize,
14753
15134
  fontWeight: fontWeight,
14754
15135
  fontFamily: fontFamily
14755
- }, maxLineWidth, strEllipsis, !1);
15136
+ }, maxLineWidth, strEllipsis, !1, suffixPosition);
14756
15137
  str = data.str, width = data.width;
14757
15138
  } else {
14758
15139
  var _data = textMeasure.clipText(text.toString(), {
@@ -14812,6 +15193,8 @@
14812
15193
  lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
14813
15194
  _attribute$verticalMo = attribute.verticalMode,
14814
15195
  verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo,
15196
+ _attribute$suffixPosi2 = attribute.suffixPosition,
15197
+ suffixPosition = _attribute$suffixPosi2 === void 0 ? textTheme.suffixPosition : _attribute$suffixPosi2,
14815
15198
  lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14816
15199
  var _attribute$textAlign2 = attribute.textAlign,
14817
15200
  textAlign = _attribute$textAlign2 === void 0 ? textTheme.textAlign : _attribute$textAlign2,
@@ -14835,7 +15218,7 @@
14835
15218
  fontSize: fontSize,
14836
15219
  fontWeight: fontWeight,
14837
15220
  fontFamily: fontFamily
14838
- }, maxLineWidth, strEllipsis, !1);
15221
+ }, maxLineWidth, strEllipsis, !1, suffixPosition);
14839
15222
  verticalList = [data.verticalList], width = data.width;
14840
15223
  } else {
14841
15224
  var _data2 = textMeasure.clipTextVertical(verticalList[0], {
@@ -14884,6 +15267,8 @@
14884
15267
  lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
14885
15268
  _attribute$whiteSpace2 = attribute.whiteSpace,
14886
15269
  whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2,
15270
+ _attribute$suffixPosi3 = attribute.suffixPosition,
15271
+ suffixPosition = _attribute$suffixPosi3 === void 0 ? textTheme.suffixPosition : _attribute$suffixPosi3,
14887
15272
  lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
14888
15273
  if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
14889
15274
  if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
@@ -14895,7 +15280,7 @@
14895
15280
  fontSize: fontSize,
14896
15281
  fontWeight: fontWeight,
14897
15282
  fontFamily: fontFamily
14898
- }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth),
15283
+ }, textMeasure).GetLayoutByLines(text, textAlign, textBaseline, lineHeight, !0 === ellipsis ? textTheme.ellipsis : ellipsis || void 0, !1, maxLineWidth, suffixPosition),
14899
15284
  bbox = layoutData.bbox;
14900
15285
  return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
14901
15286
  }
@@ -14926,6 +15311,8 @@
14926
15311
  lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
14927
15312
  _attribute$verticalMo2 = attribute.verticalMode,
14928
15313
  verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2,
15314
+ _attribute$suffixPosi4 = attribute.suffixPosition,
15315
+ suffixPosition = _attribute$suffixPosi4 === void 0 ? textTheme.suffixPosition : _attribute$suffixPosi4,
14929
15316
  lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14930
15317
  var _attribute$textAlign4 = attribute.textAlign,
14931
15318
  textAlign = _attribute$textAlign4 === void 0 ? textTheme.textAlign : _attribute$textAlign4,
@@ -14958,7 +15345,7 @@
14958
15345
  fontSize: fontSize,
14959
15346
  fontWeight: fontWeight,
14960
15347
  fontFamily: fontFamily
14961
- }, maxLineWidth, strEllipsis, !1);
15348
+ }, maxLineWidth, strEllipsis, !1, suffixPosition);
14962
15349
  verticalLists[i] = data.verticalList, width = data.width;
14963
15350
  } else {
14964
15351
  var _data3 = textMeasure.clipTextVertical(verticalData, {
@@ -16094,6 +16481,7 @@
16094
16481
  }, {
16095
16482
  key: "_isValid",
16096
16483
  value: function _isValid() {
16484
+ if (this.pathProxy) return !0;
16097
16485
  var _this$attribute = this.attribute,
16098
16486
  points = _this$attribute.points,
16099
16487
  segments = _this$attribute.segments;
@@ -17402,6 +17790,7 @@
17402
17790
  }, {
17403
17791
  key: "_isValid",
17404
17792
  value: function _isValid() {
17793
+ if (this.pathProxy) return !0;
17405
17794
  var _this$attribute = this.attribute,
17406
17795
  points = _this$attribute.points,
17407
17796
  segments = _this$attribute.segments;
@@ -18822,8 +19211,12 @@
18822
19211
  boundStroke(tb1, scaledHalfLineWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
18823
19212
  }
18824
19213
  if (shadowBlur) {
18825
- var shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
18826
- boundStroke(tb1, shadowBlurHalfWidth, miter, strokeBoundsBuffer), aabbBounds.union(tb1);
19214
+ var _attribute$shadowOffs = attribute.shadowOffsetX,
19215
+ shadowOffsetX = _attribute$shadowOffs === void 0 ? theme.shadowOffsetX : _attribute$shadowOffs,
19216
+ _attribute$shadowOffs2 = attribute.shadowOffsetY,
19217
+ shadowOffsetY = _attribute$shadowOffs2 === void 0 ? theme.shadowOffsetY : _attribute$shadowOffs2,
19218
+ shadowBlurWidth = shadowBlur / Math.abs(scaleX + scaleY) * 2 + Math.max(shadowOffsetX, shadowOffsetY);
19219
+ boundStroke(tb1, shadowBlurWidth, miter, strokeBoundsBuffer + 1), aabbBounds.union(tb1);
18827
19220
  }
18828
19221
  this.combindShadowAABBBounds(aabbBounds, graphic), transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix);
18829
19222
  }
@@ -20963,7 +21356,10 @@
20963
21356
  _createClass(DefaultBaseBackgroundRenderContribution, [{
20964
21357
  key: "drawShape",
20965
21358
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
20966
- var background = graphic.attribute.background;
21359
+ var _graphic$attribute = graphic.attribute,
21360
+ background = _graphic$attribute.background,
21361
+ _graphic$attribute$ba = _graphic$attribute.backgroundMode,
21362
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
20967
21363
  if (background) if (graphic.backgroundImg && graphic.resources) {
20968
21364
  var res = graphic.resources.get(background);
20969
21365
  if ("success" !== res.state || !res.data) return;
@@ -20978,9 +21374,17 @@
20978
21374
  }
20979
21375
  context.clip();
20980
21376
  var b = graphic.AABBBounds;
20981
- context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.drawImage(res.data, b.x1, b.y1, b.width(), b.height()), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
21377
+ context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
20982
21378
  } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20983
21379
  }
21380
+ }, {
21381
+ key: "doDrawImage",
21382
+ value: function doDrawImage(context, data, b, backgroundMode) {
21383
+ if ("no-repeat" === backgroundMode) context.drawImage(data, b.x1, b.y1, b.width(), b.height());else {
21384
+ var pattern = context.createPattern(data, backgroundMode);
21385
+ context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, b.width(), b.height()), context.translate(-b.x1, -b.y1);
21386
+ }
21387
+ }
20984
21388
  }]);
20985
21389
  return DefaultBaseBackgroundRenderContribution;
20986
21390
  }();
@@ -21101,15 +21505,15 @@
21101
21505
  key: "drawShape",
21102
21506
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
21103
21507
  this.textureMap || this.initTextureMap(context, graphic.stage);
21104
- var _graphic$attribute = graphic.attribute,
21105
- _graphic$attribute$te = _graphic$attribute.texture,
21106
- texture = _graphic$attribute$te === void 0 ? graphicAttribute.texture : _graphic$attribute$te,
21107
- _graphic$attribute$te2 = _graphic$attribute.textureColor,
21108
- textureColor = _graphic$attribute$te2 === void 0 ? graphicAttribute.textureColor : _graphic$attribute$te2,
21109
- _graphic$attribute$te3 = _graphic$attribute.textureSize,
21110
- textureSize = _graphic$attribute$te3 === void 0 ? graphicAttribute.textureSize : _graphic$attribute$te3,
21111
- _graphic$attribute$te4 = _graphic$attribute.texturePadding,
21112
- texturePadding = _graphic$attribute$te4 === void 0 ? graphicAttribute.texturePadding : _graphic$attribute$te4;
21508
+ var _graphic$attribute2 = graphic.attribute,
21509
+ _graphic$attribute2$t = _graphic$attribute2.texture,
21510
+ texture = _graphic$attribute2$t === void 0 ? graphicAttribute.texture : _graphic$attribute2$t,
21511
+ _graphic$attribute2$t2 = _graphic$attribute2.textureColor,
21512
+ textureColor = _graphic$attribute2$t2 === void 0 ? graphicAttribute.textureColor : _graphic$attribute2$t2,
21513
+ _graphic$attribute2$t3 = _graphic$attribute2.textureSize,
21514
+ textureSize = _graphic$attribute2$t3 === void 0 ? graphicAttribute.textureSize : _graphic$attribute2$t3,
21515
+ _graphic$attribute2$t4 = _graphic$attribute2.texturePadding,
21516
+ texturePadding = _graphic$attribute2$t4 === void 0 ? graphicAttribute.texturePadding : _graphic$attribute2$t4;
21113
21517
  if (!texture) return;
21114
21518
  var pattern = this.textureMap.get(texture);
21115
21519
  if (!pattern) switch (texture) {
@@ -21359,13 +21763,16 @@
21359
21763
  _createClass(DefaultGroupBackgroundRenderContribution, [{
21360
21764
  key: "drawShape",
21361
21765
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
21362
- var background = graphic.attribute.background;
21766
+ var _graphic$attribute = graphic.attribute,
21767
+ background = _graphic$attribute.background,
21768
+ _graphic$attribute$ba = _graphic$attribute.backgroundMode,
21769
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
21363
21770
  if (background) if (graphic.backgroundImg && graphic.resources) {
21364
21771
  var res = graphic.resources.get(background);
21365
21772
  if ("success" !== res.state || !res.data) return;
21366
21773
  context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
21367
21774
  var b = graphic.AABBBounds;
21368
- context.drawImage(res.data, b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore(), context.setTransformForCurrent();
21775
+ this.doDrawImage(context, res.data, b, backgroundMode), context.highPerformanceRestore(), context.setTransformForCurrent();
21369
21776
  } else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
21370
21777
  }
21371
21778
  }]);
@@ -21393,9 +21800,9 @@
21393
21800
  key: "drawShape",
21394
21801
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
21395
21802
  var _graphic$attribute = graphic.attribute,
21396
- background = _graphic$attribute.background;
21397
- _graphic$attribute.width;
21398
- _graphic$attribute.height;
21803
+ background = _graphic$attribute.background,
21804
+ _graphic$attribute$ba = _graphic$attribute.backgroundMode,
21805
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
21399
21806
  if (background) if (graphic.backgroundImg) {
21400
21807
  var res = graphic.resources.get(background);
21401
21808
  if ("success" !== res.state || !res.data) return;
@@ -21409,7 +21816,7 @@
21409
21816
  context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.translate(scrollX, scrollY);
21410
21817
  }
21411
21818
  var b = graphic.AABBBounds;
21412
- context.drawImage(res.data, b.x1, b.y1, b.width(), b.height()), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
21819
+ this.doDrawImage(context, res.data, b, backgroundMode), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
21413
21820
  } else if (isObject$1(background)) {
21414
21821
  var stroke = background.stroke,
21415
21822
  fill = background.fill,
@@ -21426,9 +21833,9 @@
21426
21833
  var _getActualPosition = getActualPosition(graphic),
21427
21834
  _x = _getActualPosition.x,
21428
21835
  _y = _getActualPosition.y,
21429
- _width = _getActualPosition.width,
21430
- _height = _getActualPosition.height;
21431
- cornerRadius ? createRectPath(context, _x - expandX, _y - expandY, _width + 2 * expandX, _height + 2 * expandY, cornerRadius) : context.rect(_x - expandX, _y - expandY, _width + 2 * expandX, _height + 2 * expandY), context.globalAlpha = 1, fill && (context.fillStyle = fill, context.fill()), stroke && lineWidth > 0 && (context.lineWidth = lineWidth, context.strokeStyle = stroke, context.stroke());
21836
+ width = _getActualPosition.width,
21837
+ height = _getActualPosition.height;
21838
+ cornerRadius ? createRectPath(context, _x - expandX, _y - expandY, width + 2 * expandX, height + 2 * expandY, cornerRadius) : context.rect(_x - expandX, _y - expandY, width + 2 * expandX, height + 2 * expandY), context.globalAlpha = 1, fill && (context.fillStyle = fill, context.fill()), stroke && lineWidth > 0 && (context.lineWidth = lineWidth, context.strokeStyle = stroke, context.stroke());
21432
21839
  } else {
21433
21840
  context.beginPath();
21434
21841
  var _b = graphic.AABBBounds;
@@ -22759,7 +23166,8 @@
22759
23166
  var b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
22760
23167
  dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
22761
23168
  }
22762
- this.backupDirtyBounds.copy(dirtyBounds), context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
23169
+ var d = context.dpr % 1;
23170
+ (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);
22763
23171
  var drawInArea = dirtyBounds.width() * context.dpr !== context.canvas.width || dirtyBounds.height() * context.dpr !== context.canvas.height;
22764
23172
  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) {
22765
23173
  var _a, _b;
@@ -22884,7 +23292,7 @@
22884
23292
  }, {
22885
23293
  key: "selectRenderByType",
22886
23294
  value: function selectRenderByType(type) {
22887
- return console.warn("未知错误,不应该走到这里"), null;
23295
+ return Logger.getInstance().warn("未知错误,不应该走到这里"), null;
22888
23296
  }
22889
23297
  }, {
22890
23298
  key: "selectRenderByNumberType",
@@ -29216,7 +29624,7 @@
29216
29624
  var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29217
29625
  _classCallCheck(this, Gesture);
29218
29626
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
29219
- _this = _super.call(this), _this.cachedEvents = [], _this.startPoints = [], _this.processEvent = {}, _this.throttleTimer = 0, _this.emitThrottles = [], _this.onStart = function (ev) {
29627
+ _this = _super.call(this), _this.cachedEvents = [], _this.startPoints = [], _this.processEvent = {}, _this.throttleTimer = 0, _this.emitThrottles = [], _this.lastTapTarget = null, _this.onStart = function (ev) {
29220
29628
  _this.reset(), _this.startTime = clock.now();
29221
29629
  var _assertThisInitialize = _assertThisInitialized(_this),
29222
29630
  cachedEvents = _assertThisInitialize.cachedEvents,
@@ -29300,7 +29708,7 @@
29300
29708
  velocity > _this.config.swipe.velocity && distance > _this.config.swipe.threshold && (endEvent.velocity = velocity, endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), _this.triggerEvent("swipe", endEvent));
29301
29709
  }
29302
29710
  }
29303
- 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);
29711
+ now - _this.lastTapTime < _this.config.tap.interval && ev.target === _this.lastTapTarget ? _this.tapCount++ : _this.tapCount = 1, _this.lastTapTime = now, _this.lastTapTarget = ev.target, 1 === _this.tapCount ? _this.triggerEvent("tap", endEvent) : 2 === _this.tapCount && (_this.triggerEvent("doubletap", endEvent), _this.tapCount = 0);
29304
29712
  }
29305
29713
  for (var i = 0, len = cachedEvents.length; i < len; i++) if (cachedEvents[i].pointerId === endEvent.pointerId) {
29306
29714
  cachedEvents.splice(i, 1), startPoints.splice(i, 1);
@@ -30751,7 +31159,7 @@
30751
31159
  }, {
30752
31160
  key: "reset",
30753
31161
  value: function reset() {
30754
- this.stack.length && console.warn("可能存在bug,matrix没有清空"), this.matrix.setValue(1, 0, 0, 1, 0, 0), this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack.length = 0, this.nativeContext.setTransform(1, 0, 0, 1, 0, 0);
31162
+ this.stack.length && Logger.getInstance().warn("可能存在bug,matrix没有清空"), this.matrix.setValue(1, 0, 0, 1, 0, 0), this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack.length = 0, this.nativeContext.setTransform(1, 0, 0, 1, 0, 0);
30755
31163
  }
30756
31164
  }, {
30757
31165
  key: "getCanvas",
@@ -34686,7 +35094,7 @@
34686
35094
 
34687
35095
  var roughModule = _roughModule;
34688
35096
 
34689
- const version = "0.16.17";
35097
+ const version = "0.16.18";
34690
35098
  loadAllModule(container);
34691
35099
 
34692
35100
  exports.ACustomAnimate = ACustomAnimate;