feat(settings): add a new option to disable invert filter

This commit is contained in:
Haoyu Xu
2021-08-03 16:51:33 -04:00
parent 665ca6c617
commit 6d60993d27
3 changed files with 11 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ var Settings = (function () {
this.opacity = parseFloat(getComputedStyle(this.logoEl).opacity) * 100;
this.el = document.createElement("div");
this.spinePlayerLoaded = false;
this.invertFilter = true;
}
Settings.prototype.validateConfig = function () {
if (typeof this.logoEl === "string")
@@ -46,6 +47,7 @@ var Settings = (function () {
Settings.prototype.setLogo = function (url, removeInvert) {
this.logoEl.src = url;
this.resizeLogo(this.ratio);
if (!this.invertFilter) return;
if (removeInvert) {
this.logoEl.style.filter = "invert(0)";
} else {
@@ -63,6 +65,10 @@ var Settings = (function () {
var opacity = parseFloat(value);
this.logoEl.style.opacity = opacity / 100;
};
Settings.prototype.disableInvertFilter = function (el) {
this.logoEl.style.filter = "invert(0)";
this.invertFilter = false;
};
Settings.prototype.positionReset = function () {
if (this.spinePlayerLoaded)
this.spinePlayer.updateViewport(window.operatorSettings.viewport)