Skip to content

Commit

Permalink
Check width of a/c anchors for primary
Browse files Browse the repository at this point in the history
  • Loading branch information
lomirus committed Jul 29, 2023
1 parent 4e178c9 commit 30a29ac
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/common/character/primary/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import 'dart:math';
import 'package:enthrirch/common/character/mod.dart';
import 'package:enthrirch/common/utils.dart';

import 'a_anchor.dart';
import 'b_anchor.dart';
import 'c_anchor.dart';
import 'd_anchor.dart';

(double, double) getAnchorBoundary(String path) {
Expand All @@ -24,21 +26,29 @@ import 'd_anchor.dart';
}

(double, double) getPrimaryBoundary(Primary primary) {
final aAnchorPath = aAnchorData[primary.essence.name]![primary.affiliation.name]!;
final bAnchorPath = bAnchorData[primary.perspective.name]![primary.extension.name]!;
final cAnchorPath = cAnchorData[primary.similarity.name]![primary.separability.name]!;
final dAnchorPath = dAnchorData[primary.function.name]![primary.version.name]![
primary.plexity.name]![primary.stem.name]!;
final (coreLeft, coreRight) = getCoreBoundary(primary.specification.path);
final (aAnchorLeft, aAnchorRight) = getAnchorBoundary(aAnchorPath);
final (bAnchorLeft, bAnchorRight) = getAnchorBoundary(bAnchorPath);
final (cAnchorLeft, cAnchorRight) = getAnchorBoundary(cAnchorPath);
final (dAnchorLeft, dAnchorRight) = getAnchorBoundary(dAnchorPath);

final left = [
coreLeft,
primary.specification.aAnchor.x + aAnchorLeft,
primary.specification.bAnchor.x + bAnchorLeft,
primary.specification.cAnchor.x + cAnchorLeft,
primary.specification.dAnchor.x + dAnchorLeft,
].reduce(min);
final right = [
coreRight,
primary.specification.aAnchor.x + aAnchorRight,
primary.specification.bAnchor.x + bAnchorRight,
primary.specification.cAnchor.x + cAnchorRight,
primary.specification.dAnchor.x + dAnchorRight,
].reduce(max);

Expand Down

0 comments on commit 30a29ac

Please sign in to comment.