mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Add scope opacity and a reset to the Visual panel
The Display panel is regrouped as Visual (Look, Overlay, Effects) with style presets, a scope opacity slider and a reset to the default look. Scope opacity is carried in share links as field 30 and as the legacy sco parameter; 100 is the default and is left out of a link. Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
1 parent
d49d3d10cc
commit
d145c30967
13 files changed
+471
-11
No files matched your search
@@ -43,6 +43,7 @@ export const LEGACY_SHARE_STATE_KEYS = Object.freeze([
|
||||
'celestialRing',
|
||||
'scopeEnabled',
|
||||
'scopeFeatherPct',
|
||||
'scopeOpacityPct',
|
||||
'scopeTerminusPct',
|
||||
'mapStack',
|
||||
'layerState',
|
||||
|
||||
@@ -393,6 +393,7 @@ export const SHARE_VIEW_FIELDS = freezeAll([
|
||||
// Data Library entries switched on, as their two-character ledger tokens
|
||||
// concatenated (src/library/ledger.json). Absent means none.
|
||||
{ number: 29, key: 'library', type: 'bytes', default: null },
|
||||
{ number: 30, key: 'scopeOpacityPct', type: 'uint', default: 100 },
|
||||
]);
|
||||
const FIELD_BY_KEY = new Map(SHARE_VIEW_FIELDS.map((f) => [f.key, f]));
|
||||
const fieldNumber = (key) => FIELD_BY_KEY.get(key).number;
|
||||
@@ -780,6 +781,7 @@ 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.scopeTerminusPct = intOr(
|
||||
source.scopeTerminusPct,
|
||||
null,
|
||||
|
||||
@@ -509,6 +509,7 @@ test('the field registry is well formed and permanent', () => {
|
||||
[27, 'styleParams', BY_STYLE],
|
||||
[28, 'worldTime', null],
|
||||
[29, 'library', null],
|
||||
[30, 'scopeOpacityPct', 100],
|
||||
],
|
||||
);
|
||||
assert.deepEqual(
|
||||
|
||||
Reference in new issue
Block a user