@retikz/core 0.3.0-alpha.3 → 0.3.0-alpha.5
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/README.md +41 -41
- package/dist/es/compile/anchor-cache.d.ts +5 -3
- package/dist/es/compile/anchor-cache.d.ts.map +1 -1
- package/dist/es/compile/anchor-cache.js +14 -10
- package/dist/es/compile/boundary.d.ts +19 -0
- package/dist/es/compile/boundary.d.ts.map +1 -0
- package/dist/es/compile/boundary.js +64 -0
- package/dist/es/compile/compile.d.ts +1 -1
- package/dist/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +49 -5
- package/dist/es/compile/node.d.ts +26 -8
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +103 -16
- package/dist/es/compile/path/anchor.d.ts.map +1 -1
- package/dist/es/compile/path/anchor.js +7 -6
- package/dist/es/compile/path/index.d.ts.map +1 -1
- package/dist/es/compile/path/index.js +7 -3
- package/dist/es/compile/path/relative.js +1 -1
- package/dist/es/compile/scope.d.ts.map +1 -1
- package/dist/es/compile/scope.js +2 -1
- package/dist/es/geometry/arc.d.ts +14 -0
- package/dist/es/geometry/arc.d.ts.map +1 -1
- package/dist/es/geometry/arc.js +65 -9
- package/dist/es/geometry/index.d.ts +1 -0
- package/dist/es/geometry/index.d.ts.map +1 -1
- package/dist/es/geometry/rect.d.ts +2 -2
- package/dist/es/geometry/rect.d.ts.map +1 -1
- package/dist/es/geometry/rect.js +3 -3
- package/dist/es/geometry/roundedContour.d.ts +88 -0
- package/dist/es/geometry/roundedContour.d.ts.map +1 -0
- package/dist/es/geometry/roundedContour.js +417 -0
- package/dist/es/index.d.ts +9 -5
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +11 -6
- package/dist/es/ir/animation.d.ts +218 -0
- package/dist/es/ir/animation.d.ts.map +1 -0
- package/dist/es/ir/animation.js +118 -0
- package/dist/es/ir/boundary.d.ts +25 -0
- package/dist/es/ir/boundary.d.ts.map +1 -0
- package/dist/es/ir/boundary.js +14 -0
- package/dist/es/ir/index.d.ts +3 -0
- package/dist/es/ir/index.d.ts.map +1 -1
- package/dist/es/ir/node.d.ts +219 -27
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +10 -3
- package/dist/es/ir/path/arrow.d.ts +36 -36
- package/dist/es/ir/path/path.d.ts +702 -203
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +4 -0
- package/dist/es/ir/path/step.d.ts +674 -154
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +2 -2
- package/dist/es/ir/path/target.d.ts +43 -8
- package/dist/es/ir/path/target.d.ts.map +1 -1
- package/dist/es/ir/path/target.js +4 -5
- package/dist/es/ir/scene.d.ts +156 -0
- package/dist/es/ir/scene.d.ts.map +1 -1
- package/dist/es/ir/scene.js +3 -1
- package/dist/es/ir/scope.d.ts +1671 -424
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/es/ir/scope.js +10 -2
- package/dist/es/ir/shape.d.ts +14 -0
- package/dist/es/ir/shape.d.ts.map +1 -0
- package/dist/es/ir/shape.js +9 -0
- package/dist/es/parsers/parseNodeTarget.d.ts.map +1 -1
- package/dist/es/parsers/parseNodeTarget.js +4 -2
- package/dist/es/presets/animation.d.ts +123 -0
- package/dist/es/presets/animation.d.ts.map +1 -0
- package/dist/es/presets/animation.js +272 -0
- package/dist/es/presets/index.d.ts +3 -0
- package/dist/es/presets/index.d.ts.map +1 -0
- package/dist/es/primitive/ellipse.d.ts +6 -0
- package/dist/es/primitive/ellipse.d.ts.map +1 -1
- package/dist/es/primitive/group.d.ts +6 -0
- package/dist/es/primitive/group.d.ts.map +1 -1
- package/dist/es/primitive/path.d.ts +6 -0
- package/dist/es/primitive/path.d.ts.map +1 -1
- package/dist/es/primitive/rect.d.ts +6 -0
- package/dist/es/primitive/rect.d.ts.map +1 -1
- package/dist/es/primitive/scene.d.ts +3 -0
- package/dist/es/primitive/scene.d.ts.map +1 -1
- package/dist/es/primitive/text.d.ts +6 -0
- package/dist/es/primitive/text.d.ts.map +1 -1
- package/dist/es/shapes/_contour.d.ts +19 -0
- package/dist/es/shapes/_contour.d.ts.map +1 -0
- package/dist/es/shapes/_contour.js +60 -0
- package/dist/es/shapes/_shared.d.ts +54 -0
- package/dist/es/shapes/_shared.d.ts.map +1 -1
- package/dist/es/shapes/_shared.js +68 -1
- package/dist/es/shapes/arc.d.ts +8 -0
- package/dist/es/shapes/arc.d.ts.map +1 -0
- package/dist/es/shapes/arc.js +104 -0
- package/dist/es/shapes/define.d.ts +13 -0
- package/dist/es/shapes/define.d.ts.map +1 -0
- package/dist/es/shapes/define.js +13 -0
- package/dist/es/shapes/ellipse.d.ts +5 -4
- package/dist/es/shapes/ellipse.d.ts.map +1 -1
- package/dist/es/shapes/ellipse.js +15 -7
- package/dist/es/shapes/index.d.ts +9 -6
- package/dist/es/shapes/index.d.ts.map +1 -1
- package/dist/es/shapes/index.js +10 -5
- package/dist/es/shapes/polygon.d.ts +13 -0
- package/dist/es/shapes/polygon.d.ts.map +1 -0
- package/dist/es/shapes/polygon.js +104 -0
- package/dist/es/shapes/rectangle.d.ts +7 -5
- package/dist/es/shapes/rectangle.d.ts.map +1 -1
- package/dist/es/shapes/rectangle.js +37 -8
- package/dist/es/shapes/sector.d.ts +9 -0
- package/dist/es/shapes/sector.d.ts.map +1 -0
- package/dist/es/shapes/sector.js +143 -0
- package/dist/es/shapes/star.d.ts +15 -0
- package/dist/es/shapes/star.d.ts.map +1 -0
- package/dist/es/shapes/star.js +113 -0
- package/dist/es/shapes/types.d.ts +47 -14
- package/dist/es/shapes/types.d.ts.map +1 -1
- package/dist/lib/compile/anchor-cache.cjs +14 -10
- package/dist/lib/compile/anchor-cache.d.ts +5 -3
- package/dist/lib/compile/anchor-cache.d.ts.map +1 -1
- package/dist/lib/compile/boundary.cjs +65 -0
- package/dist/lib/compile/boundary.d.ts +19 -0
- package/dist/lib/compile/boundary.d.ts.map +1 -0
- package/dist/lib/compile/compile.cjs +49 -5
- package/dist/lib/compile/compile.d.ts +1 -1
- package/dist/lib/compile/compile.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +103 -16
- package/dist/lib/compile/node.d.ts +26 -8
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/path/anchor.cjs +7 -6
- package/dist/lib/compile/path/anchor.d.ts.map +1 -1
- package/dist/lib/compile/path/index.cjs +7 -3
- package/dist/lib/compile/path/index.d.ts.map +1 -1
- package/dist/lib/compile/path/relative.cjs +1 -1
- package/dist/lib/compile/scope.cjs +2 -1
- package/dist/lib/compile/scope.d.ts.map +1 -1
- package/dist/lib/geometry/arc.cjs +66 -8
- package/dist/lib/geometry/arc.d.ts +14 -0
- package/dist/lib/geometry/arc.d.ts.map +1 -1
- package/dist/lib/geometry/index.d.ts +1 -0
- package/dist/lib/geometry/index.d.ts.map +1 -1
- package/dist/lib/geometry/rect.cjs +3 -3
- package/dist/lib/geometry/rect.d.ts +2 -2
- package/dist/lib/geometry/rect.d.ts.map +1 -1
- package/dist/lib/geometry/roundedContour.cjs +418 -0
- package/dist/lib/geometry/roundedContour.d.ts +88 -0
- package/dist/lib/geometry/roundedContour.d.ts.map +1 -0
- package/dist/lib/index.cjs +41 -7
- package/dist/lib/index.d.ts +9 -5
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/animation.cjs +127 -0
- package/dist/lib/ir/animation.d.ts +218 -0
- package/dist/lib/ir/animation.d.ts.map +1 -0
- package/dist/lib/ir/boundary.cjs +15 -0
- package/dist/lib/ir/boundary.d.ts +25 -0
- package/dist/lib/ir/boundary.d.ts.map +1 -0
- package/dist/lib/ir/index.d.ts +3 -0
- package/dist/lib/ir/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +10 -3
- package/dist/lib/ir/node.d.ts +219 -27
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/path/arrow.d.ts +36 -36
- package/dist/lib/ir/path/path.cjs +4 -0
- package/dist/lib/ir/path/path.d.ts +702 -203
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +2 -2
- package/dist/lib/ir/path/step.d.ts +674 -154
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/path/target.cjs +4 -5
- package/dist/lib/ir/path/target.d.ts +43 -8
- package/dist/lib/ir/path/target.d.ts.map +1 -1
- package/dist/lib/ir/scene.cjs +3 -1
- package/dist/lib/ir/scene.d.ts +156 -0
- package/dist/lib/ir/scene.d.ts.map +1 -1
- package/dist/lib/ir/scope.cjs +10 -2
- package/dist/lib/ir/scope.d.ts +1671 -424
- package/dist/lib/ir/scope.d.ts.map +1 -1
- package/dist/lib/ir/shape.cjs +9 -0
- package/dist/lib/ir/shape.d.ts +14 -0
- package/dist/lib/ir/shape.d.ts.map +1 -0
- package/dist/lib/parsers/parseNodeTarget.cjs +4 -2
- package/dist/lib/parsers/parseNodeTarget.d.ts.map +1 -1
- package/dist/lib/presets/animation.cjs +286 -0
- package/dist/lib/presets/animation.d.ts +123 -0
- package/dist/lib/presets/animation.d.ts.map +1 -0
- package/dist/lib/presets/index.d.ts +3 -0
- package/dist/lib/presets/index.d.ts.map +1 -0
- package/dist/lib/primitive/ellipse.d.ts +6 -0
- package/dist/lib/primitive/ellipse.d.ts.map +1 -1
- package/dist/lib/primitive/group.d.ts +6 -0
- package/dist/lib/primitive/group.d.ts.map +1 -1
- package/dist/lib/primitive/path.d.ts +6 -0
- package/dist/lib/primitive/path.d.ts.map +1 -1
- package/dist/lib/primitive/rect.d.ts +6 -0
- package/dist/lib/primitive/rect.d.ts.map +1 -1
- package/dist/lib/primitive/scene.d.ts +3 -0
- package/dist/lib/primitive/scene.d.ts.map +1 -1
- package/dist/lib/primitive/text.d.ts +6 -0
- package/dist/lib/primitive/text.d.ts.map +1 -1
- package/dist/lib/shapes/_contour.cjs +61 -0
- package/dist/lib/shapes/_contour.d.ts +19 -0
- package/dist/lib/shapes/_contour.d.ts.map +1 -0
- package/dist/lib/shapes/_shared.cjs +70 -0
- package/dist/lib/shapes/_shared.d.ts +54 -0
- package/dist/lib/shapes/_shared.d.ts.map +1 -1
- package/dist/lib/shapes/arc.cjs +104 -0
- package/dist/lib/shapes/arc.d.ts +8 -0
- package/dist/lib/shapes/arc.d.ts.map +1 -0
- package/dist/lib/shapes/define.cjs +13 -0
- package/dist/lib/shapes/define.d.ts +13 -0
- package/dist/lib/shapes/define.d.ts.map +1 -0
- package/dist/lib/shapes/ellipse.cjs +15 -7
- package/dist/lib/shapes/ellipse.d.ts +5 -4
- package/dist/lib/shapes/ellipse.d.ts.map +1 -1
- package/dist/lib/shapes/index.cjs +12 -6
- package/dist/lib/shapes/index.d.ts +9 -6
- package/dist/lib/shapes/index.d.ts.map +1 -1
- package/dist/lib/shapes/polygon.cjs +104 -0
- package/dist/lib/shapes/polygon.d.ts +13 -0
- package/dist/lib/shapes/polygon.d.ts.map +1 -0
- package/dist/lib/shapes/rectangle.cjs +37 -8
- package/dist/lib/shapes/rectangle.d.ts +7 -5
- package/dist/lib/shapes/rectangle.d.ts.map +1 -1
- package/dist/lib/shapes/sector.cjs +143 -0
- package/dist/lib/shapes/sector.d.ts +9 -0
- package/dist/lib/shapes/sector.d.ts.map +1 -0
- package/dist/lib/shapes/star.cjs +113 -0
- package/dist/lib/shapes/star.d.ts +15 -0
- package/dist/lib/shapes/star.d.ts.map +1 -0
- package/dist/lib/shapes/types.d.ts +47 -14
- package/dist/lib/shapes/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/es/shapes/circle.d.ts +0 -8
- package/dist/es/shapes/circle.d.ts.map +0 -1
- package/dist/es/shapes/circle.js +0 -34
- package/dist/es/shapes/diamond.d.ts +0 -8
- package/dist/es/shapes/diamond.d.ts.map +0 -1
- package/dist/es/shapes/diamond.js +0 -66
- package/dist/lib/shapes/circle.cjs +0 -34
- package/dist/lib/shapes/circle.d.ts +0 -8
- package/dist/lib/shapes/circle.d.ts.map +0 -1
- package/dist/lib/shapes/diamond.cjs +0 -66
- package/dist/lib/shapes/diamond.d.ts +0 -8
- package/dist/lib/shapes/diamond.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../src/shapes/circle.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,eAYpB,CAAC"}
|
package/dist/es/shapes/circle.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { circle as circle$1 } from "../geometry/circle.js";
|
|
2
|
-
import { asRectAnchor } from "./_shared.js";
|
|
3
|
-
import { ellipse } from "./ellipse.js";
|
|
4
|
-
//#region src/shapes/circle.ts
|
|
5
|
-
/** 外接框 Rect → Circle(radius = 半宽;circle 外接框宽=高) */
|
|
6
|
-
var toCircle = (r) => ({
|
|
7
|
-
x: r.x,
|
|
8
|
-
y: r.y,
|
|
9
|
-
radius: r.width / 2,
|
|
10
|
-
rotate: r.rotate
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* circle 注册项
|
|
14
|
-
* @description circumscribe = 内框对角线/2(两轴相等);几何走 circle 数学层;
|
|
15
|
-
* emit 复用 `ellipse.emit`(circle = rx=ry 的 ellipse),与旧 circle→`emitEllipseShape` 等价
|
|
16
|
-
*/
|
|
17
|
-
var circle = {
|
|
18
|
-
circumscribe: (hw, hh) => {
|
|
19
|
-
const r = Math.sqrt(hw * hw + hh * hh);
|
|
20
|
-
return {
|
|
21
|
-
halfWidth: r,
|
|
22
|
-
halfHeight: r
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
boundaryPoint: (r, toward) => circle$1.boundaryPoint(toCircle(r), toward),
|
|
26
|
-
anchor: (r, name) => {
|
|
27
|
-
const a = asRectAnchor(name);
|
|
28
|
-
return a ? circle$1.anchor(toCircle(r), a) : void 0;
|
|
29
|
-
},
|
|
30
|
-
edgePoint: (r, side, t) => circle$1.edgePoint(toCircle(r), side, t),
|
|
31
|
-
emit: (r, style, round) => ellipse.emit(r, style, round)
|
|
32
|
-
};
|
|
33
|
-
//#endregion
|
|
34
|
-
export { circle };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ShapeDefinition } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* diamond 注册项
|
|
4
|
-
* @description circumscribe = 内框 ×2(内框 4 顶点落在菱形 4 边上);几何由外接框半轴派生;
|
|
5
|
-
* emit 在**轴对齐空间**取 4 顶点出 PathPrim(rotate 由外层 group 施加),与旧 `emitDiamondShape(unrotated(...))` 等价
|
|
6
|
-
*/
|
|
7
|
-
export declare const diamond: ShapeDefinition;
|
|
8
|
-
//# sourceMappingURL=diamond.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diamond.d.ts","sourceRoot":"","sources":["../../../src/shapes/diamond.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAW/C;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,eAgCrB,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { asRectAnchor } from "./_shared.js";
|
|
2
|
-
import { diamond as diamond$1 } from "../geometry/diamond.js";
|
|
3
|
-
//#region src/shapes/diamond.ts
|
|
4
|
-
/** 外接框 Rect → Diamond(halfA/halfB = 半宽/半高;顶点在 ±halfA / ±halfB) */
|
|
5
|
-
var toDiamond = (r) => ({
|
|
6
|
-
x: r.x,
|
|
7
|
-
y: r.y,
|
|
8
|
-
halfA: r.width / 2,
|
|
9
|
-
halfB: r.height / 2,
|
|
10
|
-
rotate: r.rotate
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* diamond 注册项
|
|
14
|
-
* @description circumscribe = 内框 ×2(内框 4 顶点落在菱形 4 边上);几何由外接框半轴派生;
|
|
15
|
-
* emit 在**轴对齐空间**取 4 顶点出 PathPrim(rotate 由外层 group 施加),与旧 `emitDiamondShape(unrotated(...))` 等价
|
|
16
|
-
*/
|
|
17
|
-
var diamond = {
|
|
18
|
-
circumscribe: (hw, hh) => ({
|
|
19
|
-
halfWidth: hw * 2,
|
|
20
|
-
halfHeight: hh * 2
|
|
21
|
-
}),
|
|
22
|
-
boundaryPoint: (r, toward) => diamond$1.boundaryPoint(toDiamond(r), toward),
|
|
23
|
-
anchor: (r, name) => {
|
|
24
|
-
const a = asRectAnchor(name);
|
|
25
|
-
return a ? diamond$1.anchor(toDiamond(r), a) : void 0;
|
|
26
|
-
},
|
|
27
|
-
edgePoint: (r, side, t) => diamond$1.edgePoint(toDiamond(r), side, t),
|
|
28
|
-
*emit(r, style, round) {
|
|
29
|
-
const d = toDiamond(r);
|
|
30
|
-
const e = diamond$1.anchor(d, "east");
|
|
31
|
-
const n = diamond$1.anchor(d, "north");
|
|
32
|
-
const w = diamond$1.anchor(d, "west");
|
|
33
|
-
const s = diamond$1.anchor(d, "south");
|
|
34
|
-
yield {
|
|
35
|
-
type: "path",
|
|
36
|
-
commands: [
|
|
37
|
-
{
|
|
38
|
-
kind: "move",
|
|
39
|
-
to: [round(e[0]), round(e[1])]
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
kind: "line",
|
|
43
|
-
to: [round(n[0]), round(n[1])]
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
kind: "line",
|
|
47
|
-
to: [round(w[0]), round(w[1])]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
kind: "line",
|
|
51
|
-
to: [round(s[0]), round(s[1])]
|
|
52
|
-
},
|
|
53
|
-
{ kind: "close" }
|
|
54
|
-
],
|
|
55
|
-
fill: style.fill ?? "transparent",
|
|
56
|
-
fillOpacity: style.fillOpacity,
|
|
57
|
-
stroke: style.stroke ?? "currentColor",
|
|
58
|
-
strokeOpacity: style.strokeOpacity,
|
|
59
|
-
strokeWidth: style.strokeWidth ?? 1,
|
|
60
|
-
dashPattern: style.dashPattern,
|
|
61
|
-
opacity: style.opacity
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
//#endregion
|
|
66
|
-
export { diamond };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const require_circle = require("../geometry/circle.cjs");
|
|
2
|
-
const require__shared = require("./_shared.cjs");
|
|
3
|
-
const require_ellipse = require("./ellipse.cjs");
|
|
4
|
-
//#region src/shapes/circle.ts
|
|
5
|
-
/** 外接框 Rect → Circle(radius = 半宽;circle 外接框宽=高) */
|
|
6
|
-
var toCircle = (r) => ({
|
|
7
|
-
x: r.x,
|
|
8
|
-
y: r.y,
|
|
9
|
-
radius: r.width / 2,
|
|
10
|
-
rotate: r.rotate
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* circle 注册项
|
|
14
|
-
* @description circumscribe = 内框对角线/2(两轴相等);几何走 circle 数学层;
|
|
15
|
-
* emit 复用 `ellipse.emit`(circle = rx=ry 的 ellipse),与旧 circle→`emitEllipseShape` 等价
|
|
16
|
-
*/
|
|
17
|
-
var circle = {
|
|
18
|
-
circumscribe: (hw, hh) => {
|
|
19
|
-
const r = Math.sqrt(hw * hw + hh * hh);
|
|
20
|
-
return {
|
|
21
|
-
halfWidth: r,
|
|
22
|
-
halfHeight: r
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
boundaryPoint: (r, toward) => require_circle.circle.boundaryPoint(toCircle(r), toward),
|
|
26
|
-
anchor: (r, name) => {
|
|
27
|
-
const a = require__shared.asRectAnchor(name);
|
|
28
|
-
return a ? require_circle.circle.anchor(toCircle(r), a) : void 0;
|
|
29
|
-
},
|
|
30
|
-
edgePoint: (r, side, t) => require_circle.circle.edgePoint(toCircle(r), side, t),
|
|
31
|
-
emit: (r, style, round) => require_ellipse.ellipse.emit(r, style, round)
|
|
32
|
-
};
|
|
33
|
-
//#endregion
|
|
34
|
-
exports.circle = circle;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ShapeDefinition } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* circle 注册项
|
|
4
|
-
* @description circumscribe = 内框对角线/2(两轴相等);几何走 circle 数学层;
|
|
5
|
-
* emit 复用 `ellipse.emit`(circle = rx=ry 的 ellipse),与旧 circle→`emitEllipseShape` 等价
|
|
6
|
-
*/
|
|
7
|
-
export declare const circle: ShapeDefinition;
|
|
8
|
-
//# sourceMappingURL=circle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../src/shapes/circle.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,eAYpB,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
const require__shared = require("./_shared.cjs");
|
|
2
|
-
const require_diamond = require("../geometry/diamond.cjs");
|
|
3
|
-
//#region src/shapes/diamond.ts
|
|
4
|
-
/** 外接框 Rect → Diamond(halfA/halfB = 半宽/半高;顶点在 ±halfA / ±halfB) */
|
|
5
|
-
var toDiamond = (r) => ({
|
|
6
|
-
x: r.x,
|
|
7
|
-
y: r.y,
|
|
8
|
-
halfA: r.width / 2,
|
|
9
|
-
halfB: r.height / 2,
|
|
10
|
-
rotate: r.rotate
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* diamond 注册项
|
|
14
|
-
* @description circumscribe = 内框 ×2(内框 4 顶点落在菱形 4 边上);几何由外接框半轴派生;
|
|
15
|
-
* emit 在**轴对齐空间**取 4 顶点出 PathPrim(rotate 由外层 group 施加),与旧 `emitDiamondShape(unrotated(...))` 等价
|
|
16
|
-
*/
|
|
17
|
-
var diamond = {
|
|
18
|
-
circumscribe: (hw, hh) => ({
|
|
19
|
-
halfWidth: hw * 2,
|
|
20
|
-
halfHeight: hh * 2
|
|
21
|
-
}),
|
|
22
|
-
boundaryPoint: (r, toward) => require_diamond.diamond.boundaryPoint(toDiamond(r), toward),
|
|
23
|
-
anchor: (r, name) => {
|
|
24
|
-
const a = require__shared.asRectAnchor(name);
|
|
25
|
-
return a ? require_diamond.diamond.anchor(toDiamond(r), a) : void 0;
|
|
26
|
-
},
|
|
27
|
-
edgePoint: (r, side, t) => require_diamond.diamond.edgePoint(toDiamond(r), side, t),
|
|
28
|
-
*emit(r, style, round) {
|
|
29
|
-
const d = toDiamond(r);
|
|
30
|
-
const e = require_diamond.diamond.anchor(d, "east");
|
|
31
|
-
const n = require_diamond.diamond.anchor(d, "north");
|
|
32
|
-
const w = require_diamond.diamond.anchor(d, "west");
|
|
33
|
-
const s = require_diamond.diamond.anchor(d, "south");
|
|
34
|
-
yield {
|
|
35
|
-
type: "path",
|
|
36
|
-
commands: [
|
|
37
|
-
{
|
|
38
|
-
kind: "move",
|
|
39
|
-
to: [round(e[0]), round(e[1])]
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
kind: "line",
|
|
43
|
-
to: [round(n[0]), round(n[1])]
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
kind: "line",
|
|
47
|
-
to: [round(w[0]), round(w[1])]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
kind: "line",
|
|
51
|
-
to: [round(s[0]), round(s[1])]
|
|
52
|
-
},
|
|
53
|
-
{ kind: "close" }
|
|
54
|
-
],
|
|
55
|
-
fill: style.fill ?? "transparent",
|
|
56
|
-
fillOpacity: style.fillOpacity,
|
|
57
|
-
stroke: style.stroke ?? "currentColor",
|
|
58
|
-
strokeOpacity: style.strokeOpacity,
|
|
59
|
-
strokeWidth: style.strokeWidth ?? 1,
|
|
60
|
-
dashPattern: style.dashPattern,
|
|
61
|
-
opacity: style.opacity
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
//#endregion
|
|
66
|
-
exports.diamond = diamond;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ShapeDefinition } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* diamond 注册项
|
|
4
|
-
* @description circumscribe = 内框 ×2(内框 4 顶点落在菱形 4 边上);几何由外接框半轴派生;
|
|
5
|
-
* emit 在**轴对齐空间**取 4 顶点出 PathPrim(rotate 由外层 group 施加),与旧 `emitDiamondShape(unrotated(...))` 等价
|
|
6
|
-
*/
|
|
7
|
-
export declare const diamond: ShapeDefinition;
|
|
8
|
-
//# sourceMappingURL=diamond.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diamond.d.ts","sourceRoot":"","sources":["../../../src/shapes/diamond.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAW/C;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,eAgCrB,CAAC"}
|