drone-path 0.11.0 → 0.12.0
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/CHANGELOG.md +28 -0
- package/README.md +5 -2
- package/app/ipc.d.mts +1 -1
- package/app/ipc.mjs +10 -10
- package/app/main.mjs +3 -3
- package/app/preload.cjs +2 -2
- package/dist/appsession.js +9 -9
- package/dist/plan.js +5 -1
- package/dist/renderer/dom.js +18 -0
- package/dist/renderer/scene.js +30 -9
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# drone-path
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
- **New:** The flight map zooms in and out with a small `−`/`+` pill
|
|
6
|
+
below the map (split view) and the `+` / `-` keys: every step pins the
|
|
7
|
+
level as the fixed "Zoom" setting, so the export renders exactly the
|
|
8
|
+
zoom the preview shows. Zooming clamps at the map's usable levels with
|
|
9
|
+
the matching button disabling at either end, and opening a recording
|
|
10
|
+
resets Zoom to auto-fit.
|
|
11
|
+
- **New:** The map card's Speed, Altitude and Zoom readouts now sit in
|
|
12
|
+
one compact strip below the map — labeled columns with a bare `−`
|
|
13
|
+
level `+` stepper instead of separate chip pills and a zoom row — and
|
|
14
|
+
the map reclaims the freed height. A turned-off HUD chip keeps its
|
|
15
|
+
column and shows a dimmed `--`.
|
|
16
|
+
- **New:** Map appearance is now a modal dialog with a live preview of
|
|
17
|
+
the export frame — the loaded recording or a bundled example flight —
|
|
18
|
+
and grouped settings: map style as thumbnail tiles, a trail color
|
|
19
|
+
swatch row with an explicit Style default, an Auto-fit zoom toggle
|
|
20
|
+
with a zoom level slider and Frame padding, clickable HUD chips, and
|
|
21
|
+
an opening & ending strip. The entry moved from File to View, and the
|
|
22
|
+
player shortcuts pause while the dialog is open.
|
|
23
|
+
|
|
24
|
+
## 0.11.1
|
|
25
|
+
|
|
26
|
+
- **Fixed:** Video export in the packaged desktop app ("Export video…")
|
|
27
|
+
works again: the app now bundles the renderer's `playwright-core` and
|
|
28
|
+
renders with the system browser (Google Chrome or Microsoft Edge), the
|
|
29
|
+
same as the CLI.
|
|
30
|
+
|
|
3
31
|
## 0.11.0
|
|
4
32
|
|
|
5
33
|
- **New:** Flight track files: `--track-out <file>` writes the decoded
|
package/README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
> [!NOTE]
|
|
2
|
+
> Head's up! This repo will be restructured as a monorepo in the near future.
|
|
3
|
+
|
|
1
4
|
# Drone Path
|
|
2
5
|
|
|
3
6
|
This handy little tool renders flight-path map videos from DJI drone
|
|
@@ -67,8 +70,8 @@ telemetry JSON. The look settings carry over between launches.
|
|
|
67
70
|

