speedandcurrent 2.0.2 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -0
- package/package.json +2 -2
- package/public/index.html +8 -2
package/index.js
CHANGED
|
@@ -518,6 +518,9 @@ module.exports = function (app) {
|
|
|
518
518
|
if (table && !isTableEmpty(table)) {
|
|
519
519
|
saveTableSync(table, path.join(app.getDataDirPath(), table.id + '.json'));
|
|
520
520
|
}
|
|
521
|
+
// Clear all active output paths from the SK bus before teardown.
|
|
522
|
+
if (smoothedCurrent) PolarSmoother.clear(app, plugin.id, [smoothedCurrent]);
|
|
523
|
+
if (options.estimateBoatSpeed && correctedBoatSpeed) Polar.clear(app, plugin.id, [correctedBoatSpeed]);
|
|
521
524
|
smoothedHeading = smoothedHeading?.terminate();
|
|
522
525
|
smoothedAttitude = smoothedAttitude?.terminate();
|
|
523
526
|
rawCurrent = rawCurrent?.terminate();
|
|
@@ -750,6 +753,10 @@ module.exports = function (app) {
|
|
|
750
753
|
// All other keys (sogFallback, estimateBoatSpeed, assumeCurrent,
|
|
751
754
|
// stability, smootherClass, etc.) are read
|
|
752
755
|
// directly from options.* so no extra action needed.
|
|
756
|
+
if (key === 'estimateBoatSpeed' && !value && correctedBoatSpeed) {
|
|
757
|
+
Polar.clear(app, plugin.id, [correctedBoatSpeed]);
|
|
758
|
+
PolarSmoother.clear(app, plugin.id, [smoothedCurrent]);
|
|
759
|
+
}
|
|
753
760
|
|
|
754
761
|
delete changedOptions[key];
|
|
755
762
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "speedandcurrent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "A plugin that automatically corrects boat speed and calculates current and leeway using sensor fusion.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"kalman-filter": "^2.3.0",
|
|
41
|
-
"signalkutilities": "^
|
|
41
|
+
"signalkutilities": "^3.0.0"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"index.js",
|
package/public/index.html
CHANGED
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
<img src="icon.png" alt="" style="height:48px;width:auto">
|
|
55
55
|
<span class="app-title">Speed & Current</span>
|
|
56
56
|
</a>
|
|
57
|
-
<button class="navbar-toggler sidebar-toggler
|
|
57
|
+
<button class="navbar-toggler sidebar-toggler ms-2" type="button" id="sidebarToggler">
|
|
58
58
|
<span class="navbar-toggler-icon"></span>
|
|
59
59
|
</button>
|
|
60
60
|
</div>
|
|
@@ -214,8 +214,13 @@
|
|
|
214
214
|
document.body.classList.toggle('sidebar-minimized');
|
|
215
215
|
document.body.classList.toggle('brand-minimized');
|
|
216
216
|
});
|
|
217
|
+
const isMobile = () => window.matchMedia('(max-width: 767.98px)').matches;
|
|
217
218
|
document.getElementById('sidebarToggler').addEventListener('click', () => {
|
|
218
|
-
|
|
219
|
+
if (isMobile()) {
|
|
220
|
+
document.body.classList.toggle('sidebar-mobile-show');
|
|
221
|
+
} else {
|
|
222
|
+
document.body.classList.toggle('sidebar-hidden');
|
|
223
|
+
}
|
|
219
224
|
});
|
|
220
225
|
document.querySelectorAll('#main-nav .nav-link').forEach(link => {
|
|
221
226
|
link.addEventListener('click', e => {
|
|
@@ -225,6 +230,7 @@
|
|
|
225
230
|
const target = link.dataset.section;
|
|
226
231
|
document.querySelectorAll('.app-section').forEach(s => s.style.display = 'none');
|
|
227
232
|
document.getElementById('section-' + target).style.display = '';
|
|
233
|
+
if (isMobile()) document.body.classList.remove('sidebar-mobile-show');
|
|
228
234
|
});
|
|
229
235
|
});
|
|
230
236
|
</script>
|