ConfiguratorPrc

ConfiguratorPrc

Class that defines an interactive Configurator instance to be used in connection with the main Ripe owner to provide an interactive configuration experience inside a DOM.

Constructor

new ConfiguratorPrc(owner, element, options)

Source:
Parameters:
Name Type Description
owner Object The owner (customizer instance) for this configurator.
element Object The DOM element that is considered to be the target for the configurator, it's going to have its own inner HTML changed.
options Object The options to be used to configure the configurator instance to be created.

Methods

_buildSignature() → {String}

Builds the signature string for the current internal state allowing a single unique representation of the current frame. This signature should allow dirty control for the configurator.
Source:
Returns:
Type:
String
The unique signature for the configurator state.

_getCanvasIndex(canvas, x, y) → {Number}

Obtains the offset index (from red color) for the provided coordinates and taking into account the aspect ration of the canvas.
Source:
Parameters:
Name Type Description
canvas Canvas The canvas to be used as reference for the calculus of offset red color index.
x Number The x coordinate within the canvas to obtain index.
y Number The y coordinate within the canvas to obtain index.
Returns:
Type:
Number
The offset index using as reference the main mask of the current configurator.

cancel(options) → {Boolean}

This function is called (by the owner) whenever the current operation in the child should be canceled this way a Configurator is not updated.
Source:
Parameters:
Name Type Description
options Object Set of optional parameters to adjust the Configurator.
Returns:
Type:
Boolean
If an effective operation has been performed or if instead no cancel logic was executed.

changeFrame(frame, options)

Displays a new frame, with an animation from the starting frame proper animation should be performed. This function is meant to be executed using a recursive approach and each run represents a "tick" of the animation operation.
Source:
Parameters:
Name Type Description
frame Object The new frame to display using the extended and canonical format for the frame description (eg: side-3).
options Object Set of optional parameters to adjust the change frame, such as: - 'type' - The animation style: 'simple' (fade in), 'cross' (crossfade) or 'null' (without any style). - 'duration' - The duration of the animation in milliseconds (defaults to 'null'). - 'stepDuration' - If defined the total duration of the animation is calculated using the amount of steps times the number of steps, instead of using the 'duration' field (defaults to 'null'). - 'revolutionDuration' - If defined the step duration is calculated by dividing the revolution duration by the number of frames in the view (defaults to 'null'). - 'preventDrag' - If drag actions during an animated change of frames should be ignored (defaults to 'true'). - 'safe' - If requested then the operation is only performed in case the configurator is not in the an equivalent state (default to 'true').

deinit()

The Configurator deinitializer, to be called (by the owner) when it should stop responding to updates so that any necessary cleanup operations can be executed.
Source:

disableMasks()

Turns off (disables) the masks on selection/highlight.
Source:

enableMasks()

Turns on (enables) the masks on selection/highlight.
Source:

enterFullscreen(options)

Resizes the Configurator to the defined maximum size.
Source:
Parameters:
Name Type Description
options Object Set of optional parameters to adjust the resizing.

flushPending(tail)

Executes pending operations that were not performed so as to not conflict with the tasks already being executed. The main reason for collision is the pre-loading operation being executed (long duration operation).
Source:
Parameters:
Name Type Description
tail Boolean If only the last pending operation should be flushed, meaning that the others are discarded.

highlight(part, options)

Highlights a model's part, showing a dark mask on top of the such referred part identifying its borders.
Source:
Parameters:
Name Type Description
part String The part of the model that should be highlighted.
options Object Set of optional parameters to adjust the highlighting.

init()

The Configurator initializer, which is called whenever the Configurator is going to become active. Sets the various values for the Configurator taking into owner's default values.
Source:

leaveFullscreen(options)

Resizes the Configurator to the prior defined size.
Source:
Parameters:
Name Type Description
options Object Set of optional parameters to adjust the resizing.

lowlight(part, options)

Removes the a highlighting of a model's part, meaning that no masks are going to be presented on screen.
Source:
Parameters:
Name Type Description
part String The part to lowlight.
options Object Set of optional parameters to adjust the lowlighting.

nextFrame()

Changes the currently displayed frame in the current view to the next one according to pre-defined direction.
Source:

previousFrame()

Changes the currently displayed frame in the current view to the previous one according to pre-defined direction.
Source:

resize(size)

Resizes the configurator's DOM element to 'size' pixels. This action is performed by setting both the attributes from the HTML elements and the style.
Source:
Parameters:
Name Type Description
size Number The number of pixels to resize to.

syncFromCSR(csrConfigurator)

Syncs the PRC configurator state to a CSR configurator state.
Source:
Parameters:
Name Type Description
csrConfigurator ConfiguratorCsr The CSR configurator.

update(state, options) → {Boolean}

This function is called (by the owner) whenever its state changes so that the Configurator can update itself for the new state. This method is "protected" by unique signature validation in order to avoid extra render and frame loading operations. Operations are available to force the update operation even if the signature is the same as the one previously set.
Source:
Parameters:
Name Type Description
state Object An object containing the new state of the owner.
options Object Set of optional parameters to adjust the Configurator update, such as: - 'animate' - If it's to animate the update (defaults to 'false'). - 'duration' - The duration in milliseconds that the transition should take. - 'callback' - The callback to be called at the end of the update. - 'preload' - If it's to execute the pre-loading process. - 'force' - If the updating operation should be forced (ignores signature).
Returns:
Type:
Boolean
If an effective operation has been performed by the update operation.

updateOptions(options, update)

Updates configurator current options with the ones provided.
Source:
Parameters:
Name Type Description
options Object Set of optional parameters to adjust the Configurator, such as: - 'sensitivity' - Rotation sensitivity to the user mouse drag action. - 'duration' - The duration in milliseconds that the transition should take. - 'useMasks' - Usage of masks in the current model, necessary for the part highlighting action. - 'configAnimate' - The configurator animation style: 'simple' (fade in), 'cross' (crossfade) or 'null'.
update Boolean If an update operation should be executed after the options updated operation has been performed.