Class: ImageThreadColorsExtension
An extension for images which allows the retrieval and assignment of ordered thread colors when the decoration technology for an item's parent panel is embroidery.
Hierarchy
BaseExtension
↳
ImageThreadColorsExtension
Implements
ItemPreviewModelDecorator
<ImageItem
>
Constructors
constructor
• new ImageThreadColorsExtension(designState
, executeCommand
, cimDocStore
, layoutStore
, authProvider
)
Parameters
Name | Type |
---|---|
designState | DesignState |
executeCommand | ExecuteCommand |
cimDocStore | CimDocStore |
layoutStore | LayoutStore |
authProvider | AuthProvider |
Overrides
BaseExtension.constructor
Defined in
Properties
authProvider
• Private
authProvider: AuthProvider
Defined in
cimDocStore
• Private
cimDocStore: CimDocStore
Defined in
designState
• Protected
designState: ItemState
<ImageItem
>
Overrides
BaseExtension.designState
Defined in
disposePrintUrlReaction
• Private
disposePrintUrlReaction: IReactionDisposer
Defined in
executeCommand
• Private
executeCommand: ExecuteCommand
Defined in
initialThreadColors
• Optional
initialThreadColors: OrderedThreadColor
[]
The initial thread colors for the image before any overrides were set
Will be undefined until the initial thread color fetch has succeeded
Defined in
layoutStore
• Private
layoutStore: LayoutStore
Defined in
pendingColorRead
• Private
pendingColorRead: CancellablePromise
<void
>
Defined in
status
• status: ImageThreadColorsStatus
= ImageThreadColorsStatus.Loading
The current status of fetching the image's thread colors
Defined in
temporaryThreadColors
• Optional
temporaryThreadColors: OrderedThreadColor
[]
A local store of an item's thread colors that can be used and updated without having to update the CimDoc on every change of an individual thread color.
Defined in
inject
▪ Static
inject: string
[]
Overrides
BaseExtension.inject
Defined in
Accessors
currentThreadColors
• get
currentThreadColors(): undefined
| OrderedThreadColor
[]
Returns the image's current thread colors, either from the threads temporarily stored on this extension, the ones persisted with the image's colorOverrides property, or the thread ordinals derived from the base embroidery image
Returns
undefined
| OrderedThreadColor
[]
Defined in
enabled
• get
enabled(): boolean
Boolean representing if the extension is able to load thread data (the item has a printUrl)
Returns
boolean
Defined in
getPreviewUrl
• get
getPreviewUrl(): (size?
: number
) => string
Given a size in pixels, this function returns a url to preview the embroidered item (inclusive of any temporary thread colors) constrained to that size.
Returns
fn
▸ (size?
): string
Given a size in pixels, this function returns a url to preview the embroidered item (inclusive of any temporary thread colors) constrained to that size.
Parameters
Name | Type | Description |
---|---|---|
size? | number | The maximum size the resulting previewUrl will be generated at. Limits by the larger dimension (e.g. a 400x200 image constrained to 200 will be 200x100). Defaults to 1000 |
Returns
string
Defined in
isLoading
• get
isLoading(): boolean
Boolean representing if the extension is currently loading thread data or not.
Returns
boolean
Defined in
Methods
[decorateItemPreviewModel]
▸ [decorateItemPreviewModel](previewModel
): void
Parameters
Name | Type |
---|---|
previewModel | ImageItem |
Returns
void
Implementation of
ItemPreviewModelDecorator.__@decorateItemPreviewModel@41120
Defined in
commitThreadColors
▸ commitThreadColors(): void
Commits any existing temporaryThreadColors
to the connected item's model on the CimDoc using a command (this creates a step in history and clears the temporaryThreadColors
)
Remarks
This is a no-op if the item's thread colors would be unchanged from their current state
Returns
void
Defined in
dispose
▸ dispose(): void
Returns
void
Overrides
BaseExtension.dispose
Defined in
extractThreadColors
▸ Private
extractThreadColors(): Generator
<Promise
<Headers
> | Promise
<OrderedColor
[]>, void
, Object
>
Returns
Generator
<Promise
<Headers
> | Promise
<OrderedColor
[]>, void
, Object
>
Defined in
setTemporaryThreadColors
▸ setTemporaryThreadColors(threadColors?
): void
Sets a temporary set of thread colors that will be shown in this extension's previewUrl but not committed to the CimDoc (to do that see: commitThreadColors). Any sub-selection of the linked item's color ordinals can be provided. E.G:
setTemporaryThreadColors([
{ ordinal: 2, color: 'thread(mcp0015)' }
]);
will only replace the thread ordered "2" in the stored temporary threads
Remarks
When providing only a partial set of threadColors
(as in the above example) the partial set will be merged internally with the initialThreadColors
to ensure a full set is always present on the item's model, as that is required for accurate embroidery previews
Parameters
Name | Type |
---|---|
threadColors? | OrderedThreadColor [] |
Returns
void
Defined in
supports
▸ Static
supports(state
): boolean
Only supports images on embroidery panels
Parameters
Name | Type |
---|---|
state | DesignState |
Returns
boolean
Overrides
BaseExtension.supports