-
Notifications
You must be signed in to change notification settings - Fork 30
Updated docs for Resize API and TextNode class #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,6 +379,110 @@ removal. No-op if node is already an orphan. | |
|
||
--- | ||
|
||
### rescaleProportionalToHeight() | ||
|
||
• **rescaleProportionalToHeight**(`height`): `void` | ||
|
||
<InlineAlert slots="text" variant="warning"/> | ||
|
||
**IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`. | ||
|
||
Changes the height to the given value and the width to the given height multiplied by the aspect ratio. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changes the height to the given value and the width to the given height multiplied by the aspect ratio. Is that the user-input value? |
||
|
||
#### Parameters | ||
|
||
• **height**: `number` | ||
|
||
#### Returns | ||
|
||
`void` | ||
|
||
#### Inherited from | ||
|
||
[`FillableNode`](FillableNode.md).[`rescaleProportionalToHeight`](FillableNode.md#rescaleproportionaltoheight) | ||
|
||
--- | ||
|
||
### rescaleProportionalToWidth() | ||
|
||
• **rescaleProportionalToWidth**(`width`): `void` | ||
|
||
<InlineAlert slots="text" variant="warning"/> | ||
|
||
**IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`. | ||
|
||
Changes the width to the given value and the height to the given width multiplied by the aspect ratio. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question as above |
||
|
||
#### Parameters | ||
|
||
• **width**: `number` | ||
|
||
#### Returns | ||
|
||
`void` | ||
|
||
#### Inherited from | ||
|
||
[`FillableNode`](FillableNode.md).[`rescaleProportionalToWidth`](FillableNode.md#rescaleproportionaltowidth) | ||
|
||
--- | ||
|
||
### resizeToCover() | ||
|
||
• **resizeToCover**(`width`, `height`): `void` | ||
|
||
<InlineAlert slots="text" variant="warning"/> | ||
|
||
**IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`. | ||
|
||
Resizes the node to cover a box with the given dimensions. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does given mean? User-input? |
||
|
||
If the node doesn't have a fixed aspect ratio then this will resize the node to the given width and height. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the node doesn't have a fixed aspect ratio, the resizeToCover() API will resize it to the given width and height. |
||
|
||
#### Parameters | ||
|
||
• **width**: `number` | ||
|
||
• **height**: `number` | ||
|
||
#### Returns | ||
|
||
`void` | ||
|
||
#### Inherited from | ||
|
||
[`FillableNode`](FillableNode.md).[`resizeToCover`](FillableNode.md#resizetocover) | ||
|
||
--- | ||
|
||
### resizeToFitWithin() | ||
|
||
• **resizeToFitWithin**(`width`, `height`): `void` | ||
|
||
<InlineAlert slots="text" variant="warning"/> | ||
|
||
**IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`. | ||
|
||
Resizes the node to fit within a box with the given dimensions. | ||
|
||
If the node doesn't have a fixed aspect ratio then this will resize the node to the given width and height. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the node has no fixed aspect ratio, the resizeToFitWithin() API will resize it to the given width and height. |
||
|
||
#### Parameters | ||
|
||
• **width**: `number` | ||
|
||
• **height**: `number` | ||
|
||
#### Returns | ||
|
||
`void` | ||
|
||
#### Inherited from | ||
|
||
[`FillableNode`](FillableNode.md).[`resizeToFitWithin`](FillableNode.md#resizetofitwithin) | ||
|
||
--- | ||
|
||
### setPositionInParent() | ||
|
||
• **setPositionInParent**(`parentPoint`, `localRegistrationPoint`): `void` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,15 +138,38 @@ Transform values default to 0. | |
|
||
### createText() | ||
|
||
• **createText**(): [`TextNode`](TextNode.md) | ||
#### createText() | ||
|
||
#### Returns | ||
• **createText**(): [`StandaloneTextNode`](StandaloneTextNode.md) | ||
|
||
##### Returns | ||
|
||
[`TextNode`](TextNode.md) | ||
[`StandaloneTextNode`](StandaloneTextNode.md) | ||
|
||
a text node with default styles. The text content is initially empty, so the text node will be | ||
invisible until its `fullContent` property's `text` is set. Creates point text, so the node's width will automatically | ||
adjust to accommodate whatever text is set. | ||
invisible until its `fullContent` property's `text` is set. Creates auto-width text, so the node's width will | ||
automatically adjust to accommodate whatever text is set. | ||
|
||
##### Deprecated | ||
|
||
- Initial text content is always expected so please use `createText(textContent: string): StandaloneTextNode`. | ||
|
||
#### createText(textContent) | ||
|
||
• **createText**(`textContent`): [`StandaloneTextNode`](StandaloneTextNode.md) | ||
|
||
##### Parameters | ||
|
||
• **textContent**: `string` | ||
|
||
the initial string to show. | ||
|
||
##### Returns | ||
|
||
[`StandaloneTextNode`](StandaloneTextNode.md) | ||
|
||
a text node with default styles. Creates auto-width text, so the node's width will automatically adjust | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A text node with default styles. Creates auto-width text, so the node's width will automatically adjust |
||
to accommodate the given text content. | ||
|
||
Note: the registration point of this text node is not guaranteed to be at the top-left of the bounding box of its | ||
insertion parent. Recommend using `setPositionInParent` over `translation` to set the position. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does given mean? Is that user input? If yes, please change all instances of given to user-input |
Uh oh!
There was an error while loading. Please reload this page.