@meta2d/core 1.1.21 → 1.1.22
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 +73 -3
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +20 -15
- package/src/core.js.map +1 -1
- package/src/options.d.ts +1 -0
- package/src/options.js +1 -0
- package/src/options.js.map +1 -1
- package/src/pen/render.js +23 -25
- package/src/pen/render.js.map +1 -1
- package/src/point/point.d.ts +3 -0
- package/src/point/point.js.map +1 -1
package/src/options.d.ts
CHANGED
package/src/options.js
CHANGED
|
@@ -4,6 +4,7 @@ export var KeydownType;
|
|
|
4
4
|
KeydownType[KeydownType["Document"] = 0] = "Document";
|
|
5
5
|
KeydownType[KeydownType["Canvas"] = 1] = "Canvas";
|
|
6
6
|
})(KeydownType || (KeydownType = {}));
|
|
7
|
+
export const TRANSPARENT_COLOR = '#FFFFFF00';
|
|
7
8
|
export const defaultOptions = {
|
|
8
9
|
fontFamily: '"Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial',
|
|
9
10
|
fontSize: 12,
|
package/src/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../packages/core/src/options.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8CAAS,CAAA;IACT,qDAAQ,CAAA;IACR,iDAAM,CAAA;AACR,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../packages/core/src/options.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8CAAS,CAAA;IACT,qDAAQ,CAAA;IACR,iDAAM,CAAA;AACR,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED,MAAM,CAAC,MAAM,iB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AC;SACL;QACD;YACE,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,GAAG;SACP;KACF;IACD,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,CAAC;IACpB,oBAAoB,EAAE,KAAK;IAC3B,WAAW,EAAE,IAAI;IACjB,GAAG,EAAE,EAAE;IACP,aAAa,EAAE,EAAE;IACjB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,EAAE;IACb,eAAe,EAAC,CAAC,WAAW,CAAC;IAC7B,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;IAChB,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,EAAE;IAClB,aAAa,EAAC,IAAI;IAClB,aAAa,EAAC,EAAE;CACjB,CAAC"}
|
package/src/pen/render.js
CHANGED
|
@@ -10,6 +10,7 @@ import { renderFromArrow, renderToArrow } from './arrow';
|
|
|
10
10
|
import { Gradient, PenType } from '../pen';
|
|
11
11
|
import { pSBC, rgba, cubicBezierY } from '../utils';
|
|
12
12
|
import { isEmptyText } from '../utils/tool';
|
|
13
|
+
import { TRANSPARENT_COLOR } from "../options";
|
|
13
14
|
const LINE = "line";
|
|
14
15
|
const REPEAT = "repeat";
|
|
15
16
|
/**
|
|
@@ -1837,32 +1838,27 @@ export function ctxDrawLinePath(canUsePath = true, ctx, pen, store) {
|
|
|
1837
1838
|
setCtxLineAnimate(ctx, pen, store);
|
|
1838
1839
|
ctx.beginPath();
|
|
1839
1840
|
if (path instanceof Path2D) {
|
|
1840
|
-
if (pen.
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
pen
|
|
1853
|
-
getGradientAnimatePath(pen);
|
|
1854
|
-
}
|
|
1855
|
-
if (pen.calculative.gradientAnimatePath instanceof Path2D) {
|
|
1856
|
-
ctx.stroke(pen.calculative.gradientAnimatePath);
|
|
1857
|
-
}
|
|
1841
|
+
if (pen.lineAnimateType === LineAnimateType.Arrow ||
|
|
1842
|
+
pen.lineAnimateType === LineAnimateType.WaterDrop) {
|
|
1843
|
+
//箭头动画
|
|
1844
|
+
const _path = drawArrow(pen);
|
|
1845
|
+
ctx.stroke(_path);
|
|
1846
|
+
ctx.fill(_path);
|
|
1847
|
+
}
|
|
1848
|
+
else {
|
|
1849
|
+
if (pen.calculative.gradientSmooth ||
|
|
1850
|
+
pen.calculative.lineSmooth) {
|
|
1851
|
+
if (!pen.calculative.gradientAnimatePath) {
|
|
1852
|
+
pen.calculative.gradientAnimatePath =
|
|
1853
|
+
getGradientAnimatePath(pen);
|
|
1858
1854
|
}
|
|
1859
|
-
|
|
1860
|
-
ctx.stroke(
|
|
1855
|
+
if (pen.calculative.gradientAnimatePath instanceof Path2D) {
|
|
1856
|
+
ctx.stroke(pen.calculative.gradientAnimatePath);
|
|
1861
1857
|
}
|
|
1862
1858
|
}
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1859
|
+
else {
|
|
1860
|
+
ctx.stroke(path);
|
|
1861
|
+
}
|
|
1866
1862
|
}
|
|
1867
1863
|
}
|
|
1868
1864
|
else {
|
|
@@ -1888,7 +1884,9 @@ export function ctxDrawLinePath(canUsePath = true, ctx, pen, store) {
|
|
|
1888
1884
|
* 设置线条动画,ctx 的 strokeStyle lineDash 等属性更改
|
|
1889
1885
|
*/
|
|
1890
1886
|
export function setCtxLineAnimate(ctx, pen, store) {
|
|
1891
|
-
ctx.strokeStyle = pen.
|
|
1887
|
+
ctx.strokeStyle = pen.lineAnimateType === LineAnimateType.Custom ?
|
|
1888
|
+
pen.animateColor || TRANSPARENT_COLOR
|
|
1889
|
+
: (pen.animateColor || store.styles.animateColor);
|
|
1892
1890
|
if (pen.animateShadow) {
|
|
1893
1891
|
ctx.shadowBlur = pen.animateShadowBlur || pen.animateLineWidth || 6;
|
|
1894
1892
|
ctx.shadowColor =
|
|
@@ -2060,7 +2058,7 @@ function lineAnimatePenRender(tracks) {
|
|
|
2060
2058
|
height: viewHeight,
|
|
2061
2059
|
rotate: state.rotate,
|
|
2062
2060
|
};
|
|
2063
|
-
meta2d.setValue({ id: targetPen.id, ...data });
|
|
2061
|
+
meta2d.setValue({ id: targetPen.id, ...data }, { render: false, doEvent: false, history: false });
|
|
2064
2062
|
};
|
|
2065
2063
|
}
|
|
2066
2064
|
function lineAnimateIconRender(icon) {
|