Skip to main content

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

Constructors

constructor

new ImageThreadColorsExtension(designState, executeCommand, cimDocStore, layoutStore, authProvider)

Parameters

NameType
designStateDesignState
executeCommandExecuteCommand
cimDocStoreCimDocStore
layoutStoreLayoutStore
authProviderAuthProvider

Overrides

BaseExtension.constructor

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:74

Properties

authProvider

Private authProvider: AuthProvider

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:79


cimDocStore

Private cimDocStore: CimDocStore

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:77


designState

Protected designState: ItemState<ImageItem>

Overrides

BaseExtension.designState

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:40


disposePrintUrlReaction

Private disposePrintUrlReaction: IReactionDisposer

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:59


executeCommand

Private executeCommand: ExecuteCommand

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:76


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

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:50


layoutStore

Private layoutStore: LayoutStore

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:78


pendingColorRead

Private pendingColorRead: CancellablePromise<void>

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:57


status

status: ImageThreadColorsStatus = ImageThreadColorsStatus.Loading

The current status of fetching the image's thread colors

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:43


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

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:55


inject

Static inject: string[]

Overrides

BaseExtension.inject

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:61

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

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:230


enabled

get enabled(): boolean

Boolean representing if the extension is able to load thread data (the item has a printUrl)

Returns

boolean

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:221


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
NameTypeDescription
size?numberThe 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

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:243


isLoading

get isLoading(): boolean

Boolean representing if the extension is currently loading thread data or not.

Returns

boolean

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:213

Methods

[decorateItemPreviewModel]

[decorateItemPreviewModel](previewModel): void

Parameters

NameType
previewModelImageItem

Returns

void

Implementation of

ItemPreviewModelDecorator.__@decorateItemPreviewModel@41120

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:105


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

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:188


dispose

dispose(): void

Returns

void

Overrides

BaseExtension.dispose

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:270


extractThreadColors

Private extractThreadColors(): Generator<Promise<Headers> | Promise<OrderedColor[]>, void, Object>

Returns

Generator<Promise<Headers> | Promise<OrderedColor[]>, void, Object>

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:112


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

NameType
threadColors?OrderedThreadColor[]

Returns

void

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:150


supports

Static supports(state): boolean

Only supports images on embroidery panels

Parameters

NameType
stateDesignState

Returns

boolean

Overrides

BaseExtension.supports

Defined in

packages/design-engine-react-components/src/features/embroidery/extensions/ImageThreadColorsExtension.ts:66