Skip to content

Commit

Permalink
Add anchor data for specification
Browse files Browse the repository at this point in the history
  • Loading branch information
lomirus committed Jul 23, 2023
1 parent 85380f7 commit d21496e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/common/character/mod.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Primary extends Character {
final width = right - left;
return (
'''
<use href="#${specification.abbr}" x="$baseX" y="${height / 2}" fill="$fillColor" />
<use href="#${specification.name}" x="$baseX" y="${height / 2}" fill="$fillColor" />
''',
width,
);
Expand Down
35 changes: 25 additions & 10 deletions lib/common/character/primary/specification.dart
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
import 'package:enthrirch/common/utils.dart';

enum Specification {
basic(
/// Basic Specification
bsc(
path: "M 7.50 -35.00 L 0.00 -27.50 57.50 35.00 65.00 27.50 7.50 -35.00 Z",
abbr: "BSC",
bAnchor: Coord(0, -27.50),
dAnchor: Coord(65.00, 27.50),
),
contential(

/// Contential Specification
cte(
path:
"M 32.50 5.00 L 40.00 -2.50 7.50 -35.00 0.00 -27.50 32.50 5.00 M 15.00 -5.00 L 7.50 2.50 40.00 35.00 47.50 27.50 15.00 -5.00 Z",
abbr: "CTE",
bAnchor: Coord(0, -27.50),
dAnchor: Coord(47.50, 27.50),
),
constitutive(

/// Constitutive Specification
csv(
path:
"M 28.00 8.10 L 35.45 0.60 62.50 35.00 70.00 27.50 42.20 -8.50 34.45 -0.70 7.50 -35.00 0.00 -27.50 28.00 8.10 Z",
abbr: "CSV",
bAnchor: Coord(0, -27.50),
dAnchor: Coord(70.00, 27.50),
),
objective(

/// Objective Specification
obj(
path:
"M 47.50 35.00 L 55.00 27.50 28.10 0.60 35.55 -6.95 7.50 -35.00 0.00 -27.50 26.90 -0.60 19.40 6.90 47.50 35.00 Z",
abbr: "OBJ",
bAnchor: Coord(0, -27.50),
dAnchor: Coord(55.00, 27.50),
);

final String path;
final String abbr;
final Coord bAnchor;
final Coord dAnchor;

const Specification({
required this.path,
required this.abbr,
required this.bAnchor,
required this.dAnchor,
});
}
2 changes: 1 addition & 1 deletion lib/common/ithkuil_svg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class IthkuilSvg extends StatelessWidget {
'''<svg width="$baseWidth" height="$baseHeight">
<defs>
${usedSpecifications.map(
(e) => '<path stroke="none" id="${e.abbr}" d="${e.path}" />',
(e) => '<path stroke="none" id="${e.name}" d="${e.path}" />',
).join('')}
${usedCores.map(
(e) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/construct.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class _ConstructPageState extends State<ConstructPage> {
IthkuilSvg(
[
const Primary(
specification: Specification.constitutive,
specification: Specification.obj,
),
Secondary.from("zvw")!,
Secondary.from("zxr")!,
Expand Down

0 comments on commit d21496e

Please sign in to comment.