diff --git a/lib/common/character/mod.dart b/lib/common/character/mod.dart index e3404f8..00e095e 100644 --- a/lib/common/character/mod.dart +++ b/lib/common/character/mod.dart @@ -5,6 +5,7 @@ import 'primary/a_anchor.dart'; import 'primary/b_anchor.dart'; import 'primary/c_anchor.dart'; import 'primary/d_anchor.dart'; +import 'primary/top.dart'; import 'primary/utils.dart'; import 'secondary/core.dart'; import 'secondary/extension.dart'; @@ -14,7 +15,7 @@ import 'secondary/utils.dart'; sealed class Character { const Character(); - (String, double) getSvg(double baseX, double height, String fillColor); + (String, double) getSvg(double baseX, double baseY, String fillColor); } class Secondary extends Character { @@ -70,12 +71,12 @@ class Secondary extends Character { } @override - (String, double) getSvg(double baseX, double height, String fillColor) { + (String, double) getSvg(double baseX, double baseY, String fillColor) { final Secondary(:core, :start, :end, :startAnchor, :endAnchor) = this; final secondaryBoundary = getSecondaryBoundary(this); final coreX = baseX - secondaryBoundary.$1; - final coreY = height / 2; + final coreY = baseY; final extStartX = coreX + startAnchor.coord.x; final extStartY = coreY + startAnchor.coord.y; final extEndX = coreX + endAnchor.coord.x + 0; @@ -107,6 +108,7 @@ class Secondary extends Character { class Primary extends Character { final Specification specification; + final Context context; // Properties for A Anchor final Essence essence; final Affiliation affiliation; @@ -124,6 +126,7 @@ class Primary extends Character { const Primary({ required this.specification, + required this.context, required this.essence, required this.affiliation, required this.perspective, @@ -137,26 +140,30 @@ class Primary extends Character { }); @override - (String, double) getSvg(double baseX, double height, String fillColor) { + (String, double) getSvg(double baseX, double baseY, String fillColor) { final (left, right) = getPrimaryBoundary(this); final width = right - left; + final topName = context.name; final aAnchorName = '${essence.name}_${affiliation.name}'; final bAnchorName = '${perspective.name}_${extension.name}'; final cAnchorName = '${separability.name}_${similarity.name}'; final dAnchorName = '${function.name}_${version.name}_${plexity.name}_${stem.name}'; final specificationX = baseX - left; - final specificationY = height / 2; + final specificationY = baseY; + final topX = specificationX + specification.centerX; + final topY = specificationY; final aAnchorX = specificationX + specification.centerX; - final aAnchorY = specificationY + 0; + final aAnchorY = specificationY; final bAnchorX = specificationX + specification.bAnchor.x; final bAnchorY = specificationY + specification.bAnchor.y; final cAnchorX = specificationX + specification.centerX; - final cAnchorY = specificationY + 0; + final cAnchorY = specificationY; final dAnchorX = specificationX + specification.dAnchor.x; final dAnchorY = specificationY + specification.dAnchor.y; return ( ''' + diff --git a/lib/common/character/primary/top.dart b/lib/common/character/primary/top.dart new file mode 100644 index 0000000..218866b --- /dev/null +++ b/lib/common/character/primary/top.dart @@ -0,0 +1,20 @@ +enum Context { + /// The Existential Context + exs, + + /// The Functional Context + fnc, + + /// The Representational Context + rps, + + /// The Amalgamative Context + amg; +} + +const Map topData = { + "exs": "", + "fnc": "M -7.50 -40.00 L 0.00 -32.50 7.50 -40.00 0.00 -47.50 -7.50 -40.00 Z", + "rps": "M 10.00 -40.00 L 20.00 -50.00 -10.00 -50.00 -20.00 -40.00 10.00 -40.00 Z", + "amg": "M -13.75 -51.25 L 6.25 -31.25 13.75 -38.75 -6.25 -58.75 -13.75 -51.25 Z" +}; diff --git a/lib/common/ithkuil_svg.dart b/lib/common/ithkuil_svg.dart index 8e2329e..7461c8e 100644 --- a/lib/common/ithkuil_svg.dart +++ b/lib/common/ithkuil_svg.dart @@ -6,6 +6,7 @@ import 'character/primary/a_anchor.dart'; import 'character/primary/b_anchor.dart'; import 'character/primary/c_anchor.dart'; import 'character/primary/d_anchor.dart'; +import 'character/primary/top.dart'; import 'utils.dart'; class IthkuilSvg extends StatelessWidget { @@ -19,7 +20,8 @@ class IthkuilSvg extends StatelessWidget { // core letter height = 2 unit height = 70 // full letter height = 4 unit height = 140 // full letter with padding height = 6 unit height = 210 - const double baseHeight = 140; + const double unitHeight = 35; + const double verticalPadding = unitHeight; const double horizontalPadding = 20; const double horizontalGap = 10; final String fillColor = colorToHex(Theme.of(context).textTheme.titleLarge!.color!); @@ -27,7 +29,11 @@ class IthkuilSvg extends StatelessWidget { final usedSpecifications = characters.whereType().map((s) => s.specification).toSet().toList(); - + final List<(String, String)> usedPrimaryTops = characters + .whereType() + .map((s) => (s.context.name, topData[s.context.name]!)) + .toSet() + .toList(); final List<(String, String)> usedAAnchors = characters .whereType() .map( @@ -99,11 +105,13 @@ class IthkuilSvg extends StatelessWidget { for (int i = 0; i < characters.length; i++) { final character = characters[i]; if (character is Primary) { - final (svgString, svgWidth) = character.getSvg(leftCoord, baseHeight, fillColor); + final (svgString, svgWidth) = + character.getSvg(leftCoord, verticalPadding + unitHeight * 2, fillColor); charImages.add(svgString); leftCoord += svgWidth + horizontalGap; } else if (character is Secondary) { - final (svgString, svgWidth) = character.getSvg(leftCoord, baseHeight, fillColor); + final (svgString, svgWidth) = + character.getSvg(leftCoord, verticalPadding + unitHeight * 2, fillColor); charImages.add(svgString); leftCoord += svgWidth + horizontalGap; } @@ -111,11 +119,14 @@ class IthkuilSvg extends StatelessWidget { final baseWidth = leftCoord - horizontalGap + horizontalPadding; return SvgPicture.string( - ''' + ''' ${usedSpecifications.map( (e) => '', ).join('')} + ${usedPrimaryTops.map( + (e) => '', + ).join('')} ${usedAAnchors.map( (e) => '', ).join('')} @@ -136,7 +147,7 @@ class IthkuilSvg extends StatelessWidget { (e) => '', ).join('')} - + ${charImages.join('\n')} ''', width: MediaQuery.of(context).size.width - 32, diff --git a/lib/pages/construct.dart b/lib/pages/construct.dart index d1948e7..d7baeac 100644 --- a/lib/pages/construct.dart +++ b/lib/pages/construct.dart @@ -1,3 +1,4 @@ +import 'package:enthrirch/common/character/primary/top.dart'; import 'package:flutter/material.dart'; import 'package:enthrirch/common/character/mod.dart'; @@ -26,8 +27,9 @@ class _ConstructPageState extends State { [ const Primary( specification: Specification.cte, - essence: Essence.nrm, - affiliation: Affiliation.coa, + context: Context.fnc, + essence: Essence.rpv, + affiliation: Affiliation.var$, perspective: Perspective.m, extension: Extension.prx, similarity: Similarity.d, @@ -35,7 +37,7 @@ class _ConstructPageState extends State { function: Function$.sta, version: Version.prc, plexity: Plexity.um, - stem: Stem.s2, + stem: Stem.s1, ), Secondary.from("zčw")!, Secondary.from("zxr")!,