From 234ba4b0dba7d4725459f70cbf561452f36d994f Mon Sep 17 00:00:00 2001 From: Martin-PB Date: Sat, 17 Oct 2026 17:38:11 +0200 Subject: [PATCH] Add mobile port study (docs/mobile-port.md) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Records the evaluation of porting Cartocortex to iOS/Android: what already helps (Tauri 2 mobile-ready shell, pointer events, pure model), what is missing (touch drag, pinch zoom, mobile UI, build targets), and a suggested PR sequence. Study only — nothing implemented. Agent: Vibe (Mistral, glm-5-latest-short) Relu-par-humain: Martin-PB --- README.md | 2 ++ docs/mobile-port.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 docs/mobile-port.md diff --git a/README.md b/README.md index 7c13ecf..0466a91 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ The ‹ chip on a node collapses its branch. The map autosaves to local storage; ## Not yet +Mobile (iOS / Android): a port study lives in [docs/mobile-port.md](docs/mobile-port.md) — not implemented. + Direction variants of XMind structures (up-pointing org chart, left-hand tree), which open as the nearest structure; floating topics, relationships and styles from imported XMind 8 files. ## Added diff --git a/docs/mobile-port.md b/docs/mobile-port.md new file mode 100644 index 0000000..d5e2092 --- /dev/null +++ b/docs/mobile-port.md @@ -0,0 +1,38 @@ +# Porting Cartocortex to mobile (iOS / Android) — study + +Status: **study only — specified, never executed**. This document records what a mobile port would require, so a future implementation can pick it up. Nothing here is built yet. + +## Verdict + +The port is not done in the code as of v0.1.2, and nothing in the README or the open PRs plans it. The architecture is favourable: with Tauri 2 the native shell is nearly free, and the real cost is touch interaction. + +## What already helps + +- **Tauri 2** officially supports iOS and Android (`tauri ios init` / `tauri android init`). The Rust entry point `src-tauri/src/lib.rs` already carries `#[cfg_attr(mobile, tauri::mobile_entry_point)]` — the standard Tauri 2 mobile-ready template. +- **Plugins** (dialog, fs, opener, persisted-scope) all have mobile counterparts in Tauri 2. The browser fallback behind `isTauri` ("__TAURI_INTERNALS__" in window) shows the file layer is already abstracted away from the desktop: in a browser, Save falls back to a download. +- **Pointer Events** are already used for pan, marquee selection and floating-topic drags — they work with touch, unlike legacy Mouse Events. +- The business logic is pure and tested: `src/model.ts` (immutable tree ops, layout) has no platform dependency; the UI (React + TypeScript + Vite) is isolated in `src/`. + +## What blocks or is missing + +1. **No mobile target configured**: no `src-tauri/gen/android` or `gen/ios`, no mobile build workflow (`release.yml` builds macOS/Windows/Linux only), and `src-tauri/capabilities/default.json` references the desktop schema. +2. **Keyboard-first UX**: almost all editing relies on Tab / Enter / arrow keys / Cmd (new topic, navigation, undo/redo, find). On mobile these need buttons or a touch toolbar. +3. **HTML5 drag-and-drop** (`draggable`, `dataTransfer`, drop handling for re-parenting) does not work on touch. It must be replaced by a Pointer Events drag, following the existing `startFloatDrag` model in `App.tsx`. +4. **Zoom**: wheel / ctrl+wheel only; no two-finger pinch-zoom. The non-passive wheel listener in `App.tsx` needs a touch counterpart. +5. Smaller items: double-click (unreliable on iOS), hover menus, the fixed side panel layout, the 1100x720 window definition, `localStorage` autosave limits with embedded images (a few-megabyte cap — pictures are stored inside the map). + +## Suggested implementation path + +- **PR 1 — plumbing**: `tauri ios init` + `tauri android init`, mobile capabilities file, mobile build steps in `release.yml` (draft builds, unsigned), document signing requirements. +- **PR 2 — touch interaction**: reparenting drag in Pointer Events (replacing HTML5 DnD), pinch-zoom with two fingers, long-press instead of double-click, single-tap edit. +- **PR 3 — mobile UI**: a touch toolbar (add child, add sibling, delete, undo/redo, find), collapsible panel, window size / viewport adaptations. +- **PR 4 — storage**: move the autosave from `localStorage` to Tauri's app storage on mobile (size limits with embedded pictures). + +Estimated scope: one deep UI PR plus build plumbing — the Rust/TS split means no rewrite. + +## Points checked in the code (v0.1.2, commit f296080) + +- `package.json`: only @tauri-apps v2 plugins, React 19 — no desktop-only dependency. +- `src-tauri/tauri.conf.json`: window 1100x720, CSP unchanged by mobile; `bundle.targets: "all"`. +- `src-tauri/capabilities/default.json`: desktop schema, window "main", fs permissions scoped to user-picked paths. +- `src/App.tsx` (~995 lines): `isTauri` detection, wheel pan/zoom (non-passive), Pointer Events pan/marquee/float-drag, HTML5 drag for node re-parenting, heavy keyboard handling.