From b2c073fa7cf68c37cad0e9f14460ccb87278ce7d Mon Sep 17 00:00:00 2001 From: Atul Varma Date: Tue, 16 Feb 2021 16:43:47 -0500 Subject: [PATCH] Factor out AttachmentTransform component. --- lib/pages/creature-page.tsx | 38 +++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/lib/pages/creature-page.tsx b/lib/pages/creature-page.tsx index e5b8917..1c5c1dd 100644 --- a/lib/pages/creature-page.tsx +++ b/lib/pages/creature-page.tsx @@ -9,6 +9,7 @@ import { import { AttachmentPointType, PointWithNormal } from "../specs"; import { getAttachmentTransforms } from "../attach"; import { scalePointXY } from "../point"; +import { Point } from "../../vendor/bezier-js"; const SYMBOL_MAP = new Map( SvgVocabulary.map((symbol) => [symbol.name, symbol]) @@ -124,19 +125,36 @@ const CreatureSymbol: React.FC = (props) => { }); return ( - - - {ourSymbol} - - + + {ourSymbol} + ); }; +type AttachmentTransformProps = { + transformOrigin: Point; + translate: Point; + scale: Point; + rotate: number; + children: JSX.Element; +}; + +const AttachmentTransform: React.FC = (props) => ( + + + {props.children} + + +); + function createCreatureSymbol( name: string ): React.FC> {