Fix welcome screen preference setting and optimize dot removal logic in gradient generator

This commit is contained in:
mr. M
2025-02-21 20:18:27 +01:00
parent 81fed8a1d8
commit bb7c400855
6 changed files with 17 additions and 6 deletions

2
l10n

Submodule l10n updated: aafe87eed6...78574896ff

View File

@@ -133,7 +133,7 @@
_checkForWelcomePage() {
if (!Services.prefs.getBoolPref('zen.welcome-screen.seen', false)) {
//Services.prefs.setBoolPref('zen.welcome-screen.seen', true);
Services.prefs.setBoolPref('zen.welcome-screen.seen', true);
Services.scriptloader.loadSubScript('chrome://browser/content/zen-components/ZenWelcome.mjs', window);
}
},

View File

@@ -678,6 +678,7 @@ var gZenVerticalTabsManager = {
if (newName) {
gBrowser._setTabLabel(this._tabEdited, newName);
this._tabEdited.setAttribute('zen-has-static-label', 'true');
gZenUIManager.showToast('zen-tabs-renamed');
} else {
gBrowser.setTabTitle(this._tabEdited);
}

View File

@@ -96,7 +96,7 @@
<box data-algo="float" data-num-dots="1" data-position="116,167" style="background: #be9ac9;"></box>
<box data-algo="float" data-num-dots="1" data-position="122,110" style="background: #cdcea1;"></box>
<box data-algo="float" data-num-dots="1" data-position="181,83" style="background: #6ac593;"></box>
<box data-algo="complementary" data-num-dots="3" data-position="82,112" style="background: linear-gradient(135deg, #1e90ff, #cfb179);"></box>
<box data-algo="complementary" data-num-dots="2" data-position="82,112" style="background: linear-gradient(135deg, #1e90ff, #cfb179);"></box>
</hbox>
</hbox>
<hbox class="zen-theme-picker-gradient">

View File

@@ -110,6 +110,11 @@
dot.element.remove();
}
this.dots = [];
} else if (numDots < this.dots.length) {
for (let i = numDots; i < this.dots.length; i++) {
this.dots[i].element.remove();
}
this.dots = this.dots.slice(0, numDots);
}
// Generate new gradient from the single color given
const [x, y] = rawPosition.split(',').map((pos) => parseInt(pos));
@@ -449,11 +454,10 @@
const centerPosition = { x: rect.width / 2, y: rect.height / 2 };
const harmonyAngles = getColorHarmonyType(dots.length + (action === 'add' ? 1 : action === 'remove' ? -1 : 0), this.dots);
if (!harmonyAngles || harmonyAngles.angles.length === 0) return dots;
this.useAlgo = harmonyAngles.type;
if (!harmonyAngles || harmonyAngles.angles.length === 0) return dots;
let primaryDot = dots.find((dot) => dot.ID === 0);
if (!primaryDot) return [];
@@ -916,7 +920,11 @@
this.isDarkMode ? 0.2 : -0.5,
`rgb(${dominantColor[0]}, ${dominantColor[1]}, ${dominantColor[2]})`
);
return result?.match(/\d+/g).map(Number);
const color = result?.match(/\d+/g).map(Number);
if (!color || color.length !== 3) {
return this.getNativeAccentColor();
}
return color;
}
async onWorkspaceChange(workspace, skipUpdate = false, theme = null) {
@@ -1043,6 +1051,7 @@
if (dominantColor) {
browser.document.documentElement.style.setProperty(
'--zen-primary-color',
typeof dominantColor === 'string' ? dominantColor :
`rgb(${dominantColor[0]}, ${dominantColor[1]}, ${dominantColor[2]})`
);
}

View File

@@ -399,6 +399,7 @@
await ZenPinnedTabsStorage.savePin(pin);
this.resetPinChangedUrl(tab);
await this._refreshPinnedTabs();
gZenUIManager.showToast('zen-pinned-tab-replaced');
}
async _setPinnedAttributes(tab) {