Skip to content

Commit

Permalink
Use local Location theme images
Browse files Browse the repository at this point in the history
  • Loading branch information
dydrmr committed Nov 19, 2024
1 parent 6a656f7 commit 6a2703b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/Location.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { degrees, radians, modulo, square } from '../HelperFunctions.js';
import * as THREE from 'three';
import DB from './app/Database.js';
import Settings from './app/Preferences.js';

export default class Location {
constructor(name, type, parentBody, parentStar, coordinates, themeColor = null, wikiLink = null) {
Expand All @@ -14,9 +15,8 @@ export default class Location {
this.TERRAIN_SET = 0;

this.THEME_COLOR = themeColor ?? this.PARENT.THEME_COLOR;
//this.THEME_IMAGE = (themeImage === '' || themeImage === null) ? this.PARENT.THEME_IMAGE : themeImage;
this.THEME_IMAGE = this.PARENT.THEME_IMAGE;
this.WIKI_LINK = (wikiLink === '' || wikiLink === null) ? null : wikiLink;
this.THEME_IMAGE = null;

// CALCULATED PROPERTIES
this.#calculateLatitudeAndLongitude();
Expand Down
5 changes: 5 additions & 0 deletions classes/app/UserInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ class UserInterface {
}

#update_setThemeImage() {
if (Settings.activeLocation.THEME_IMAGE === null) {
const imgPath = `img/themes/${Settings.activeLocation.NAME.toLowerCase()}.webp`;
const exists = Settings.imageExists(imgPath);
Settings.activeLocation.THEME_IMAGE = exists ? imgPath : Settings.activeLocation.PARENT.THEME_IMAGE;
};
const url = `url('${Settings.activeLocation.THEME_IMAGE}')`;
if (UI.bgElement.style.backgroundImage !== url) UI.bgElement.style.backgroundImage = url;
}
Expand Down

0 comments on commit 6a2703b

Please sign in to comment.