|
|
68
71
|
|
|
69
72
|
*The desktop app playing a recording: the recording beside the synchronized
|
|
70
|
-
flight map, with the flight trail, drone position and
|
|
71
|
-
timeline.*
|
|
73
|
+
flight map, with the flight trail, drone position and the readout strip on one
|
|
74
|
+
shared timeline.*
|
|
72
75
|
|
|
73
76
|
## Feature requests
|
|
74
77
|
|
package/app/ipc.d.mts
CHANGED
package/app/ipc.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import path from 'node:path';
|
|
|
6
6
|
|
|
7
7
|
import { dialog, ipcMain, shell } from 'electron';
|
|
8
8
|
|
|
9
|
-
import { parsePickRequest,
|
|
9
|
+
import { parsePickRequest, parseTrackSaveRequest } from '../dist/appsession.js';
|
|
10
10
|
import { applyAppState, writeAppState } from '../dist/appstate.js';
|
|
11
11
|
import { APP_ORIGIN, appStateFile } from '../dist/apppaths.js';
|
|
12
12
|
import { parseExportRequest, parseSettingsPatch } from '../dist/config.js';
|
|
@@ -44,11 +44,11 @@ function requireVideo(state) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// The reveal/open guard: the renderer may only name a file this shell wrote
|
|
47
|
-
// (the last export or the last
|
|
47
|
+
// (the last export or the last track file, both set only by trusted
|
|
48
48
|
// handlers), never an arbitrary path.
|
|
49
49
|
function knownOutputOf(state, payload) {
|
|
50
50
|
const out = payload && typeof payload === 'object' ? payload.out : null;
|
|
51
|
-
if (typeof out !== 'string' || (out !== state.lastExportOut && out !== state.
|
|
51
|
+
if (typeof out !== 'string' || (out !== state.lastExportOut && out !== state.lastTrackOut)) {
|
|
52
52
|
throw new Error('unknown output');
|
|
53
53
|
}
|
|
54
54
|
return out;
|
|
@@ -156,8 +156,8 @@ function registerExportHandlers(state, devUrl) {
|
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
function
|
|
160
|
-
handle(devUrl, 'dronepath:
|
|
159
|
+
function registerTrackHandlers(state, devUrl, log) {
|
|
160
|
+
handle(devUrl, 'dronepath:track:pick-output', async () => {
|
|
161
161
|
const video = requireVideo(state);
|
|
162
162
|
// The export dialog's default folder, named after the recording
|
|
163
163
|
// (<basename>.telemetry.json); the typed name selects the format by its
|
|
@@ -177,11 +177,11 @@ function registerTelemetryHandlers(state, devUrl, log) {
|
|
|
177
177
|
defaultExtension: 'json',
|
|
178
178
|
});
|
|
179
179
|
});
|
|
180
|
-
handle(devUrl, 'dronepath:
|
|
180
|
+
handle(devUrl, 'dronepath:track:save', (raw) => {
|
|
181
181
|
requireVideo(state);
|
|
182
|
-
const request =
|
|
183
|
-
state.session.
|
|
184
|
-
state.
|
|
182
|
+
const request = parseTrackSaveRequest(raw);
|
|
183
|
+
state.session.saveTrack(request.outPath, request.range);
|
|
184
|
+
state.lastTrackOut = request.outPath;
|
|
185
185
|
log(`track: wrote ${request.outPath}`);
|
|
186
186
|
return { ok: true };
|
|
187
187
|
});
|
|
@@ -210,7 +210,7 @@ export function registerIpcHandlers(state, { devUrl, log, sendToWindow }) {
|
|
|
210
210
|
registerSessionHandlers(state, devUrl);
|
|
211
211
|
registerSettingsHandlers(state, devUrl, log);
|
|
212
212
|
registerExportHandlers(state, devUrl);
|
|
213
|
-
|
|
213
|
+
registerTrackHandlers(state, devUrl, log);
|
|
214
214
|
registerUpdateHandlers(state, devUrl, sendToWindow);
|
|
215
215
|
registerWindowHandlers(state, devUrl);
|
|
216
216
|
}
|
package/app/main.mjs
CHANGED
|
@@ -71,10 +71,10 @@ function createShellState() {
|
|
|
71
71
|
updates: null,
|
|
72
72
|
// A downloaded update waits even if its announcement raced the renderer.
|
|
73
73
|
updateReady: false,
|
|
74
|
-
// The destinations of the last successful export and the last
|
|
75
|
-
//
|
|
74
|
+
// The destinations of the last successful export and the last track
|
|
75
|
+
// save: the only paths the renderer may reveal or open.
|
|
76
76
|
lastExportOut: null,
|
|
77
|
-
|
|
77
|
+
lastTrackOut: null,
|
|
78
78
|
closePromptOpen: false,
|
|
79
79
|
pendingClose: false,
|
|
80
80
|
};
|
package/app/preload.cjs
CHANGED
|
@@ -14,8 +14,8 @@ contextBridge.exposeInMainWorld('dronepath', {
|
|
|
14
14
|
getSettings: () => ipcRenderer.invoke('dronepath:settings'),
|
|
15
15
|
saveSettings: (patch) => ipcRenderer.invoke('dronepath:settings:save', patch),
|
|
16
16
|
pickExportOutput: () => ipcRenderer.invoke('dronepath:export:pick-output'),
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
pickTrackOutput: () => ipcRenderer.invoke('dronepath:track:pick-output'),
|
|
18
|
+
saveTrack: (request) => ipcRenderer.invoke('dronepath:track:save', request),
|
|
19
19
|
startExport: (request) => ipcRenderer.invoke('dronepath:export:start', request),
|
|
20
20
|
cancelExport: () => ipcRenderer.invoke('dronepath:export:cancel'),
|
|
21
21
|
revealExportOutput: (payload) => ipcRenderer.invoke('dronepath:export:reveal', payload),
|
package/dist/appsession.js
CHANGED
|
@@ -17,23 +17,23 @@ export function parsePickRequest(raw) {
|
|
|
17
17
|
const input = typeof raw === 'object' && raw !== null ? raw : {};
|
|
18
18
|
return { settings: parseAppearanceSettings(input.settings) };
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const TRACK_SAVE_SHAPE = {
|
|
21
21
|
outPath: z.unknown().optional(),
|
|
22
22
|
range: z.unknown().optional(),
|
|
23
23
|
};
|
|
24
|
-
export function
|
|
25
|
-
const request = parseValue(strictShape(
|
|
26
|
-
invalid: 'invalid
|
|
27
|
-
unknownKey: (key) => `unknown
|
|
24
|
+
export function parseTrackSaveRequest(raw) {
|
|
25
|
+
const request = parseValue(strictShape(TRACK_SAVE_SHAPE, {
|
|
26
|
+
invalid: 'invalid track save request',
|
|
27
|
+
unknownKey: (key) => `unknown track save request key ${key}`,
|
|
28
28
|
}), raw);
|
|
29
29
|
const outPath = parseValue(z
|
|
30
|
-
.string({ error: () => 'invalid
|
|
31
|
-
.min(1, { error: () => 'invalid
|
|
30
|
+
.string({ error: () => 'invalid track save request: outPath' })
|
|
31
|
+
.min(1, { error: () => 'invalid track save request: outPath' }), request.outPath);
|
|
32
32
|
try {
|
|
33
33
|
trackFormatOf(outPath);
|
|
34
34
|
}
|
|
35
35
|
catch (e) {
|
|
36
|
-
throw new Error(`invalid
|
|
36
|
+
throw new Error(`invalid track save request: outPath must be a .gpx, .geojson, .kml, .kmz or .json file: ${outPath}`, { cause: e });
|
|
37
37
|
}
|
|
38
38
|
const range = request.range === undefined || request.range === null
|
|
39
39
|
? null
|
|
@@ -112,7 +112,7 @@ export function createAppSession(options) {
|
|
|
112
112
|
},
|
|
113
113
|
getSession: () => prepared?.session ?? null,
|
|
114
114
|
videoPath: () => videoPath,
|
|
115
|
-
|
|
115
|
+
saveTrack(file, range) {
|
|
116
116
|
if (!prepared)
|
|
117
117
|
throw new Error(ERR_NO_RECORDING);
|
|
118
118
|
writeTrackFile(file, { document: prepared.telemetry, track: prepared.track }, range);
|
package/dist/plan.js
CHANGED
|
@@ -4,6 +4,10 @@ const MIN_ZOOM = 2;
|
|
|
4
4
|
const HOVER_ZOOM_FLOOR = 16;
|
|
5
5
|
const MIN_TRACK_SPAN_PX = 80;
|
|
6
6
|
const TILE_SIZE_PX = 256;
|
|
7
|
+
/** The zoom levels the planner renders: the floor and the map style's tile maximum. */
|
|
8
|
+
export function zoomLimits(style) {
|
|
9
|
+
return { min: MIN_ZOOM, max: TILE_SOURCES[style].maxZoom || 19 };
|
|
10
|
+
}
|
|
7
11
|
function fitZoomToTrack(bbox, availW, availH, maxZoom) {
|
|
8
12
|
for (let zoom = maxZoom; zoom >= MIN_ZOOM; zoom--) {
|
|
9
13
|
const northWest = project(bbox.minLon, bbox.maxLat, zoom);
|
|
@@ -81,7 +85,7 @@ export function planView(bbox, width, height, config) {
|
|
|
81
85
|
bbox,
|
|
82
86
|
width,
|
|
83
87
|
height,
|
|
84
|
-
maxZoom:
|
|
88
|
+
maxZoom: zoomLimits(config.style).max,
|
|
85
89
|
maxNativeZoom: src.maxNativeZoom ?? null,
|
|
86
90
|
zoomOut: config.zoomOut,
|
|
87
91
|
zoomOverride: config.zoom,
|
package/dist/renderer/dom.js
CHANGED
|
@@ -114,6 +114,24 @@ export function hudMarkup(hud) {
|
|
|
114
114
|
}
|
|
115
115
|
return chips.map((chip) => ` ${chip}`).join('\n');
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* The app strip's readout columns (#272): both always render so the strip's
|
|
119
|
+
* shape never depends on settings; a disabled chip keeps its column and shows
|
|
120
|
+
* the dimmed "--" placeholder instead of a value. The ids and .num/.unit spans
|
|
121
|
+
* match the export HUD contract, so the scene's value queries work for both.
|
|
122
|
+
*/
|
|
123
|
+
export function stripReadoutMarkup(hud) {
|
|
124
|
+
const column = (id, label, unit, live) => `<div class="map-readout${live ? '' : ' map-readout-off'}" id="chip-${id}">` +
|
|
125
|
+
`<span class="label">${label}</span>` +
|
|
126
|
+
`<span class="value"><span class="num">--</span><span class="unit">${unit}</span></span>` +
|
|
127
|
+
`</div>`;
|
|
128
|
+
return [
|
|
129
|
+
column('speed', 'Speed', 'm/s', hud.speed),
|
|
130
|
+
column('alt', 'Altitude', 'm', hud.alt),
|
|
131
|
+
]
|
|
132
|
+
.map((col) => ` ${col}`)
|
|
133
|
+
.join('\n');
|
|
134
|
+
}
|
|
117
135
|
/** A null hud keeps the chips out of the map frame: the caller mounts them in
|
|
118
136
|
a strip outside the map image instead. */
|
|
119
137
|
export function mapMarkup(hud, attribution) {
|
package/dist/renderer/scene.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TILE_SOURCES } from './tilesources.js';
|
|
2
|
-
import { droneMarkerMarkup, el, hudMarkup, mapMarkup, quietAttributionLinks, sceneCss } from './dom.js';
|
|
2
|
+
import { droneMarkerMarkup, el, hudMarkup, mapMarkup, quietAttributionLinks, sceneCss, stripReadoutMarkup } from './dom.js';
|
|
3
3
|
import { computeScale, introOutroScale, metersPerPixel, scaleBarMeters } from './framemath.js';
|
|
4
4
|
import { themeFor } from './theme.js';
|
|
5
5
|
import { createTrailController } from './trail.js';
|
|
@@ -11,6 +11,10 @@ function setChipText(chip, value, format) {
|
|
|
11
11
|
return;
|
|
12
12
|
chip.textContent = value === null || value === undefined ? '--' : format(value);
|
|
13
13
|
}
|
|
14
|
+
/** A missing value renders exactly like a disabled chip: the dimmed "--". */
|
|
15
|
+
function isPlaceholder(value) {
|
|
16
|
+
return value === null || value === undefined;
|
|
17
|
+
}
|
|
14
18
|
let scopeCount = 0;
|
|
15
19
|
class SceneState {
|
|
16
20
|
ready;
|
|
@@ -32,10 +36,12 @@ class SceneState {
|
|
|
32
36
|
bb;
|
|
33
37
|
layout;
|
|
34
38
|
decor;
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
altChip = null;
|
|
40
|
+
speedChip = null;
|
|
37
41
|
/** Chip container: inside the map frame for exports, or an external strip. */
|
|
38
42
|
hudRoot;
|
|
43
|
+
/** External strips get the column markup; the export frame keeps its pills. */
|
|
44
|
+
externalHud;
|
|
39
45
|
curIdx = 0;
|
|
40
46
|
constructor(host, firstData, L, hudHost) {
|
|
41
47
|
this.host = host;
|
|
@@ -44,8 +50,12 @@ class SceneState {
|
|
|
44
50
|
host.classList.add(this.scopeClass);
|
|
45
51
|
this.styleEl = document.createElement('style');
|
|
46
52
|
document.head.appendChild(this.styleEl);
|
|
47
|
-
|
|
53
|
+
// One definedness rule for both: a caller either supplies the external
|
|
54
|
+
// strip host or gets the in-frame export HUD, never a mix of the two.
|
|
55
|
+
const externalHud = hudHost !== undefined;
|
|
56
|
+
host.innerHTML = mapMarkup(externalHud ? null : firstData.hud, firstData.attribution);
|
|
48
57
|
this.hudRoot = hudHost ?? el(host, '#hud');
|
|
58
|
+
this.externalHud = externalHud;
|
|
49
59
|
this.attrEl = el(host, '#attr');
|
|
50
60
|
this.applyChrome();
|
|
51
61
|
this.mapEl = el(host, '#map');
|
|
@@ -244,9 +254,11 @@ class SceneState {
|
|
|
244
254
|
rebuildHud() {
|
|
245
255
|
// Scoped to the chip container so an external strip and a second scene
|
|
246
256
|
// (the export preview) can never cross-write.
|
|
247
|
-
this.hudRoot.innerHTML =
|
|
248
|
-
|
|
249
|
-
|
|
257
|
+
this.hudRoot.innerHTML = this.externalHud
|
|
258
|
+
? stripReadoutMarkup(this.data.hud)
|
|
259
|
+
: hudMarkup(this.data.hud);
|
|
260
|
+
this.altChip = this.hudRoot.querySelector('#chip-alt');
|
|
261
|
+
this.speedChip = this.hudRoot.querySelector('#chip-speed');
|
|
250
262
|
if (this.decor.arrowEl) {
|
|
251
263
|
this.decor.arrowEl.style.display = this.data.hud.heading ? '' : 'none';
|
|
252
264
|
}
|
|
@@ -272,8 +284,17 @@ class SceneState {
|
|
|
272
284
|
}
|
|
273
285
|
}
|
|
274
286
|
updateHud(i) {
|
|
275
|
-
|
|
276
|
-
|
|
287
|
+
// A disabled chip and a missing sample share one presentation: the dimmed
|
|
288
|
+
// "--" placeholder instead of a value (#272 review).
|
|
289
|
+
this.setReadout(this.altChip, this.data.hud.alt ? this.data.alt[i] : null, (a) => String(Math.round(a)));
|
|
290
|
+
this.setReadout(this.speedChip, this.data.hud.speed ? this.data.speed[i] : null, (s) => s.toFixed(1));
|
|
291
|
+
}
|
|
292
|
+
setReadout(chip, value, format) {
|
|
293
|
+
if (!chip)
|
|
294
|
+
return;
|
|
295
|
+
setChipText(chip.querySelector('.num'), value, format);
|
|
296
|
+
if (this.externalHud)
|
|
297
|
+
chip.classList.toggle('map-readout-off', isPlaceholder(value));
|
|
277
298
|
}
|
|
278
299
|
setFrame(i) {
|
|
279
300
|
this.curIdx = i;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drone-path",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Render flight-path map overlay videos (exactly the source frame rate and frame count) from DJI drone recordings - telemetry from the embedded CAM-meta (DVTM) stream or the .SRT sidecar.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "app/main.mjs",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@types/react": "~19.3.0",
|
|
83
83
|
"@types/react-dom": "~19.3.0",
|
|
84
84
|
"concurrently": "~10.0.7",
|
|
85
|
-
"electron": "~45.
|
|
85
|
+
"electron": "~45.3.1",
|
|
86
86
|
"electron-builder": "~26.18.0",
|
|
87
87
|
"eslint": "~10.14.0",
|
|
88
88
|
"eslint-plugin-react-hooks": "~7.1.1",
|