leafer-game 2.1.11 → 2.2.1

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/web.js CHANGED
@@ -811,6 +811,11 @@ var LeaferUI = function(exports) {
811
811
  toOuterOf(t, matrix, to) {
812
812
  toOuterPoint$3(matrix, t, to);
813
813
  },
814
+ toVertical(t, rotation, verticalDistance, to) {
815
+ const r = rotation * OneRadian;
816
+ t.x += -Math.sin(r) * verticalDistance;
817
+ t.y += Math.cos(r) * verticalDistance;
818
+ },
814
819
  getCenter(t, to) {
815
820
  return {
816
821
  x: t.x + (to.x - t.x) / 2,
@@ -4256,10 +4261,13 @@ var LeaferUI = function(exports) {
4256
4261
  function surfaceType(defaultValue) {
4257
4262
  return decorateLeafAttr(defaultValue, key => attr({
4258
4263
  set(value) {
4259
- this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
4264
+ this.__setAttr(key, value) && doSurfaceType(this);
4260
4265
  }
4261
4266
  }));
4262
4267
  }
4268
+ function doSurfaceType(leaf) {
4269
+ leaf.__layout.surfaceChanged || leaf.__layout.surfaceChange();
4270
+ }
4263
4271
  function dimType(defaultValue) {
4264
4272
  return decorateLeafAttr(defaultValue, key => attr({
4265
4273
  set(value) {
@@ -4319,12 +4327,12 @@ var LeaferUI = function(exports) {
4319
4327
  }
4320
4328
  }));
4321
4329
  }
4322
- function maskType(defaultValue) {
4330
+ function maskType(defaultValue, updateSelf) {
4323
4331
  return decorateLeafAttr(defaultValue, key => attr({
4324
4332
  set(value) {
4325
4333
  if (this.__setAttr(key, value)) {
4326
4334
  this.__layout.boxChanged || this.__layout.boxChange();
4327
- this.waitParent(() => {
4335
+ updateSelf ? this.__updateMask() : this.waitParent(() => {
4328
4336
  this.parent.__updateMask(value);
4329
4337
  });
4330
4338
  }
@@ -5855,7 +5863,8 @@ var LeaferUI = function(exports) {
5855
5863
  if (this.__worldOpacity && hasSize(nowWorld)) {
5856
5864
  const data = this.__;
5857
5865
  if (data.__useDim) {
5858
- if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5866
+ if (data.bright && !options.topRendering) return options.topList.add(this);
5867
+ if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
5859
5868
  }
5860
5869
  if (data.__single && !this.isBranchLeaf) {
5861
5870
  if (data.eraser === "path") return this.__renderEraser(canvas, options);
@@ -5879,6 +5888,7 @@ var LeaferUI = function(exports) {
5879
5888
  child = children[i];
5880
5889
  excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
5881
5890
  }
5891
+ if (this.__hasMask === 0) this.__rerenderMask(canvas, options);
5882
5892
  }
5883
5893
  },
5884
5894
  __clip(canvas, options) {
@@ -6087,11 +6097,19 @@ var LeaferUI = function(exports) {
6087
6097
  updateLayout() {
6088
6098
  this.__layout.update();
6089
6099
  }
6090
- forceUpdate(attrName) {
6091
- if (isUndefined(attrName)) attrName = "width"; else if (attrName === "surface") attrName = "blendMode";
6092
- const value = this.__.__getInput(attrName);
6093
- this.__[attrName] = isUndefined(value) ? null : undefined;
6094
- this[attrName] = value;
6100
+ forceUpdate(typeOrAttrName) {
6101
+ let quick;
6102
+ if (!typeOrAttrName || typeOrAttrName === "bounds") doBoundsType(this), quick = true; else if (typeOrAttrName === "surface") doSurfaceType(this),
6103
+ quick = true; else if (typeOrAttrName === "stroke") doStrokeType(this), quick = true;
6104
+ if (quick) {
6105
+ const {leafer: leafer} = this;
6106
+ return leafer && leafer.watcher && leafer.watcher.__onAttrChange({
6107
+ target: this
6108
+ });
6109
+ }
6110
+ const value = this.__.__getInput(typeOrAttrName);
6111
+ this.__[typeOrAttrName] = isUndefined(value) ? null : undefined;
6112
+ this[typeOrAttrName] = value;
6095
6113
  }
6096
6114
  forceRender(_bounds, _sync) {
6097
6115
  this.forceUpdate("surface");
@@ -6110,7 +6128,8 @@ var LeaferUI = function(exports) {
6110
6128
  canvas.restore();
6111
6129
  }
6112
6130
  __updateMask(_value) {
6113
- this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
6131
+ const hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
6132
+ this.__hasMask = this.__.maskskip ? hasMask && 0 : hasMask;
6114
6133
  }
6115
6134
  __getNowWorld(options) {
6116
6135
  if (options.matrix) {
@@ -6569,7 +6588,7 @@ var LeaferUI = function(exports) {
6569
6588
  this.levelMap = null;
6570
6589
  }
6571
6590
  }
6572
- const version = "2.1.11";
6591
+ const version = "2.2.1";
6573
6592
  const debug$5 = Debug.get("LeaferCanvas");
6574
6593
  class LeaferCanvas extends LeaferCanvasBase {
6575
6594
  set zIndex(zIndex) {
@@ -7450,7 +7469,7 @@ var LeaferUI = function(exports) {
7450
7469
  for (let i = 0, len = list.length; i < len; i++) {
7451
7470
  find = list[i];
7452
7471
  if (ignoreHittable || LeafHelper.worldHittable(find)) {
7453
- this.hitChild(find, point);
7472
+ this.hitChild(find, find.hitThrough ? this.point : point);
7454
7473
  if (findList.length) {
7455
7474
  if (find.isBranchLeaf && list.some(item => item !== find && LeafHelper.hasParent(item, find))) {
7456
7475
  findList.reset();
@@ -7463,7 +7482,7 @@ var LeaferUI = function(exports) {
7463
7482
  }
7464
7483
  if (bottomList) {
7465
7484
  for (let i = 0, len = bottomList.length; i < len; i++) {
7466
- this.hitChild(bottomList[i].target, this.point, bottomList[i].proxy);
7485
+ this.hitChild(bottomList[i].target, this.point, undefined, bottomList[i].proxy);
7467
7486
  if (findList.length) return findList.list[0];
7468
7487
  }
7469
7488
  }
@@ -7521,42 +7540,38 @@ var LeaferUI = function(exports) {
7521
7540
  hitBranch(branch) {
7522
7541
  this.eachFind(branch.children, branch.__onlyHitMask);
7523
7542
  }
7524
- eachFind(children, hitMask) {
7543
+ eachFind(children, onlyHitMask) {
7525
7544
  let child, hit, data;
7526
7545
  const {point: point} = this, len = children.length;
7527
7546
  for (let i = len - 1; i > -1; i--) {
7528
7547
  child = children[i], data = child.__;
7529
- if (!data.visible || hitMask && !data.mask) continue;
7548
+ if (!data.visible || onlyHitMask && !data.mask) continue;
7530
7549
  hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$2, point, data.hitRadius) : point);
7531
7550
  if (child.isBranch) {
7532
7551
  if (hit || child.__ignoreHitWorld) {
7533
7552
  if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
7534
7553
  if (child.topChildren) this.eachFind(child.topChildren, false);
7535
7554
  this.eachFind(child.children, child.__onlyHitMask);
7536
- if (child.isBranchLeaf) this.hitChild(child, point);
7555
+ if (child.isBranchLeaf) this.hitChild(child, point, onlyHitMask);
7537
7556
  }
7538
7557
  } else {
7539
- if (hit) this.hitChild(child, point);
7558
+ if (hit) this.hitChild(child, point, onlyHitMask);
7540
7559
  }
7541
7560
  }
7542
7561
  }
7543
- hitChild(child, point, proxy) {
7562
+ hitChild(child, point, onlyHitMask, proxy) {
7544
7563
  if (this.exclude && this.exclude.has(child)) return;
7545
- if (child.__hitWorld(point)) {
7546
- const {parent: parent} = child;
7547
- if (parent && parent.__hasMask && !child.__.mask) {
7548
- let findMasks = [], item;
7549
- const {children: children} = parent;
7550
- for (let i = 0, len = children.length; i < len; i++) {
7551
- item = children[i];
7552
- if (item.__.mask) findMasks.push(item);
7553
- if (item === child) {
7554
- if (findMasks && !findMasks.every(value => value.__hitWorld(point))) return;
7555
- break;
7556
- }
7557
- }
7564
+ if (child.__hitWorld(point, onlyHitMask && child.mask === "path" ? true : undefined)) {
7565
+ const {parent: parent, mask: mask} = child;
7566
+ if (parent && parent.__hasMask && mask && !(mask === "clipping" || mask === "clipping-path")) {
7567
+ if (!parent.children.some(item => !item.mask && item.__hitWorld(point))) return;
7558
7568
  }
7559
- this.findList.add(proxy || child);
7569
+ const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
7570
+ if (hitThrough) {
7571
+ const index = findList.list.findIndex(item => item[hitThrough] === child[hitThrough]);
7572
+ if (index > 0) return findList.addAt(leaf, index);
7573
+ }
7574
+ findList.add(leaf);
7560
7575
  }
7561
7576
  }
7562
7577
  clear() {
@@ -8323,6 +8338,7 @@ var LeaferUI = function(exports) {
8323
8338
  __decorate([ dataType("auto") ], exports.UI.prototype, "dragBoundsType", void 0);
8324
8339
  __decorate([ dataType(false) ], exports.UI.prototype, "editable", void 0);
8325
8340
  __decorate([ hitType(true) ], exports.UI.prototype, "hittable", void 0);
8341
+ __decorate([ hitType() ], exports.UI.prototype, "hitThrough", void 0);
8326
8342
  __decorate([ hitType("path") ], exports.UI.prototype, "hitFill", void 0);
8327
8343
  __decorate([ strokeType("path") ], exports.UI.prototype, "hitStroke", void 0);
8328
8344
  __decorate([ hitType(false) ], exports.UI.prototype, "hitBox", void 0);
@@ -9165,7 +9181,7 @@ var LeaferUI = function(exports) {
9165
9181
  data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
9166
9182
  stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
9167
9183
  stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
9168
- stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
9184
+ stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || data.motionText || textCase !== "none");
9169
9185
  data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
9170
9186
  }
9171
9187
  __updateBoxBounds() {
@@ -9190,7 +9206,7 @@ var LeaferUI = function(exports) {
9190
9206
  this.__updateNaturalSize();
9191
9207
  } else super.__updateBoxBounds();
9192
9208
  if (italic) b.width += fontSize * .16;
9193
- DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9209
+ DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds) && !data.motionText);
9194
9210
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9195
9211
  }
9196
9212
  __updateRenderSpread() {
@@ -9912,6 +9928,7 @@ var LeaferUI = function(exports) {
9912
9928
  }
9913
9929
  dragEnd(data) {
9914
9930
  if (!this.dragging && !this.moving) return;
9931
+ setTimeout(() => this.interaction.pointerMove(data));
9915
9932
  if (this.checkDragEndAnimate(data)) return;
9916
9933
  this.dragEndReal(data);
9917
9934
  }
@@ -10638,8 +10655,10 @@ var LeaferUI = function(exports) {
10638
10655
  if (!needHitFillPath && !needHitStrokePath) return false;
10639
10656
  const radiusWidth = inner.radiusX * 2;
10640
10657
  let hitWidth = radiusWidth;
10658
+ let {strokeAlign: strokeAlign} = data;
10659
+ if (data.motionText) hitWidth += data.fontSize / 2, strokeAlign = "center";
10641
10660
  if (needHitStrokePath) {
10642
- switch (data.strokeAlign) {
10661
+ switch (strokeAlign) {
10643
10662
  case "inside":
10644
10663
  hitWidth += strokeWidth * 2;
10645
10664
  if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth)) return true;
@@ -10669,9 +10688,9 @@ var LeaferUI = function(exports) {
10669
10688
  return this.__hitCanvas ? ui$4.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
10670
10689
  };
10671
10690
  exports.Text.prototype.__drawHitPath = function(canvas) {
10672
- const {__lineHeight: __lineHeight, fontSize: fontSize, __baseLine: __baseLine, __letterSpacing: __letterSpacing, __textDrawData: data} = this.__;
10691
+ const data = this.__, {__lineHeight: __lineHeight, fontSize: fontSize, __baseLine: __baseLine, __letterSpacing: __letterSpacing, __textDrawData: drawData} = data;
10673
10692
  canvas.beginPath();
10674
- if (__letterSpacing < 0) this.__drawPathByBox(canvas); else data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
10693
+ if (data.motionText) this.__drawPathByData(canvas, data.__pathForMotionText); else if (__letterSpacing < 0) this.__drawPathByBox(canvas); else drawData.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
10675
10694
  };
10676
10695
  exports.Group.prototype.pick = function(hitPoint, options) {
10677
10696
  options || (options = emptyData);
@@ -11065,7 +11084,8 @@ var LeaferUI = function(exports) {
11065
11084
  function fillPathOrText(ui, canvas, renderOptions) {
11066
11085
  ui.__.__font ? Paint.fillText(ui, canvas, renderOptions) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
11067
11086
  }
11068
- function fillText(ui, canvas, _renderOptions) {
11087
+ function fillText(ui, canvas, renderOptions) {
11088
+ if (ui.motionText) return Paint.fillMotionText(ui, canvas, renderOptions);
11069
11089
  const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
11070
11090
  if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
11071
11091
  let row;
@@ -11435,7 +11455,7 @@ var LeaferUI = function(exports) {
11435
11455
  data.__naturalWidth = image.width / data.pixelRatio;
11436
11456
  data.__naturalHeight = image.height / data.pixelRatio;
11437
11457
  if (data.__autoSide) {
11438
- ui.forceUpdate("width");
11458
+ ui.forceUpdate();
11439
11459
  LeafHelper.updateBounds(ui);
11440
11460
  ui.__layout.boundsChanged = true;
11441
11461
  if (ui.__proxyData) {
@@ -12298,7 +12318,8 @@ var LeaferUI = function(exports) {
12298
12318
  const TextMode = 2;
12299
12319
  function layoutChar(drawData, style, width, _height) {
12300
12320
  const {rows: rows} = drawData;
12301
- const {textAlign: textAlign, paraIndent: paraIndent, __letterSpacing: __letterSpacing} = style;
12321
+ const {textAlign: textAlign, paraIndent: paraIndent} = style;
12322
+ const useLetter = style.__letterSpacing || style.motionText;
12302
12323
  const justifyLast = width && textAlign.includes("both");
12303
12324
  const justify = justifyLast || width && textAlign.includes("justify");
12304
12325
  const justifyLetter = justify && textAlign.includes("letter");
@@ -12311,8 +12332,8 @@ var LeaferUI = function(exports) {
12311
12332
  remainingWidth = width - row.width - indentWidth;
12312
12333
  if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
12313
12334
  }
12314
- mode = __letterSpacing || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
12315
- if (row.isOverflow && !__letterSpacing) row.textMode = true;
12335
+ mode = useLetter || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
12336
+ if (row.isOverflow && !useLetter) row.textMode = true;
12316
12337
  if (mode === TextMode) {
12317
12338
  row.x += indentWidth;
12318
12339
  toTextChar$1(row);
@@ -12504,6 +12525,7 @@ var LeaferUI = function(exports) {
12504
12525
  let width = style.__getInput("width") || 0;
12505
12526
  let height = style.__getInput("height") || 0;
12506
12527
  const {__padding: padding} = style;
12528
+ if (style.motionText) width = height = 0;
12507
12529
  if (padding) {
12508
12530
  if (width) x = padding[left], width -= padding[right] + padding[left], !width && (width = .01); else if (!style.autoSizeAlign) x = padding[left];
12509
12531
  if (height) y = padding[top], height -= padding[top] + padding[bottom], !height && (height = .01); else if (!style.autoSizeAlign) y = padding[top];
@@ -12695,7 +12717,7 @@ var LeaferUI = function(exports) {
12695
12717
  const data = this.__;
12696
12718
  const width = nowFrame.width / data.pixelRatio;
12697
12719
  const height = nowFrame.height / data.pixelRatio;
12698
- if (data.width !== width || data.height !== height) this.forceUpdate("width");
12720
+ if (data.width !== width || data.height !== height) this.forceUpdate();
12699
12721
  data.__naturalWidth = width;
12700
12722
  data.__naturalHeight = height;
12701
12723
  }
@@ -14125,7 +14147,7 @@ var LeaferUI = function(exports) {
14125
14147
  },
14126
14148
  getMotionPathData(data) {
14127
14149
  let total = 0, distance, segments = [];
14128
- let i = 0, x = 0, y = 0, toX, toY, command;
14150
+ let i = 0, x = 0, y = 0, toX, toY, command, closed;
14129
14151
  const len = data.length;
14130
14152
  while (i < len) {
14131
14153
  command = data[i];
@@ -14150,6 +14172,7 @@ var LeaferUI = function(exports) {
14150
14172
  break;
14151
14173
 
14152
14174
  case Z:
14175
+ closed = true;
14153
14176
  i += 1;
14154
14177
 
14155
14178
  default:
@@ -14161,13 +14184,16 @@ var LeaferUI = function(exports) {
14161
14184
  return {
14162
14185
  total: total,
14163
14186
  segments: segments,
14164
- data: data
14187
+ data: data,
14188
+ closed: closed
14165
14189
  };
14166
14190
  },
14167
- getDistancePoint(distanceData, motionDistance, motionPrecision) {
14168
- const {segments: segments, data: data} = distanceData;
14169
- motionDistance = UnitConvert.number(motionDistance, distanceData.total);
14170
- let total = 0, distance, to = {};
14191
+ getDistancePoint(distanceData, motionDistance, motionPrecision, offsetX) {
14192
+ const {segments: segments, data: data, total: total} = distanceData;
14193
+ motionDistance = UnitConvert.number(motionDistance, total);
14194
+ if (offsetX) motionDistance += offsetX;
14195
+ if (motionDistance > total) motionDistance = motionDistance % total;
14196
+ let nowDistance = 0, distance, to = {};
14171
14197
  let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
14172
14198
  let x1, y1, x2, y2, t;
14173
14199
  const len = data.length;
@@ -14179,15 +14205,20 @@ var LeaferUI = function(exports) {
14179
14205
  toX = data[i + 1];
14180
14206
  toY = data[i + 2];
14181
14207
  distance = segments[index];
14182
- if (total + distance >= motionDistance || !distanceData.total) {
14183
- if (!i) x = toX, y = toY;
14184
- tempFrom.x = x;
14185
- tempFrom.y = y;
14208
+ if (nowDistance + distance >= motionDistance || !distanceData.total) {
14186
14209
  to.x = toX;
14187
14210
  to.y = toY;
14188
- PointHelper.getDistancePoint(tempFrom, to, motionDistance - total, true);
14189
- to.rotation = PointHelper.getAngle(tempFrom, to);
14190
- return to;
14211
+ if (i) {
14212
+ tempFrom.x = x;
14213
+ tempFrom.y = y;
14214
+ PointHelper.getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
14215
+ to.rotation = PointHelper.getAngle(tempFrom, to);
14216
+ return to;
14217
+ } else {
14218
+ const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
14219
+ to.rotation = nextPoint.rotation;
14220
+ return to;
14221
+ }
14191
14222
  }
14192
14223
  x = toX;
14193
14224
  y = toY;
@@ -14198,9 +14229,9 @@ var LeaferUI = function(exports) {
14198
14229
  toX = data[i + 5];
14199
14230
  toY = data[i + 6];
14200
14231
  distance = segments[index];
14201
- if (total + distance >= motionDistance) {
14232
+ if (nowDistance + distance >= motionDistance) {
14202
14233
  x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
14203
- t = HighBezierHelper.getT(motionDistance - total, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
14234
+ t = HighBezierHelper.getT(motionDistance - nowDistance, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
14204
14235
  BezierHelper.getPointAndSet(t, x, y, x1, y1, x2, y2, toX, toY, to);
14205
14236
  to.rotation = HighBezierHelper.getRotation(t, x, y, x1, y1, x2, y2, toX, toY);
14206
14237
  return to;
@@ -14217,7 +14248,7 @@ var LeaferUI = function(exports) {
14217
14248
  distance = 0;
14218
14249
  }
14219
14250
  index++;
14220
- total += distance;
14251
+ nowDistance += distance;
14221
14252
  }
14222
14253
  return to;
14223
14254
  },
@@ -14308,21 +14339,48 @@ var LeaferUI = function(exports) {
14308
14339
  const ui$1 = exports.UI.prototype;
14309
14340
  const {updateMatrix: updateMatrix, updateAllMatrix: updateAllMatrix} = LeafHelper;
14310
14341
  const {updateBounds: updateBounds} = BranchHelper;
14342
+ const {toVertical: toVertical} = PointHelper;
14311
14343
  exports.UI.addAttr("motionPath", undefined, motionPathType);
14312
14344
  exports.UI.addAttr("motionPrecision", 1, motionPathType);
14313
14345
  exports.UI.addAttr("motion", undefined, motionPathType);
14346
+ exports.UI.addAttr("motionVertical", "below", motionPathType);
14314
14347
  exports.UI.addAttr("motionRotation", true, motionPathType);
14348
+ ui$1.getMotionPath = function() {
14349
+ return getMotionPath(this);
14350
+ };
14315
14351
  ui$1.getMotionPathData = function() {
14316
14352
  return getMotionPathData(getMotionPath(this));
14317
14353
  };
14318
- ui$1.getMotionPoint = function(motionDistance) {
14319
- const path = getMotionPath(this);
14320
- const data = getMotionPathData(path);
14354
+ ui$1.getMotionContentHeight = function() {
14355
+ return this.__layout.boxBounds.height;
14356
+ };
14357
+ ui$1.getMotionPoint = function(motionDistance, motionVertical, pathElement, offsetX = 0, offsetY = 0) {
14358
+ if (!pathElement) pathElement = getMotionPath(this);
14359
+ const data = getMotionPathData(pathElement);
14321
14360
  if (!data.total) return {};
14322
- const point = HighCurveHelper.getDistancePoint(data, motionDistance, path.motionPrecision);
14323
- MatrixHelper.toOuterPoint(path.localTransform, point);
14361
+ const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
14324
14362
  const {motionRotation: motionRotation} = this;
14325
- if (motionRotation === false) delete point.rotation; else if (isNumber(motionRotation)) point.rotation += motionRotation;
14363
+ if (isNumber(motionRotation)) point.rotation += motionRotation;
14364
+ let verticalType, verticalOffset;
14365
+ if (isObject(motionVertical)) verticalType = motionVertical.type, verticalOffset = motionVertical.offset; else if (isNumber(motionVertical)) verticalOffset = motionVertical; else verticalType = motionVertical;
14366
+ if (verticalType !== "below" || offsetY) {
14367
+ const {rotation: rotation} = point, height = this.getMotionContentHeight();
14368
+ if (verticalOffset) offsetY += verticalType === "above" ? -verticalOffset : verticalOffset;
14369
+ switch (verticalType) {
14370
+ case "above":
14371
+ toVertical(point, rotation, -height + offsetY);
14372
+ break;
14373
+
14374
+ case "center":
14375
+ toVertical(point, rotation, -height / 2 + offsetY);
14376
+ break;
14377
+
14378
+ case "below":
14379
+ default:
14380
+ toVertical(point, rotation, offsetY);
14381
+ }
14382
+ }
14383
+ MatrixHelper.toOuterPoint(pathElement.localTransform, point);
14326
14384
  return point;
14327
14385
  };
14328
14386
  ui$1.getMotionTotal = function() {
@@ -14351,7 +14409,11 @@ var LeaferUI = function(exports) {
14351
14409
  const data = getMotionPathData(leaf);
14352
14410
  if (data.total) leaf.__.__pathForRender = HighCurveHelper.getDistancePath(data, motion, leaf.motionPrecision);
14353
14411
  } else {
14354
- leaf.set(leaf.getMotionPoint(motion));
14412
+ if (leaf.motionText) leaf.__updateMotionText(); else {
14413
+ const point = leaf.getMotionPoint(motion);
14414
+ if (leaf.motionRotation === false) delete point.rotation;
14415
+ leaf.set(point);
14416
+ }
14355
14417
  if (!leaf.__hasAutoLayout) {
14356
14418
  if (leaf.isBranch) updateAllMatrix(leaf), updateBounds(leaf, leaf); else updateMatrix(leaf);
14357
14419
  }
@@ -14371,7 +14433,8 @@ var LeaferUI = function(exports) {
14371
14433
  function getMotionPathData(leaf) {
14372
14434
  const data = leaf.__;
14373
14435
  if (data.__pathForMotion) return data.__pathForMotion;
14374
- return data.__pathForMotion = HighCurveHelper.getMotionPathData(leaf.getPath(true, true));
14436
+ const path = data.__pathForMotion = HighCurveHelper.getMotionPathData(leaf.getPath(true, true));
14437
+ return path;
14375
14438
  }
14376
14439
  const {Yes: Yes, NoAndSkip: NoAndSkip, YesAndSkip: YesAndSkip} = exports.Answer;
14377
14440
  const idCondition = {}, classNameCondition = {}, tagCondition = {};
@@ -14672,6 +14735,7 @@ var LeaferUI = function(exports) {
14672
14735
  exports.dimType = dimType;
14673
14736
  exports.doBoundsType = doBoundsType;
14674
14737
  exports.doStrokeType = doStrokeType;
14738
+ exports.doSurfaceType = doSurfaceType;
14675
14739
  exports.effectType = effectType;
14676
14740
  exports.emptyData = emptyData;
14677
14741
  exports.eraserType = eraserType;