mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Merge Core main into german/hal-644-ar: Arabic on the Vue UI
Main moved the UI to Vue views and Pinia stores, so the Arabic changes to the old DOM controllers now live in their views: the rail legend range comes from formatScaleRange (keeping units a source supplies as given), the voice timeout options are worded by Intl unit formatting in VoiceControl, and the scene editor's JSON fields stay left to right in SceneDialog. Main's CCTV status line, launch panel and calibration values keep the Arabic isolates and Western-digit formatting. isolate() and keepCodesWithValues() read the locale through getLocale(), which follows the page's vue-i18n instance, and the Intl formatters take intlLocale(getLocale()). A language switch now applies in place, and applyDocumentLanguage sets <html dir> on every switch, so the page mirrors without a reload. The icon rails and their tips are placed with logical properties, so they stay on the outer side of the mirrored stacks; Cyber's new stack offsets, padding and edge lines are logical too, and rtl.css moves Cyber's right stack to its new rail clearance. Main removed the Context mini radio, so its right-to-left rules and test go. The Arabic catalog gains main's new strings and drops the ones main no longer uses; the other catalogs keep main's new keys and the branch's landing labels.
This commit is contained in:
commit
bc5d038afd
630 files changed
+41141
-20956
No files matched your search
+51
-73
@@ -1,5 +1,4 @@
|
||||
import { formatNumber, isolate, msg, t } from '../i18n/index.js';
|
||||
import { createNumberInput } from './formField.js';
|
||||
|
||||
/** Shortest-wrap signed degrees, for heading offsets typed as absolute values. */
|
||||
const signedNormalizeDeg = (deg) => ((((deg + 180) % 360) + 360) % 360) - 180;
|
||||
@@ -112,100 +111,79 @@ export function _resetCctvCalibration() {
|
||||
export function _beginCctvCalValueEdit(chip) {
|
||||
if (this.destroyed) return;
|
||||
this._calibrationEdit?.(false);
|
||||
const field = CCTV_CAL_FIELDS[chip.dataset.calField];
|
||||
const fieldId = chip.dataset.calField;
|
||||
const field = CCTV_CAL_FIELDS[fieldId];
|
||||
const activeCamera = this._cctvState?.activeCamera;
|
||||
if (!field || !activeCamera?.basePose) return;
|
||||
const cameraId = this._activeCctvCameraId();
|
||||
const basePose = { ...activeCamera.basePose };
|
||||
const editListeners = new AbortController();
|
||||
const startValue = field.get(activeCamera);
|
||||
const input = createNumberInput({
|
||||
className: 'gev-field--inline cctv-cal-input',
|
||||
step: field.decimals > 0 ? '0.1' : '1',
|
||||
value: Number(startValue).toFixed(field.decimals),
|
||||
ariaLabel: t(field.label),
|
||||
});
|
||||
chip.textContent = `${t(field.label)} `;
|
||||
chip.appendChild(input);
|
||||
input.focus();
|
||||
input.select();
|
||||
|
||||
let finished = false;
|
||||
const finish = (commit) => {
|
||||
/**
|
||||
* End the edit: commit converts the typed value to a calibration offset
|
||||
* against the pose captured when it began; anything else just closes it.
|
||||
*/
|
||||
const finish = (commit, typedText = '') => {
|
||||
if (finished) return;
|
||||
finished = true;
|
||||
editListeners.abort();
|
||||
this._calibrationEdit = null;
|
||||
const typed = parseFloat(input.value);
|
||||
input.remove();
|
||||
this.store.setCalEdit(null);
|
||||
const typed = parseFloat(typedText);
|
||||
if (
|
||||
commit &&
|
||||
!this.destroyed &&
|
||||
Number.isFinite(typed) &&
|
||||
this._cctvState?.enabled &&
|
||||
this.actions.isEnabled() &&
|
||||
cameraId === this._activeCctvCameraId()
|
||||
cameraId &&
|
||||
cameraId === this._activeCctvCameraId() &&
|
||||
this.actions.setParams
|
||||
) {
|
||||
if (cameraId && this.actions.setParams) {
|
||||
this.actions.setParams(
|
||||
{
|
||||
selectedCameraId: cameraId,
|
||||
calibration: { cameraId, patch: field.toPatch(typed, basePose) },
|
||||
},
|
||||
{ origin: 'user' },
|
||||
);
|
||||
return; // re-render restores the chip text from fresh state
|
||||
}
|
||||
this.actions.setParams(
|
||||
{
|
||||
selectedCameraId: cameraId,
|
||||
calibration: { cameraId, patch: field.toPatch(typed, basePose) },
|
||||
},
|
||||
{ origin: 'user' },
|
||||
);
|
||||
}
|
||||
this._syncCctvCalReadout(
|
||||
!!this._cctvState?.enabled,
|
||||
this._cctvState?.activeCamera || null,
|
||||
);
|
||||
};
|
||||
this._calibrationEdit = finish;
|
||||
input.addEventListener(
|
||||
'keydown',
|
||||
(event) => {
|
||||
if (event.key === 'Enter') finish(true);
|
||||
else if (event.key === 'Escape') {
|
||||
event.preventDefault();
|
||||
finish(false);
|
||||
}
|
||||
event.stopPropagation();
|
||||
},
|
||||
{ signal: editListeners.signal },
|
||||
);
|
||||
input.addEventListener('blur', () => finish(true), {
|
||||
signal: editListeners.signal,
|
||||
});
|
||||
input.addEventListener('click', (event) => event.stopPropagation(), {
|
||||
signal: editListeners.signal,
|
||||
// The readout renders a number input in this chip; Enter or blur commits
|
||||
// and Escape cancels through `finish`.
|
||||
this.store.setCalEdit({
|
||||
field: fieldId,
|
||||
label: `${t(field.label)} `,
|
||||
ariaLabel: t(field.label),
|
||||
step: field.decimals > 0 ? '0.1' : '1',
|
||||
value: Number(field.get(activeCamera)).toFixed(field.decimals),
|
||||
finish,
|
||||
});
|
||||
}
|
||||
|
||||
export function _syncCctvCalReadout(enabled, activeCamera) {
|
||||
/**
|
||||
* The calibration block for a camera state: ADJUST, the pose chips and
|
||||
* whether calibration is possible. Chips show the effective pose.
|
||||
* @param {object|null} state Camera layer UI state.
|
||||
* @param {boolean} enabled Whether the layer is on.
|
||||
*/
|
||||
export function presentCctvCalibration(state, enabled) {
|
||||
const activeCamera = state?.activeCamera || null;
|
||||
const canCalibrate = !!enabled && !!activeCamera;
|
||||
if (this._cctvAdjustBtn) {
|
||||
const adjustOn = !!this._cctvState?.calibrationMode;
|
||||
this._cctvAdjustBtn.classList.toggle('active', adjustOn && canCalibrate);
|
||||
this._cctvAdjustBtn.textContent = adjustOn ? t('ADJUST ON') : t('ADJUST');
|
||||
this._cctvAdjustBtn.disabled = !canCalibrate;
|
||||
}
|
||||
if (this._cctvCalReadout) {
|
||||
for (const chip of this._cctvCalReadout.querySelectorAll(
|
||||
'.cctv-cal-value',
|
||||
)) {
|
||||
if (chip.querySelector('input')) continue; // an edit is in flight — don't clobber
|
||||
const field = CCTV_CAL_FIELDS[chip.dataset.calField];
|
||||
if (!field) continue;
|
||||
const value = canCalibrate ? field.get(activeCamera) : null;
|
||||
chip.textContent = Number.isFinite(value)
|
||||
? calValueText(field, value)
|
||||
: `${t(field.label)} --`;
|
||||
chip.disabled = !canCalibrate;
|
||||
}
|
||||
}
|
||||
for (const el of [this._cctvCalibSaveBtn, this._cctvCalibResetBtn]) {
|
||||
if (el) el.disabled = !canCalibrate;
|
||||
const adjustOn = !!state?.calibrationMode;
|
||||
const values = {};
|
||||
for (const [id, field] of Object.entries(CCTV_CAL_FIELDS)) {
|
||||
const value = canCalibrate ? field.get(activeCamera) : null;
|
||||
values[id] = Number.isFinite(value)
|
||||
? calValueText(field, value)
|
||||
: `${t(field.label)} --`;
|
||||
}
|
||||
return {
|
||||
disabled: !canCalibrate,
|
||||
adjust: {
|
||||
active: adjustOn && canCalibrate,
|
||||
text: adjustOn ? t('ADJUST ON') : t('ADJUST'),
|
||||
},
|
||||
values,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user