@meta2d/core 1.0.97 → 1.0.99
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/package.json +1 -1
- package/src/canvas/canvas.js +2 -3
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +23 -10
- package/src/core.js.map +1 -1
- package/src/pen/model.d.ts +1 -1
- package/src/pen/render.js +16 -6
- package/src/pen/render.js.map +1 -1
package/src/pen/model.d.ts
CHANGED
|
@@ -222,7 +222,7 @@ export interface Pen extends Rect {
|
|
|
222
222
|
lineAnimateDash?: number[] | string;
|
|
223
223
|
lineAnimateDashOffset?: number;
|
|
224
224
|
lineAnimateElementCount?: number;
|
|
225
|
-
lineAnimateType?: LineAnimateType;
|
|
225
|
+
lineAnimateType?: LineAnimateType | LineAnimateType[];
|
|
226
226
|
lineAnimateTargetType?: lineAnimateTargetType;
|
|
227
227
|
lineAnimateElementWidth?: number;
|
|
228
228
|
lineAnimateElementHeight?: number;
|
package/src/pen/render.js
CHANGED
|
@@ -637,13 +637,13 @@ function linearGradient(ctx, worldRect, fromColor, toColor, angle) {
|
|
|
637
637
|
* @param pen 画笔
|
|
638
638
|
*/
|
|
639
639
|
function getImagePosition(pen) {
|
|
640
|
-
const { worldIconRect: rect, iconWidth, iconHeight, imgNaturalWidth, imgNaturalHeight, } = pen.calculative;
|
|
640
|
+
const { worldIconRect: rect, iconWidth, iconHeight, imgNaturalWidth, imgNaturalHeight, worldRect } = pen.calculative;
|
|
641
641
|
if (!rect) {
|
|
642
642
|
return {
|
|
643
|
-
x:
|
|
644
|
-
y:
|
|
645
|
-
width: imgNaturalWidth || pen.calculative.img.naturalWidth,
|
|
646
|
-
height: imgNaturalHeight || pen.calculative.img.naturalHeight,
|
|
643
|
+
x: worldRect.x,
|
|
644
|
+
y: worldRect.y,
|
|
645
|
+
width: worldRect.width || imgNaturalWidth || pen.calculative.img.naturalWidth,
|
|
646
|
+
height: worldRect.width || imgNaturalHeight || pen.calculative.img.naturalHeight,
|
|
647
647
|
};
|
|
648
648
|
}
|
|
649
649
|
;
|
|
@@ -1783,8 +1783,18 @@ export function setCtxLineAnimate(ctx, pen, store) {
|
|
|
1783
1783
|
}
|
|
1784
1784
|
pen.calculative.animateLineWidth &&
|
|
1785
1785
|
(ctx.lineWidth = pen.calculative.animateLineWidth * store.data.scale);
|
|
1786
|
+
if (Array.isArray(pen.lineAnimateType)) {
|
|
1787
|
+
pen.lineAnimateType.forEach(type => {
|
|
1788
|
+
renderLineAnimate(pen, store, type, ctx);
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
else {
|
|
1792
|
+
renderLineAnimate(pen, store, pen.lineAnimateType, ctx);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
function renderLineAnimate(pen, store, type, ctx) {
|
|
1786
1796
|
let len = 0;
|
|
1787
|
-
switch (
|
|
1797
|
+
switch (type) {
|
|
1788
1798
|
case LineAnimateType.Beads:
|
|
1789
1799
|
if (pen.animateReverse) {
|
|
1790
1800
|
ctx.lineDashOffset = pen.calculative.animatePos;
|