Skip to content

Commit

Permalink
Fix the background color not being restored from URL (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdayevKP authored and paulsmirnov committed Jul 30, 2018
1 parent b03f4b0 commit a386ab6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions demo/scripts/ui/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ function unarray(x) {
}

function Menu(/** Node */ container, /** Miew */ viewer) {
var themeRE = /\s*theme-\w+\b/g;
var theme = settings.now.theme;
// Add proper DOM elements
_.forEach($.parseHTML(menuHtml), (element) => container.parentNode.appendChild(element));

container.className = container.className.replace(themeRE, '') + ' theme-' + theme;
// Save some objects for future reference
this._viewer = viewer;
this._menuId = '#miew-menu';
Expand Down
5 changes: 3 additions & 2 deletions src/Miew.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ Miew.prototype.init = function() {
self._onDblClick(event);
});

this._onThemeChanged();

if (!settings._changed['bg.color']) {
settings.set('bg.color', settings.now.themes[settings.now.theme]);
}
} catch (error) {
// FIXME: THREE.WebGLRenderer throws error AND catches it, so we receive different one. Some random crash.
if (error.name === 'TypeError' && error.message === 'Cannot read property \'getExtension\' of null') {
Expand Down

0 comments on commit a386ab6

Please sign in to comment.