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 +131 -67
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +137 -68
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/web.module.js
CHANGED
|
@@ -856,6 +856,11 @@ const PointHelper = {
|
|
|
856
856
|
toOuterOf(t, matrix, to) {
|
|
857
857
|
toOuterPoint$3(matrix, t, to);
|
|
858
858
|
},
|
|
859
|
+
toVertical(t, rotation, verticalDistance, to) {
|
|
860
|
+
const r = rotation * OneRadian;
|
|
861
|
+
t.x += -Math.sin(r) * verticalDistance;
|
|
862
|
+
t.y += Math.cos(r) * verticalDistance;
|
|
863
|
+
},
|
|
859
864
|
getCenter(t, to) {
|
|
860
865
|
return {
|
|
861
866
|
x: t.x + (to.x - t.x) / 2,
|
|
@@ -4526,11 +4531,15 @@ function affectRenderBoundsType(defaultValue) {
|
|
|
4526
4531
|
function surfaceType(defaultValue) {
|
|
4527
4532
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4528
4533
|
set(value) {
|
|
4529
|
-
this.__setAttr(key, value) && (this
|
|
4534
|
+
this.__setAttr(key, value) && doSurfaceType(this);
|
|
4530
4535
|
}
|
|
4531
4536
|
}));
|
|
4532
4537
|
}
|
|
4533
4538
|
|
|
4539
|
+
function doSurfaceType(leaf) {
|
|
4540
|
+
leaf.__layout.surfaceChanged || leaf.__layout.surfaceChange();
|
|
4541
|
+
}
|
|
4542
|
+
|
|
4534
4543
|
function dimType(defaultValue) {
|
|
4535
4544
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4536
4545
|
set(value) {
|
|
@@ -4596,12 +4605,12 @@ function sortType(defaultValue) {
|
|
|
4596
4605
|
}));
|
|
4597
4606
|
}
|
|
4598
4607
|
|
|
4599
|
-
function maskType(defaultValue) {
|
|
4608
|
+
function maskType(defaultValue, updateSelf) {
|
|
4600
4609
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4601
4610
|
set(value) {
|
|
4602
4611
|
if (this.__setAttr(key, value)) {
|
|
4603
4612
|
this.__layout.boxChanged || this.__layout.boxChange();
|
|
4604
|
-
this.waitParent(() => {
|
|
4613
|
+
updateSelf ? this.__updateMask() : this.waitParent(() => {
|
|
4605
4614
|
this.parent.__updateMask(value);
|
|
4606
4615
|
});
|
|
4607
4616
|
}
|
|
@@ -6253,7 +6262,8 @@ const BranchRender = {
|
|
|
6253
6262
|
if (this.__worldOpacity && hasSize(nowWorld)) {
|
|
6254
6263
|
const data = this.__;
|
|
6255
6264
|
if (data.__useDim) {
|
|
6256
|
-
if (data.
|
|
6265
|
+
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
6266
|
+
if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
|
|
6257
6267
|
}
|
|
6258
6268
|
if (data.__single && !this.isBranchLeaf) {
|
|
6259
6269
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
@@ -6277,6 +6287,7 @@ const BranchRender = {
|
|
|
6277
6287
|
child = children[i];
|
|
6278
6288
|
excludeRenderBounds$1(child, options) || (child.__hasComplex ? LeafHelper.renderComplex(child, canvas, options) : child.__render(canvas, options));
|
|
6279
6289
|
}
|
|
6290
|
+
if (this.__hasMask === 0) this.__rerenderMask(canvas, options);
|
|
6280
6291
|
}
|
|
6281
6292
|
},
|
|
6282
6293
|
__clip(canvas, options) {
|
|
@@ -6493,11 +6504,19 @@ let Leaf = class Leaf {
|
|
|
6493
6504
|
updateLayout() {
|
|
6494
6505
|
this.__layout.update();
|
|
6495
6506
|
}
|
|
6496
|
-
forceUpdate(
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6507
|
+
forceUpdate(typeOrAttrName) {
|
|
6508
|
+
let quick;
|
|
6509
|
+
if (!typeOrAttrName || typeOrAttrName === "bounds") doBoundsType(this), quick = true; else if (typeOrAttrName === "surface") doSurfaceType(this),
|
|
6510
|
+
quick = true; else if (typeOrAttrName === "stroke") doStrokeType(this), quick = true;
|
|
6511
|
+
if (quick) {
|
|
6512
|
+
const {leafer: leafer} = this;
|
|
6513
|
+
return leafer && leafer.watcher && leafer.watcher.__onAttrChange({
|
|
6514
|
+
target: this
|
|
6515
|
+
});
|
|
6516
|
+
}
|
|
6517
|
+
const value = this.__.__getInput(typeOrAttrName);
|
|
6518
|
+
this.__[typeOrAttrName] = isUndefined(value) ? null : undefined;
|
|
6519
|
+
this[typeOrAttrName] = value;
|
|
6501
6520
|
}
|
|
6502
6521
|
forceRender(_bounds, _sync) {
|
|
6503
6522
|
this.forceUpdate("surface");
|
|
@@ -6516,7 +6535,8 @@ let Leaf = class Leaf {
|
|
|
6516
6535
|
canvas.restore();
|
|
6517
6536
|
}
|
|
6518
6537
|
__updateMask(_value) {
|
|
6519
|
-
|
|
6538
|
+
const hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity);
|
|
6539
|
+
this.__hasMask = this.__.maskskip ? hasMask && 0 : hasMask;
|
|
6520
6540
|
}
|
|
6521
6541
|
__getNowWorld(options) {
|
|
6522
6542
|
if (options.matrix) {
|
|
@@ -6985,7 +7005,7 @@ class LeafLevelList {
|
|
|
6985
7005
|
}
|
|
6986
7006
|
}
|
|
6987
7007
|
|
|
6988
|
-
const version = "2.1
|
|
7008
|
+
const version = "2.2.1";
|
|
6989
7009
|
|
|
6990
7010
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6991
7011
|
|
|
@@ -7897,7 +7917,7 @@ class Picker {
|
|
|
7897
7917
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
7898
7918
|
find = list[i];
|
|
7899
7919
|
if (ignoreHittable || LeafHelper.worldHittable(find)) {
|
|
7900
|
-
this.hitChild(find, point);
|
|
7920
|
+
this.hitChild(find, find.hitThrough ? this.point : point);
|
|
7901
7921
|
if (findList.length) {
|
|
7902
7922
|
if (find.isBranchLeaf && list.some(item => item !== find && LeafHelper.hasParent(item, find))) {
|
|
7903
7923
|
findList.reset();
|
|
@@ -7910,7 +7930,7 @@ class Picker {
|
|
|
7910
7930
|
}
|
|
7911
7931
|
if (bottomList) {
|
|
7912
7932
|
for (let i = 0, len = bottomList.length; i < len; i++) {
|
|
7913
|
-
this.hitChild(bottomList[i].target, this.point, bottomList[i].proxy);
|
|
7933
|
+
this.hitChild(bottomList[i].target, this.point, undefined, bottomList[i].proxy);
|
|
7914
7934
|
if (findList.length) return findList.list[0];
|
|
7915
7935
|
}
|
|
7916
7936
|
}
|
|
@@ -7968,42 +7988,38 @@ class Picker {
|
|
|
7968
7988
|
hitBranch(branch) {
|
|
7969
7989
|
this.eachFind(branch.children, branch.__onlyHitMask);
|
|
7970
7990
|
}
|
|
7971
|
-
eachFind(children,
|
|
7991
|
+
eachFind(children, onlyHitMask) {
|
|
7972
7992
|
let child, hit, data;
|
|
7973
7993
|
const {point: point} = this, len = children.length;
|
|
7974
7994
|
for (let i = len - 1; i > -1; i--) {
|
|
7975
7995
|
child = children[i], data = child.__;
|
|
7976
|
-
if (!data.visible ||
|
|
7996
|
+
if (!data.visible || onlyHitMask && !data.mask) continue;
|
|
7977
7997
|
hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$2, point, data.hitRadius) : point);
|
|
7978
7998
|
if (child.isBranch) {
|
|
7979
7999
|
if (hit || child.__ignoreHitWorld) {
|
|
7980
8000
|
if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
|
|
7981
8001
|
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7982
8002
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7983
|
-
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
8003
|
+
if (child.isBranchLeaf) this.hitChild(child, point, onlyHitMask);
|
|
7984
8004
|
}
|
|
7985
8005
|
} else {
|
|
7986
|
-
if (hit) this.hitChild(child, point);
|
|
8006
|
+
if (hit) this.hitChild(child, point, onlyHitMask);
|
|
7987
8007
|
}
|
|
7988
8008
|
}
|
|
7989
8009
|
}
|
|
7990
|
-
hitChild(child, point, proxy) {
|
|
8010
|
+
hitChild(child, point, onlyHitMask, proxy) {
|
|
7991
8011
|
if (this.exclude && this.exclude.has(child)) return;
|
|
7992
|
-
if (child.__hitWorld(point)) {
|
|
7993
|
-
const {parent: parent} = child;
|
|
7994
|
-
if (parent && parent.__hasMask && !
|
|
7995
|
-
|
|
7996
|
-
const {children: children} = parent;
|
|
7997
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
7998
|
-
item = children[i];
|
|
7999
|
-
if (item.__.mask) findMasks.push(item);
|
|
8000
|
-
if (item === child) {
|
|
8001
|
-
if (findMasks && !findMasks.every(value => value.__hitWorld(point))) return;
|
|
8002
|
-
break;
|
|
8003
|
-
}
|
|
8004
|
-
}
|
|
8012
|
+
if (child.__hitWorld(point, onlyHitMask && child.mask === "path" ? true : undefined)) {
|
|
8013
|
+
const {parent: parent, mask: mask} = child;
|
|
8014
|
+
if (parent && parent.__hasMask && mask && !(mask === "clipping" || mask === "clipping-path")) {
|
|
8015
|
+
if (!parent.children.some(item => !item.mask && item.__hitWorld(point))) return;
|
|
8005
8016
|
}
|
|
8006
|
-
|
|
8017
|
+
const leaf = proxy || child, {hitThrough: hitThrough} = child, {findList: findList} = this;
|
|
8018
|
+
if (hitThrough) {
|
|
8019
|
+
const index = findList.list.findIndex(item => item[hitThrough] === child[hitThrough]);
|
|
8020
|
+
if (index > 0) return findList.addAt(leaf, index);
|
|
8021
|
+
}
|
|
8022
|
+
findList.add(leaf);
|
|
8007
8023
|
}
|
|
8008
8024
|
}
|
|
8009
8025
|
clear() {
|
|
@@ -8865,6 +8881,8 @@ __decorate([ dataType(false) ], UI.prototype, "editable", void 0);
|
|
|
8865
8881
|
|
|
8866
8882
|
__decorate([ hitType(true) ], UI.prototype, "hittable", void 0);
|
|
8867
8883
|
|
|
8884
|
+
__decorate([ hitType() ], UI.prototype, "hitThrough", void 0);
|
|
8885
|
+
|
|
8868
8886
|
__decorate([ hitType("path") ], UI.prototype, "hitFill", void 0);
|
|
8869
8887
|
|
|
8870
8888
|
__decorate([ strokeType("path") ], UI.prototype, "hitStroke", void 0);
|
|
@@ -9823,7 +9841,7 @@ let Text = class Text extends UI {
|
|
|
9823
9841
|
data.__font = `${italic ? "italic " : ""}${textCase === "small-caps" ? "small-caps " : ""}${fontWeight !== "normal" ? fontWeight + " " : ""}${fontSize || 12}px ${fontFamily || "caption"}`;
|
|
9824
9842
|
stintSet$1(data, "__padding", padding && MathHelper.fourNumber(padding));
|
|
9825
9843
|
stintSet$1(data, "__clipText", textOverflow !== "show" && !data.__autoSize);
|
|
9826
|
-
stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || textCase !== "none");
|
|
9844
|
+
stintSet$1(data, "__isCharMode", width || height || data.__letterSpacing || data.motionText || textCase !== "none");
|
|
9827
9845
|
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === "") ? data.placeholder : data.text, this.__);
|
|
9828
9846
|
}
|
|
9829
9847
|
__updateBoxBounds() {
|
|
@@ -9848,7 +9866,7 @@ let Text = class Text extends UI {
|
|
|
9848
9866
|
this.__updateNaturalSize();
|
|
9849
9867
|
} else super.__updateBoxBounds();
|
|
9850
9868
|
if (italic) b.width += fontSize * .16;
|
|
9851
|
-
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
|
|
9869
|
+
DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds) && !data.motionText);
|
|
9852
9870
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9853
9871
|
}
|
|
9854
9872
|
__updateRenderSpread() {
|
|
@@ -10698,6 +10716,7 @@ class Dragger {
|
|
|
10698
10716
|
}
|
|
10699
10717
|
dragEnd(data) {
|
|
10700
10718
|
if (!this.dragging && !this.moving) return;
|
|
10719
|
+
setTimeout(() => this.interaction.pointerMove(data));
|
|
10701
10720
|
if (this.checkDragEndAnimate(data)) return;
|
|
10702
10721
|
this.dragEndReal(data);
|
|
10703
10722
|
}
|
|
@@ -11451,8 +11470,10 @@ ui$5.__hit = function(inner, forceHitFill) {
|
|
|
11451
11470
|
if (!needHitFillPath && !needHitStrokePath) return false;
|
|
11452
11471
|
const radiusWidth = inner.radiusX * 2;
|
|
11453
11472
|
let hitWidth = radiusWidth;
|
|
11473
|
+
let {strokeAlign: strokeAlign} = data;
|
|
11474
|
+
if (data.motionText) hitWidth += data.fontSize / 2, strokeAlign = "center";
|
|
11454
11475
|
if (needHitStrokePath) {
|
|
11455
|
-
switch (
|
|
11476
|
+
switch (strokeAlign) {
|
|
11456
11477
|
case "inside":
|
|
11457
11478
|
hitWidth += strokeWidth * 2;
|
|
11458
11479
|
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth)) return true;
|
|
@@ -11486,9 +11507,9 @@ rect.__hitFill = box$1.__hitFill = function(inner) {
|
|
|
11486
11507
|
};
|
|
11487
11508
|
|
|
11488
11509
|
Text.prototype.__drawHitPath = function(canvas) {
|
|
11489
|
-
const {__lineHeight: __lineHeight, fontSize: fontSize, __baseLine: __baseLine, __letterSpacing: __letterSpacing, __textDrawData:
|
|
11510
|
+
const data = this.__, {__lineHeight: __lineHeight, fontSize: fontSize, __baseLine: __baseLine, __letterSpacing: __letterSpacing, __textDrawData: drawData} = data;
|
|
11490
11511
|
canvas.beginPath();
|
|
11491
|
-
if (__letterSpacing < 0) this.__drawPathByBox(canvas); else
|
|
11512
|
+
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));
|
|
11492
11513
|
};
|
|
11493
11514
|
|
|
11494
11515
|
Group.prototype.pick = function(hitPoint, options) {
|
|
@@ -11895,7 +11916,8 @@ function fillPathOrText(ui, canvas, renderOptions) {
|
|
|
11895
11916
|
ui.__.__font ? Paint.fillText(ui, canvas, renderOptions) : ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill();
|
|
11896
11917
|
}
|
|
11897
11918
|
|
|
11898
|
-
function fillText(ui, canvas,
|
|
11919
|
+
function fillText(ui, canvas, renderOptions) {
|
|
11920
|
+
if (ui.motionText) return Paint.fillMotionText(ui, canvas, renderOptions);
|
|
11899
11921
|
const data = ui.__, {rows: rows, decorationY: decorationY} = data.__textDrawData;
|
|
11900
11922
|
if (data.__isPlacehold && data.placeholderColor) canvas.fillStyle = data.placeholderColor;
|
|
11901
11923
|
let row;
|
|
@@ -12287,7 +12309,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
12287
12309
|
data.__naturalWidth = image.width / data.pixelRatio;
|
|
12288
12310
|
data.__naturalHeight = image.height / data.pixelRatio;
|
|
12289
12311
|
if (data.__autoSide) {
|
|
12290
|
-
ui.forceUpdate(
|
|
12312
|
+
ui.forceUpdate();
|
|
12291
12313
|
LeafHelper.updateBounds(ui);
|
|
12292
12314
|
ui.__layout.boundsChanged = true;
|
|
12293
12315
|
if (ui.__proxyData) {
|
|
@@ -13257,7 +13279,8 @@ const TextMode = 2;
|
|
|
13257
13279
|
|
|
13258
13280
|
function layoutChar(drawData, style, width, _height) {
|
|
13259
13281
|
const {rows: rows} = drawData;
|
|
13260
|
-
const {textAlign: textAlign, paraIndent: paraIndent
|
|
13282
|
+
const {textAlign: textAlign, paraIndent: paraIndent} = style;
|
|
13283
|
+
const useLetter = style.__letterSpacing || style.motionText;
|
|
13261
13284
|
const justifyLast = width && textAlign.includes("both");
|
|
13262
13285
|
const justify = justifyLast || width && textAlign.includes("justify");
|
|
13263
13286
|
const justifyLetter = justify && textAlign.includes("letter");
|
|
@@ -13270,8 +13293,8 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
13270
13293
|
remainingWidth = width - row.width - indentWidth;
|
|
13271
13294
|
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1); else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0;
|
|
13272
13295
|
}
|
|
13273
|
-
mode =
|
|
13274
|
-
if (row.isOverflow && !
|
|
13296
|
+
mode = useLetter || row.isOverflow || justifyLetter ? CharMode : addWordWidth ? WordMode : TextMode;
|
|
13297
|
+
if (row.isOverflow && !useLetter) row.textMode = true;
|
|
13275
13298
|
if (mode === TextMode) {
|
|
13276
13299
|
row.x += indentWidth;
|
|
13277
13300
|
toTextChar$1(row);
|
|
@@ -13472,6 +13495,7 @@ function getDrawData(content, style) {
|
|
|
13472
13495
|
let width = style.__getInput("width") || 0;
|
|
13473
13496
|
let height = style.__getInput("height") || 0;
|
|
13474
13497
|
const {__padding: padding} = style;
|
|
13498
|
+
if (style.motionText) width = height = 0;
|
|
13475
13499
|
if (padding) {
|
|
13476
13500
|
if (width) x = padding[left], width -= padding[right] + padding[left], !width && (width = .01); else if (!style.autoSizeAlign) x = padding[left];
|
|
13477
13501
|
if (height) y = padding[top], height -= padding[top] + padding[bottom], !height && (height = .01); else if (!style.autoSizeAlign) y = padding[top];
|
|
@@ -13678,7 +13702,7 @@ let Robot = class Robot extends UI {
|
|
|
13678
13702
|
const data = this.__;
|
|
13679
13703
|
const width = nowFrame.width / data.pixelRatio;
|
|
13680
13704
|
const height = nowFrame.height / data.pixelRatio;
|
|
13681
|
-
if (data.width !== width || data.height !== height) this.forceUpdate(
|
|
13705
|
+
if (data.width !== width || data.height !== height) this.forceUpdate();
|
|
13682
13706
|
data.__naturalWidth = width;
|
|
13683
13707
|
data.__naturalHeight = height;
|
|
13684
13708
|
}
|
|
@@ -15266,7 +15290,7 @@ const HighCurveHelper = {
|
|
|
15266
15290
|
},
|
|
15267
15291
|
getMotionPathData(data) {
|
|
15268
15292
|
let total = 0, distance, segments = [];
|
|
15269
|
-
let i = 0, x = 0, y = 0, toX, toY, command;
|
|
15293
|
+
let i = 0, x = 0, y = 0, toX, toY, command, closed;
|
|
15270
15294
|
const len = data.length;
|
|
15271
15295
|
while (i < len) {
|
|
15272
15296
|
command = data[i];
|
|
@@ -15291,6 +15315,7 @@ const HighCurveHelper = {
|
|
|
15291
15315
|
break;
|
|
15292
15316
|
|
|
15293
15317
|
case Z:
|
|
15318
|
+
closed = true;
|
|
15294
15319
|
i += 1;
|
|
15295
15320
|
|
|
15296
15321
|
default:
|
|
@@ -15302,13 +15327,16 @@ const HighCurveHelper = {
|
|
|
15302
15327
|
return {
|
|
15303
15328
|
total: total,
|
|
15304
15329
|
segments: segments,
|
|
15305
|
-
data: data
|
|
15330
|
+
data: data,
|
|
15331
|
+
closed: closed
|
|
15306
15332
|
};
|
|
15307
15333
|
},
|
|
15308
|
-
getDistancePoint(distanceData, motionDistance, motionPrecision) {
|
|
15309
|
-
const {segments: segments, data: data} = distanceData;
|
|
15310
|
-
motionDistance = UnitConvert.number(motionDistance,
|
|
15311
|
-
|
|
15334
|
+
getDistancePoint(distanceData, motionDistance, motionPrecision, offsetX) {
|
|
15335
|
+
const {segments: segments, data: data, total: total} = distanceData;
|
|
15336
|
+
motionDistance = UnitConvert.number(motionDistance, total);
|
|
15337
|
+
if (offsetX) motionDistance += offsetX;
|
|
15338
|
+
if (motionDistance > total) motionDistance = motionDistance % total;
|
|
15339
|
+
let nowDistance = 0, distance, to = {};
|
|
15312
15340
|
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
15313
15341
|
let x1, y1, x2, y2, t;
|
|
15314
15342
|
const len = data.length;
|
|
@@ -15320,15 +15348,20 @@ const HighCurveHelper = {
|
|
|
15320
15348
|
toX = data[i + 1];
|
|
15321
15349
|
toY = data[i + 2];
|
|
15322
15350
|
distance = segments[index];
|
|
15323
|
-
if (
|
|
15324
|
-
if (!i) x = toX, y = toY;
|
|
15325
|
-
tempFrom.x = x;
|
|
15326
|
-
tempFrom.y = y;
|
|
15351
|
+
if (nowDistance + distance >= motionDistance || !distanceData.total) {
|
|
15327
15352
|
to.x = toX;
|
|
15328
15353
|
to.y = toY;
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15354
|
+
if (i) {
|
|
15355
|
+
tempFrom.x = x;
|
|
15356
|
+
tempFrom.y = y;
|
|
15357
|
+
PointHelper.getDistancePoint(tempFrom, to, motionDistance - nowDistance, true);
|
|
15358
|
+
to.rotation = PointHelper.getAngle(tempFrom, to);
|
|
15359
|
+
return to;
|
|
15360
|
+
} else {
|
|
15361
|
+
const nextPoint = HighCurveHelper.getDistancePoint(distanceData, motionPrecision, motionPrecision, offsetX);
|
|
15362
|
+
to.rotation = nextPoint.rotation;
|
|
15363
|
+
return to;
|
|
15364
|
+
}
|
|
15332
15365
|
}
|
|
15333
15366
|
x = toX;
|
|
15334
15367
|
y = toY;
|
|
@@ -15339,9 +15372,9 @@ const HighCurveHelper = {
|
|
|
15339
15372
|
toX = data[i + 5];
|
|
15340
15373
|
toY = data[i + 6];
|
|
15341
15374
|
distance = segments[index];
|
|
15342
|
-
if (
|
|
15375
|
+
if (nowDistance + distance >= motionDistance) {
|
|
15343
15376
|
x1 = data[i + 1], y1 = data[i + 2], x2 = data[i + 3], y2 = data[i + 4];
|
|
15344
|
-
t = HighBezierHelper.getT(motionDistance -
|
|
15377
|
+
t = HighBezierHelper.getT(motionDistance - nowDistance, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
|
|
15345
15378
|
BezierHelper.getPointAndSet(t, x, y, x1, y1, x2, y2, toX, toY, to);
|
|
15346
15379
|
to.rotation = HighBezierHelper.getRotation(t, x, y, x1, y1, x2, y2, toX, toY);
|
|
15347
15380
|
return to;
|
|
@@ -15358,7 +15391,7 @@ const HighCurveHelper = {
|
|
|
15358
15391
|
distance = 0;
|
|
15359
15392
|
}
|
|
15360
15393
|
index++;
|
|
15361
|
-
|
|
15394
|
+
nowDistance += distance;
|
|
15362
15395
|
}
|
|
15363
15396
|
return to;
|
|
15364
15397
|
},
|
|
@@ -15457,26 +15490,57 @@ const {updateMatrix: updateMatrix, updateAllMatrix: updateAllMatrix} = LeafHelpe
|
|
|
15457
15490
|
|
|
15458
15491
|
const {updateBounds: updateBounds} = BranchHelper;
|
|
15459
15492
|
|
|
15493
|
+
const {toVertical: toVertical} = PointHelper;
|
|
15494
|
+
|
|
15460
15495
|
UI.addAttr("motionPath", undefined, motionPathType);
|
|
15461
15496
|
|
|
15462
15497
|
UI.addAttr("motionPrecision", 1, motionPathType);
|
|
15463
15498
|
|
|
15464
15499
|
UI.addAttr("motion", undefined, motionPathType);
|
|
15465
15500
|
|
|
15501
|
+
UI.addAttr("motionVertical", "below", motionPathType);
|
|
15502
|
+
|
|
15466
15503
|
UI.addAttr("motionRotation", true, motionPathType);
|
|
15467
15504
|
|
|
15505
|
+
ui$1.getMotionPath = function() {
|
|
15506
|
+
return getMotionPath(this);
|
|
15507
|
+
};
|
|
15508
|
+
|
|
15468
15509
|
ui$1.getMotionPathData = function() {
|
|
15469
15510
|
return getMotionPathData(getMotionPath(this));
|
|
15470
15511
|
};
|
|
15471
15512
|
|
|
15472
|
-
ui$1.
|
|
15473
|
-
|
|
15474
|
-
|
|
15513
|
+
ui$1.getMotionContentHeight = function() {
|
|
15514
|
+
return this.__layout.boxBounds.height;
|
|
15515
|
+
};
|
|
15516
|
+
|
|
15517
|
+
ui$1.getMotionPoint = function(motionDistance, motionVertical, pathElement, offsetX = 0, offsetY = 0) {
|
|
15518
|
+
if (!pathElement) pathElement = getMotionPath(this);
|
|
15519
|
+
const data = getMotionPathData(pathElement);
|
|
15475
15520
|
if (!data.total) return {};
|
|
15476
|
-
const point = HighCurveHelper.getDistancePoint(data, motionDistance,
|
|
15477
|
-
MatrixHelper.toOuterPoint(path.localTransform, point);
|
|
15521
|
+
const point = HighCurveHelper.getDistancePoint(data, motionDistance, pathElement.motionPrecision, offsetX);
|
|
15478
15522
|
const {motionRotation: motionRotation} = this;
|
|
15479
|
-
if (
|
|
15523
|
+
if (isNumber(motionRotation)) point.rotation += motionRotation;
|
|
15524
|
+
let verticalType, verticalOffset;
|
|
15525
|
+
if (isObject(motionVertical)) verticalType = motionVertical.type, verticalOffset = motionVertical.offset; else if (isNumber(motionVertical)) verticalOffset = motionVertical; else verticalType = motionVertical;
|
|
15526
|
+
if (verticalType !== "below" || offsetY) {
|
|
15527
|
+
const {rotation: rotation} = point, height = this.getMotionContentHeight();
|
|
15528
|
+
if (verticalOffset) offsetY += verticalType === "above" ? -verticalOffset : verticalOffset;
|
|
15529
|
+
switch (verticalType) {
|
|
15530
|
+
case "above":
|
|
15531
|
+
toVertical(point, rotation, -height + offsetY);
|
|
15532
|
+
break;
|
|
15533
|
+
|
|
15534
|
+
case "center":
|
|
15535
|
+
toVertical(point, rotation, -height / 2 + offsetY);
|
|
15536
|
+
break;
|
|
15537
|
+
|
|
15538
|
+
case "below":
|
|
15539
|
+
default:
|
|
15540
|
+
toVertical(point, rotation, offsetY);
|
|
15541
|
+
}
|
|
15542
|
+
}
|
|
15543
|
+
MatrixHelper.toOuterPoint(pathElement.localTransform, point);
|
|
15480
15544
|
return point;
|
|
15481
15545
|
};
|
|
15482
15546
|
|
|
@@ -15508,7 +15572,11 @@ function updateMotion(leaf) {
|
|
|
15508
15572
|
const data = getMotionPathData(leaf);
|
|
15509
15573
|
if (data.total) leaf.__.__pathForRender = HighCurveHelper.getDistancePath(data, motion, leaf.motionPrecision);
|
|
15510
15574
|
} else {
|
|
15511
|
-
leaf.
|
|
15575
|
+
if (leaf.motionText) leaf.__updateMotionText(); else {
|
|
15576
|
+
const point = leaf.getMotionPoint(motion);
|
|
15577
|
+
if (leaf.motionRotation === false) delete point.rotation;
|
|
15578
|
+
leaf.set(point);
|
|
15579
|
+
}
|
|
15512
15580
|
if (!leaf.__hasAutoLayout) {
|
|
15513
15581
|
if (leaf.isBranch) updateAllMatrix(leaf), updateBounds(leaf, leaf); else updateMatrix(leaf);
|
|
15514
15582
|
}
|
|
@@ -15530,7 +15598,8 @@ function getMotionPath(leaf) {
|
|
|
15530
15598
|
function getMotionPathData(leaf) {
|
|
15531
15599
|
const data = leaf.__;
|
|
15532
15600
|
if (data.__pathForMotion) return data.__pathForMotion;
|
|
15533
|
-
|
|
15601
|
+
const path = data.__pathForMotion = HighCurveHelper.getMotionPathData(leaf.getPath(true, true));
|
|
15602
|
+
return path;
|
|
15534
15603
|
}
|
|
15535
15604
|
|
|
15536
15605
|
const {Yes: Yes, NoAndSkip: NoAndSkip, YesAndSkip: YesAndSkip} = Answer;
|
|
@@ -15691,4 +15760,4 @@ LeafHelper.cacheId = function(t) {
|
|
|
15691
15760
|
if (leafer.cacheInnerId) leafer.app.innerIdMap[t.innerId] = t;
|
|
15692
15761
|
};
|
|
15693
15762
|
|
|
15694
|
-
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$5 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
15763
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferVideo, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TouchEvent, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, doSurfaceType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$5 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|