Contains code to manage the UI (header interactions, buttons, infoText update, etc.).
Members
(static, constant) isAnimationActive
(inner) headerVisible :boolean
Type:
- boolean
Methods
(static) enableMandelbrotMode()
Implemented in a way it's not needed to be called at the first render. Everything should be pre-initialized
for Mandelbrot mode.
(static) getCurrentPaletteId() → {string|null}
Returns the current palette ID from the fractal renderer
Returns:
- Type
- string | null
(static) getUserPresets() → {Array.<PRESET>}
Gets user presets from localStorage for current fractal mode
Returns:
- Type
- Array.<PRESET>
(static) initUI(fractalRenderer)
Initializes the UI and registers UI event handlers
Parameters:
| Name | Type | Description |
|---|---|---|
fractalRenderer |
(static) resetActivePresetIndex()
This needs to happen on any fractal change
(static) resetAppState()
Resets buttons, active presets and URL
(static) showEditCoordsDialog()
Shows the edit coordinates dialog
(static) showSaveViewDialog()
Shows the save view dialog
(static) startJuliaDive(dives, index) → {Promise.<void>}
Starts the Julia dive infinite animation
Parameters:
| Name | Type | Description |
|---|---|---|
dives |
Array.<DIVE> | |
index |
number | Index of the dive |
Returns:
- Type
- Promise.<void>
(static) switchFractalMode(mode, presetopt)
Switches among fractal modes
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
mode |
FRACTAL_TYPE | ||
preset |
PRESET | MANDELBROT_PRESET | JULIA_PRESET |
<optional> |
If present, it's set as the default state through travelToPreset |
(static) switchFractalTypeWithPersistence(targetType) → {Promise.<void>}
Switches among fractal modes but keeps the c/pan settings so the fractals match each other.
Parameters:
| Name | Type | Description |
|---|---|---|
targetType |
FRACTAL_TYPE |
Returns:
- Type
- Promise.<void>
(static) toggleCenterLines()
Toggles x/y axes
(static) toggleDebugMode()
Inits debug bar with various information permanently shown on the screen
(static) toggleDemo() → {Promise.<void>}
Turns demo on/off and/or stops current animation
Returns:
- Type
- Promise.<void>
(static) toggleHeader(show)
Shows/hides/toggles header.
Parameters:
| Name | Type | Description |
|---|---|---|
show |
boolean | null | Show header? If null, then toggles current state |
(static) travelToPreset(presets, index) → {Promise.<void>}
Travels to preset at given index
Parameters:
| Name | Type | Description |
|---|---|---|
presets |
Array.<PRESET> | |
index |
number | Preset array index |
Returns:
- Type
- Promise.<void>
(static) updateColorTheme(paletteopt)
Updates color scheme
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
palette |
PALETTE |
<optional> |
defaults to the fractal palette |
(static) updateInfo(force)
Updates the bottom info bar.
Throttled to avoid layout thrashing during animations (max ~10 updates/sec).
Parameters:
| Name | Type | Description |
|---|---|---|
force |
boolean | If true, ensures an update is scheduled even if throttled (won't be dropped) |
(static) updatePaletteCycleButtonState()
Updates the palette cycle button state to match the actual cycling state
(async, inner) applyEditedCoords()
Applies the edited coordinates and animates travel
(inner) closeDivesDropdown()
Closes the dives dropdown menu
(inner) closePaletteDropdown()
Closes the palette dropdown menu
(inner) closePresetsDropdown()
Closes the presets dropdown menu
(inner) deleteUserPreset(presetId)
Deletes a user preset by its id
Parameters:
| Name | Type | Description |
|---|---|---|
presetId |
string |
(inner) exitAnimationMode()
Enables controls, resets demo button
(inner) getUserPresetsKey() → {string}
Gets the localStorage key for user presets based on current fractal mode
Returns:
- Type
- string
(inner) hideEditCoordsDialog()
Hides the edit coordinates dialog
(inner) hideSaveViewDialog()
Hides the save view dialog
(inner) initAnimationMode()
Disables controls, activates demo button
(inner) initCommonButtonEvents()
Inits behavior common for all buttons
(inner) initEditCoordsDialog()
Initializes the edit coordinates dialog events
(inner) initSaveViewDialog()
Initializes the save view dialog events
(inner) parseEditCoordsInput() → {Object}
Parses user input from either JSON or individual fields
Tries JSON first, then falls back to field-by-field parsing
Returns:
Parsed coordinates object or {error: string}
- Type
- Object
(inner) saveCurrentViewAsPreset(name)
Saves the current view as a user preset
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The name for the preset |
(inner) saveUserPresets(presets)
Saves user presets to localStorage for current fractal mode
Parameters:
| Name | Type | Description |
|---|---|---|
presets |
Array.<PRESET> |
(async, inner) startJuliaDemo()
Starts the Julia demo
(async, inner) startMandelbrotDemo()
Starts the Mandelbrot demo
(inner) toggleDivesDropdown()
Toggles the dives dropdown menu
(inner) togglePaletteDropdown()
Toggles the palette dropdown menu
(inner) togglePresetsDropdown()
Toggles the presets dropdown menu
(inner) validateEditCoordsInput() → {boolean}
Validates current input and updates UI accordingly
Returns:
True if valid
- Type
- boolean