Format the scope opacity changes

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-14 15:31:25 -08:00
1 parent 8379a0ffd3
commit 1dcc025832
5 files changed
+24 -7

No files matched your search

+4 -1
View File
@@ -549,7 +549,10 @@ export function getScopeMaskFeather() {
* @returns {void}
*/
export function setScopeMaskOpacity(ratio) {
_maskOpacity = Math.max(0, Math.min(1, Number.isFinite(Number(ratio)) ? Number(ratio) : 1));
_maskOpacity = Math.max(
0,
Math.min(1, Number.isFinite(Number(ratio)) ? Number(ratio) : 1),
);
if (_canvas) _canvas.style.opacity = String(_maskOpacity);
}
+6 -1
View File
@@ -781,7 +781,12 @@ export function normalizeShareViewState(input = {}) {
state.scopeFeatherPct = finite(source.scopeFeatherPct)
? clampScopeFeatherPct(Number(source.scopeFeatherPct))
: d.scopeFeatherPct;
state.scopeOpacityPct = intOr(source.scopeOpacityPct, d.scopeOpacityPct, 0, 100);
state.scopeOpacityPct = intOr(
source.scopeOpacityPct,
d.scopeOpacityPct,
0,
100,
);
state.scopeTerminusPct = intOr(
source.scopeTerminusPct,
null,
+10 -3
View File
@@ -289,7 +289,10 @@ export class ShareLinkManager {
// mirrors live state for the link this session generates, so it must match
// the mask, not the archive.)
scopeFeatherPct: clampScopeFeatherPct(parseOr(params.get('scf'), 35)),
scopeOpacityPct: Math.max(0, Math.min(100, Math.round(parseOr(params.get('sco'), 100)))),
scopeOpacityPct: Math.max(
0,
Math.min(100, Math.round(parseOr(params.get('sco'), 100))),
),
// Absent (or non-numeric) `sce` = adaptive (null), the default behavior;
// a value pins the terminus opacity percent, clamped into the SUPPORTED
// 94..100 band. `sce=0` used to survive as a sub-94 terminus — a hole in
@@ -631,7 +634,10 @@ export class ShareLinkManager {
this._scopeFeatherPct = clampScopeFeatherPct(extras.scopeFeatherPct);
}
if (typeof extras.scopeOpacityPct === 'number') {
this._scopeOpacityPct = Math.max(0, Math.min(100, Math.round(extras.scopeOpacityPct)));
this._scopeOpacityPct = Math.max(
0,
Math.min(100, Math.round(extras.scopeOpacityPct)),
);
}
if (extras.scopeTerminusPct === null) this._scopeTerminusPct = null;
else if (typeof extras.scopeTerminusPct === 'number') {
@@ -748,7 +754,8 @@ export class ShareLinkManager {
params.set('cr', this._celestialRingEnabled ? '1' : '0');
params.set('sc', this._scopeEnabled ? '1' : '0');
params.set('scf', Math.round(this._scopeFeatherPct).toString());
if (this._scopeOpacityPct !== 100) params.set('sco', String(this._scopeOpacityPct));
if (this._scopeOpacityPct !== 100)
params.set('sco', String(this._scopeOpacityPct));
// Only written when pinned — an absent `sce` IS the adaptive default, so a
// shared link never freezes the ramp for the recipient by accident. The
// same 94..100 clamp applies on the way OUT, so a link can never carry an
+2 -1
View File
@@ -595,7 +595,8 @@ export class StyleManager extends ShellFacade {
this._setDetectionAllocation(...args),
_setDetectionFade: (...args) => this._setDetectionFade(...args),
_setScope: (...args) => this._visualSettings._setScope(...args),
_applyGlobalPostDefaults: (...args) => this._applyGlobalPostDefaults(...args),
_applyGlobalPostDefaults: (...args) =>
this._applyGlobalPostDefaults(...args),
setCelestialRingEnabled: (...args) =>
this.setCelestialRingEnabled(...args),
_setModels3dEnabled: (...args) => this._setModels3dEnabled(...args),
+2 -1
View File
@@ -137,7 +137,8 @@ export class VisualSettings {
this._setScope({
enabled: scopeEnabled,
featherPct: scopeFeatherPct,
opacityPct: typeof scopeOpacityPct === 'number' ? scopeOpacityPct : undefined,
opacityPct:
typeof scopeOpacityPct === 'number' ? scopeOpacityPct : undefined,
});
// null restores the altitude-adaptive ramp; a number pins the terminus
// (clamped to the supported 94..100 band, same as the `sce` hash key).