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:
Manjunath PaparajuandSameh Khamis authored and Sameh Khamis committed 2026-11-14 15:31:25 -08:00
1 parent d49d3d10cc
commit d145c30967
13 files changed
+471 -11

No files matched your search

+21 -6
View File
@@ -5,12 +5,14 @@ import { t } from '../../../i18n/index.js';
import { vPanelState } from '../../rail/panelState.js';
import { vClassToggle } from '../../rail/classToggle.js';
import PanelCollapseButton from '../../rail/PanelCollapseButton.vue';
import UiPanelEdge from '../../kit/UiPanelEdge.vue';
import UiSegmented from '../../kit/UiSegmented.vue';
import UiSlider from '../../kit/UiSlider.js';
import { useDisplayStore } from '../../stores/display.js';
import UiButton from '../../kit/UiButton.vue';
import UiSelect from '../../kit/UiSelect.js';
import { StyleParameterRows } from '../../styleParameters.js';
import VisualPresets from './VisualPresets.vue';
// The Display panel. VisualSettings presents the HUD, Sonar, Scope,
// Celestial, detection, bloom and sharpen and AircraftDisplay the 3D group,
@@ -29,6 +31,7 @@ const detectButton = computed(() => detection.value?.button ?? null);
const allocation = computed(() => detection.value?.allocation ?? 'ELASTIC');
const scopeOn = computed(() => view.value?.scope.enabled ?? true);
const scopeFeather = computed(() => view.value?.scope.featherPct ?? 100);
const scopeOpacity = computed(() => view.value?.scope.opacityPct ?? 100);
const celestial = computed(() => view.value?.celestial ?? null);
const celestialTitle = computed(() =>
celestial.value && !celestial.value.supported
@@ -51,12 +54,15 @@ const allocationOptions = computed(() => [
<!-- Post-processing toggles (top-right) -->
<div id="pp-toggles" v-panel-state="'pp-toggles'" class="panel-collapsible collapsed ui-scroll" data-panel-id="pp-toggles">
<div class="compact pp-header-row">
<span class="pp-header-label">{{ t('DISPLAY') }}</span>
<span class="pp-header-label">{{ t('VISUAL') }}</span>
<span class="panel-divider" aria-hidden="true"></span>
<PanelCollapseButton class="pp-collapse-btn" target="pp-toggles" :name="t('DISPLAY')" sideways start-collapsed />
<UiPanelEdge />
<PanelCollapseButton class="pp-collapse-btn" target="pp-toggles" :name="t('VISUAL')" sideways start-collapsed />
</div>
<div class="pp-panel-body ui-scroll" data-rail-scroller>
<VisualPresets />
<!-- Cockpit shows these four groups in its Display popover: each teleports to the slot the Cockpit display portal publishes. While disabled a Teleport stays in place; its 'body' target only keeps server rendering from dropping it. -->
<p class="pp-section-heading">{{ t('Overlay') }}</p>
<Teleport :to="cockpitPortal?.hud ?? 'body'" :disabled="!cockpitPortal?.hud">
<div class="pp-toggle-group">
<button class="pp-toggle-btn" :class="{ active: hud?.visible }" id="hud-toggle" @click="act('toggleHud')" :title="t('Intelligence HUD (H)')">
@@ -168,17 +174,23 @@ const allocationOptions = computed(() => [
<UiSlider class="pp-slider" id="scope-feather-slider" @update:model-value="act('setScopeFeather', $event)" min="0" max="200" :model-value="scopeFeather" :disabled="!scopeOn" :aria-label="t('Scope edge feather')" :title="t('Scope edge feather as a percentage of the keyhole radius')" />
<span class="pp-slider-value" id="scope-feather-value">{{ pct(scopeFeather) }}</span>
</div>
<div class="pp-slider-row visible" id="scope-opacity-row">
<span class="pp-slider-mini-label">{{ t('Opacity') }}</span>
<UiSlider class="pp-slider" id="scope-opacity-slider" @update:model-value="act('setScopeOpacity', $event)" min="0" max="100" :model-value="scopeOpacity" :disabled="!scopeOn" :aria-label="t('Scope opacity')" :title="t('How dark the scope shades the view outside the keyhole')" />
<span class="pp-slider-value" id="scope-opacity-value">{{ pct(scopeOpacity) }}</span>
</div>
</div>
<button class="pp-toggle-btn" id="clean-view-toggle" @click="act('toggleCleanView')" :title="t('Hide UI chrome')">
<span class="pp-icon">&#x25A1;</span>
<span class="pp-label">{{ t('Clean UI') }}</span>
</button>
<p class="pp-section-heading">{{ t('Effects') }}</p>
<div class="pp-toggle-group">
<UiButton class="pp-toggle-btn" :pressed="celestial?.active ?? false" pressed-class="active" id="celestial-toggle" @click="act('toggleCelestial')" :title="celestialTitle" :disabled="celestial ? !celestial.supported : undefined" :aria-disabled="celestial ? String(!celestial.supported) : undefined">
<span class="pp-icon material-symbols-outlined" aria-hidden="true">flare</span>
<span class="pp-label">{{ t('Celestial') }}</span>
</UiButton>
</div>
<button class="pp-toggle-btn" id="clean-view-toggle" @click="act('toggleCleanView')" :title="t('Hide UI chrome')">
<span class="pp-icon">&#x25A1;</span>
<span class="pp-label">{{ t('Clean UI') }}</span>
</button>
<div class="pp-toggle-group">
<button class="pp-toggle-btn" :class="{ active: view?.bloom.active }" id="bloom-toggle" @click="act('toggleBloom')" :title="t('Bloom / Glow')">
<span class="pp-icon">&#x2728;</span>
@@ -199,6 +211,9 @@ const allocationOptions = computed(() => [
<span class="pp-slider-value" id="sharpen-intensity-value">{{ pct(view?.sharpen.intensity ?? 49) }}</span>
</div>
</div>
<button type="button" class="pp-reset-btn" :title="t('Reset Visual to its defaults: Normal look, HUD, scope, labels and effects')" @click="act('resetVisual')">
<span class="material-symbols-outlined" aria-hidden="true">restart_alt</span>{{ t('Reset to default') }}
</button>
</div>
</div>
</template>
+66
View File
@@ -0,0 +1,66 @@
<script setup>
import { storeToRefs } from 'pinia';
import { t } from '../../../i18n/index.js';
import UiButton from '../../kit/UiButton.vue';
import { useDisplayStore } from '../../stores/display.js';
// The visual presets and map source at the top of the Visual panel. The same
// choices the command dock's tray offers, through the same Display store
// actions, so either surface stays in step with the other.
const display = useDisplayStore();
const { style, mapSource, mapSourceControls } = storeToRefs(display);
const STYLES = [
{ name: 'normal', icon: '◯', label: 'Normal', key: '1' },
{ name: 'retro', icon: '▦', label: 'CRT', key: '2' },
{ name: 'surveillance', icon: '🌙', label: 'NVG', key: '3' },
{ name: 'thermal', icon: '🌡️', label: 'FLIR', key: '4' },
{ name: 'anime', icon: '✦', label: 'Anime', key: '5' },
{ name: 'noir', icon: '◐', label: 'Noir', key: '6' },
];
function selectMapSource(chip) {
if (!chip.available) return;
void mapSourceControls.value?.select(chip.id).catch(() => {});
}
</script>
<template>
<section class="visual-presets" :aria-label="t('VISUAL PRESETS')">
<p class="visual-presets__heading">{{ t('Look') }}</p>
<div class="visual-presets__grid">
<UiButton
v-for="preset in STYLES"
:key="preset.name"
class="visual-presets__style"
:pressed="(style?.name ?? 'normal') === preset.name"
pressed-class="active"
:data-style="preset.name"
@click="display.act('setStyle', preset.name)"
>
<span class="visual-presets__icon" aria-hidden="true">{{ preset.icon }}</span>
<span class="visual-presets__label">{{ t(preset.label) }}</span>
<kbd class="visual-presets__key">{{ preset.key }}</kbd>
</UiButton>
</div>
<div class="visual-presets__heading visual-presets__heading--row">
<span>{{ t('MAP SOURCE') }}</span>
<span class="visual-presets__status" :class="{ warn: !!mapSource?.status.warn }">{{ mapSource ? mapSource.status.text : '3D' }}</span>
</div>
<div class="visual-presets__chips" role="group" :aria-label="t('Map source')">
<UiButton
v-for="chip in mapSource?.chips"
:key="chip.id"
class="visual-presets__chip"
:class="{ unavailable: !chip.available }"
:pressed="Boolean(chip.active)"
pressed-class="active"
:title="chip.title"
:aria-disabled="String(!chip.available)"
:aria-label="chip.ariaLabel"
@click="selectMapSource(chip)"
>{{ chip.label }}<small v-if="chip.requirement">{{ chip.requirement }}</small></UiButton
>
</div>
</section>
</template>