Skip to content

Commit

Permalink
refactor: move default map name to config
Browse files Browse the repository at this point in the history
  • Loading branch information
istudyatuni committed May 13, 2022
1 parent edcf1a1 commit 47f8fa9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const default_map = 'chroma'
4 changes: 3 additions & 1 deletion src/stores/settings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { sessionStore } from 'svelte-storages'

import { default_map } from 'src/config'

/**
* - `lx`: left x of complex plane
* - `rx`: right x of complex plane
Expand All @@ -12,6 +14,6 @@ export const draw = sessionStore('draw-settings', {
})

export const settings = sessionStore('settings', {
palette: 'default',
palette: default_map,
show_settings: true,
})
4 changes: 2 additions & 2 deletions src/utils/maps.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// palettes is from Fractint
// mirror: https://github.com/jhol/fractint/blob/master/maps

const DEFAULT_MAP = 'default'
import { default_map } from 'src/config'

export const MAPS = {
altern: { name: 'altern' },
Expand Down Expand Up @@ -34,7 +34,7 @@ export const MAPS = {

export async function load_palette(name) {
if (MAPS[name] === undefined) {
name = DEFAULT_MAP
name = default_map
}
const response = await fetch(
import.meta.env.BASE_URL + 'maps/' + name + '.map'
Expand Down

0 comments on commit 47f8fa9

Please sign in to comment.