Class: Decorations
core/Decorations.Decorations
Constructors
constructor
• new Decorations(graph
)
Parameters
Name | Type |
---|---|
graph | Graph |
Defined in
core/Decorations.ts:45
Properties
decorationChangeListeners
• Private
decorationChangeListeners: DecorationChangeListener
[] = []
Defined in
core/Decorations.ts:41
decorationMap
• decorationMap: DecorationMap
Defined in
core/Decorations.ts:38
decorations
• decorations: NamedDecoration
[]
Defined in
core/Decorations.ts:37
disposables
• Private
disposables: Disposable
[] = []
Defined in
core/Decorations.ts:42
extensionContext
• Private
extensionContext: ExtensionContext
Defined in
core/Decorations.ts:43
hatStyleMap
• Private
hatStyleMap: Record
<HatStyleName
, HatStyle
>
Defined in
core/Decorations.ts:39
hatStyleNames
• hatStyleNames: HatStyleName
[]
Defined in
core/Decorations.ts:40
Methods
constructColoredSvgDataUri
▸ Private
constructColoredSvgDataUri(originalSvg
, color
): Uri
Parameters
Name | Type |
---|---|
originalSvg | string |
color | string |
Returns
Uri
Defined in
core/Decorations.ts:241
constructDecorations
▸ Private
constructDecorations(fontMeasurements
): void
Parameters
Name | Type |
---|---|
fontMeasurements | FontMeasurements |
Returns
void
Defined in
core/Decorations.ts:95
constructHatStyleMap
▸ Private
constructHatStyleMap(): void
Returns
void
Defined in
core/Decorations.ts:177
destroyDecorations
▸ Private
destroyDecorations(): void
Returns
void
Defined in
core/Decorations.ts:83
dispose
▸ dispose(): void
Returns
void
Defined in
core/Decorations.ts:344
getViewBoxDimensions
▸ Private
getViewBoxDimensions(rawSvg
): Object
Parameters
Name | Type |
---|---|
rawSvg | string |
Returns
Object
Name | Type |
---|---|
originalViewBoxHeight | number |
originalViewBoxWidth | number |
Defined in
core/Decorations.ts:328
init
▸ init(extensionContext
): Promise
<void
>
Parameters
Name | Type |
---|---|
extensionContext | ExtensionContext |
Returns
Promise
<void
>
Defined in
core/Decorations.ts:62
processSvg
▸ Private
processSvg(fontMeasurements
, shape
, scaleFactor
, hatVerticalOffsetEm
): Object
Creates an SVG from the hat SVG that pads, offsets and scales it to end up in the right size / place relative to the character it will be placed over. This image may or may not be helpful.
Parameters
Name | Type | Description |
---|---|---|
fontMeasurements | FontMeasurements | Info about the user's font |
shape | "default" | "ex" | "fox" | "wing" | "hole" | "frame" | "curve" | "eye" | "play" | "bolt" | "crosshairs" | The hat shape to process |
scaleFactor | number | How much to scale the hat |
hatVerticalOffsetEm | number | How far off top of characters should hats be |
Returns
Object
An object with the new SVG and its measurements
Name | Type |
---|---|
svg | string |
svgHeightPx | number |
svgWidthPx | number |
Defined in
core/Decorations.ts:269
recomputeDecorationStyles
▸ Private
recomputeDecorationStyles(): Promise
<void
>
Returns
Promise
<void
>
Defined in
core/Decorations.ts:89
registerDecorationChangeListener
▸ registerDecorationChangeListener(listener
): () => void
Register to be notified when decoration styles are updated, for example if the user enables a new hat style
Parameters
Name | Type | Description |
---|---|---|
listener | DecorationChangeListener | A function to be called when decoration styles are updated |
Returns
fn
A function that can be called to unsubscribe from notifications
▸ (): void
Returns
void
Defined in
core/Decorations.ts:75