Keep compass responsive in north-up mode

This commit is contained in:
livio committed 2026-10-05 01:18:28 +02:00
1 parent a15c8e0b36
commit 260e0a3df5
3 files changed
+7 -7

No files matched your search

+3 -3
View File
@@ -680,7 +680,7 @@
<label> <label>
Orientamento bussola Orientamento bussola
<select @bind="CompassMode" @bind:after="ApplyCompassOptions" disabled="@(!ShowCompass)"> <select @bind="CompassMode" @bind:after="ApplyCompassOptions" disabled="@(!ShowCompass)">
<option value="fixed">Nord fisso in alto</option> <option value="fixed">Mappa: nord fisso in alto</option>
<option value="heading">Navigatore: direzione del dispositivo in alto</option> <option value="heading">Navigatore: direzione del dispositivo in alto</option>
</select> </select>
</label> </label>
@@ -2862,7 +2862,7 @@
private Task ConfigureCompassSensorAsync() private Task ConfigureCompassSensorAsync()
{ {
var compass = Microsoft.Maui.Devices.Sensors.Compass.Default; var compass = Microsoft.Maui.Devices.Sensors.Compass.Default;
var shouldMonitor = ShowCompass && CompassMode == "heading" && compass.IsSupported; var shouldMonitor = ShowCompass && compass.IsSupported;
try try
{ {
if (shouldMonitor && !CompassSensorSubscribed) if (shouldMonitor && !CompassSensorSubscribed)
@@ -2897,7 +2897,7 @@
object? sender, object? sender,
Microsoft.Maui.Devices.Sensors.CompassChangedEventArgs args) Microsoft.Maui.Devices.Sensors.CompassChangedEventArgs args)
{ {
if (!MapReady || !ShowCompass || CompassMode != "heading") if (!MapReady || !ShowCompass)
{ {
return; return;
} }
+2 -2
View File
@@ -29,8 +29,8 @@
<ApplicationId>it.liviomerola.lmemappecatastali.pro</ApplicationId> <ApplicationId>it.liviomerola.lmemappecatastali.pro</ApplicationId>
<!-- Versions --> <!-- Versions -->
<ApplicationDisplayVersion>1.0.16</ApplicationDisplayVersion> <ApplicationDisplayVersion>1.0.17</ApplicationDisplayVersion>
<ApplicationVersion>116</ApplicationVersion> <ApplicationVersion>117</ApplicationVersion>
<Version>$(ApplicationDisplayVersion)</Version> <Version>$(ApplicationDisplayVersion)</Version>
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged --> <!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
+2 -2
View File
@@ -624,11 +624,11 @@ function setCompassHeading(heading) {
function updateCompassDisplay() { function updateCompassDisplay() {
const element = lmeState.compassElement; const element = lmeState.compassElement;
if (!element) return; if (!element) return;
const rotation = lmeState.compassMode === "fixed" ? 0 : -lmeState.compassHeading; const rotation = -lmeState.compassHeading;
element.classList.toggle("is-fixed", lmeState.compassMode === "fixed"); element.classList.toggle("is-fixed", lmeState.compassMode === "fixed");
element.style.setProperty("--compass-rotation", `${rotation}deg`); element.style.setProperty("--compass-rotation", `${rotation}deg`);
element.setAttribute("aria-label", lmeState.compassMode === "fixed" element.setAttribute("aria-label", lmeState.compassMode === "fixed"
? "Bussola: nord fisso in alto" ? `Bussola: mappa con nord fisso, orientamento ${Math.round(lmeState.compassHeading)} gradi`
: `Bussola: nord, orientamento ${Math.round(lmeState.compassHeading)} gradi`); : `Bussola: nord, orientamento ${Math.round(lmeState.compassHeading)} gradi`);
} }