From cde78dd068858affb76f62311c17c0c86f8afa85 Mon Sep 17 00:00:00 2001 From: ClaytonTDM Date: Mon, 14 Apr 2025 21:37:58 -0400 Subject: [PATCH] add docs Signed-off-by: ClaytonTDM --- .markdownlint.json | 4 +++ Docs/TextTransform.md | 70 +++++++++++++++++++++++++++++++++++++++++++ README.md | 3 +- 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 .markdownlint.json create mode 100644 Docs/TextTransform.md diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..0a15252 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,4 @@ +{ + "MD024": false, + "MD051": false +} \ No newline at end of file diff --git a/Docs/TextTransform.md b/Docs/TextTransform.md new file mode 100644 index 0000000..fb12ae7 --- /dev/null +++ b/Docs/TextTransform.md @@ -0,0 +1,70 @@ +# TextTransform + +Transform text in a way that makes it easy to manipulate individual characters. + +## Methods + +### `TransformText` + +`TransformText(labelToTransform: TextLabel)` → `Frame` + +Transforms a `TextLabel` into a `Frame` for easy manipulation of letters. +Letter index is stored in `LayoutOrder` for each `Frame`. +Stores necessary style information as attributes on the returned `Frame`. + +#### Parameters + +| Name | Type | Required | +| ---------------- | ----------- | -------- | +| labelToTransform | `TextLabel` | Yes | + +#### Returns + +| Type | +| ------- | +| `Frame` | + +--- + +### `CreateFrameFromLabel` + +`CreateFrameFromLabel(labelTemplate: TextLabel)` → `Frame` + +Creates a `Frame` from a `TextLabel` for easy manipulation of letters. +Intended to be used with [`InsertLetter`](#InsertLetter). + +#### Parameters + +| Name | Type | Required | +| ------------- | ----------- | -------- | +| labelTemplate | `TextLabel` | Yes | + +#### Returns + +| Type | +| ------- | +| `Frame` | + +--- + +### `InsertLetter` + +`InsertLetter(frame: Frame, letter: string, index: number)` → `Frame` + +Inserts a new letter (`Frame`) into the `listFrame` at the specified index. +Adjusts `LayoutOrder` of subsequent letters. +Returns the newly created letter `Frame` or `nil` if attributes are missing. + +#### Parameters + +| Name | Type | Required | +| --------- | -------- | -------- | +| listFrame | `Frame` | Yes | +| letter | `string` | Yes | +| index | `number` | Yes | + +#### Returns + +| Type | +| -------- | +| `Frame?` | diff --git a/README.md b/README.md index 78b3136..b5265c2 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ General purpose modules for Roblox development. These modules are designed to be ## Modules -- TextTransform - - Transforms a `TextLabel` into a `Frame` with many children for easy manipulation of letters. Letter index is stored in `LayoutOrder` for each `Frame`. +- [TextTransform](Docs/TextTransform.md): Transform text in a way that makes it easy to manipulate individual characters. --- -- 2.51.2