feat: Tablet- und Web-Bedienung härten
- Oberfläche in CSS-Pixeln layouten (stretch disabled, content_scale_factor = Bildschirm-Skalierung), damit 56-px-Ziele auf Tablets auch 56 CSS-Pixel groß sind - Kompakte Werkzeugleiste unter 1280 px, umbruchfähige Timing-Leiste; 1024 px (iPad-Landscape) und 1400 px (Tab S9+) geprüft - Chrome-Guard gegen synthetische Maus-Events vor/nach Touch-Gesten - Web-Export-Preset und tools/export_web.sh (single-threaded) - Kurven-Cache und Linien-Fastpath: Stresstest mit 480 Segmenten von ca. 48 ms auf ca. 7-10 ms pro Redraw - Neue Suiten für Touch/Layout und Performance, Tablet-Testanleitung in docs/web-test.md
This commit is contained in:
parent
0df49873d1
commit
d44a4e1e2f
18 changed files with 924 additions and 111 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -5,7 +5,6 @@
|
|||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
export_presets.cfg
|
||||
|
||||
# Imported translations (automatically generated from CSV files)
|
||||
*.translation
|
||||
|
|
@ -18,3 +17,6 @@ mono_crash.*.json
|
|||
|
||||
# Workbench (extern archiviert, nicht versionieren)
|
||||
workbench/
|
||||
|
||||
# Export builds
|
||||
/build/
|
||||
|
|
|
|||
|
|
@ -164,12 +164,45 @@ Gesetzt in `rinkplanner/project.godot`:
|
|||
| Mobile | `mobile` |
|
||||
| Web (Wasm) | `gl_compatibility` |
|
||||
|
||||
Die Designauflösung ist 1920 × 1200 mit `canvas_items` / `expand`; die
|
||||
Oberfläche skaliert mit, das Rink-Koordinatensystem bleibt in Metern.
|
||||
### UI-Skalierung (Touch-first)
|
||||
|
||||
Touch-Ziele: mindestens 48 × 48 px. Für Desktop-Tests kann temporär
|
||||
`window/stretch/mode="disabled"`: Die Oberfläche wird in realen Fenster- bzw.
|
||||
CSS-Pixeln gelayoutet. Zusätzlich setzt der Controller
|
||||
`Window.content_scale_factor` auf die Bildschirm-Skalierung
|
||||
(`DisplayServer.screen_get_scale()`). Damit entspricht eine Layout-Einheit auf
|
||||
Tablets einem CSS-Pixel und wird trotzdem in Gerätepixeln gerendert:
|
||||
|
||||
- Ein 56-px-Button ist auf dem Tablet wirklich 56 CSS-Pixel groß, statt durch
|
||||
eine feste Designauflösung kleingerechnet zu werden.
|
||||
- Das Rink bleibt in Metern; nur die Pixelabbildung ändert sich.
|
||||
- Der PNG-Export ist unabhängig davon (eigener `SubViewport`, 2560 × 1600).
|
||||
|
||||
### Responsive Leiste
|
||||
|
||||
- Ab 1280 px Breite: volle Beschriftungen („Rinkplanner“, „Werkzeug“,
|
||||
„Rückgängig“, „Wiederholen“, „Kalibrieren“).
|
||||
- Unter 1280 px: kompakte Beschriftungen („Undo“, „Redo“, „Kalib.“), Titel und
|
||||
Werkzeug-Label entfallen, das Sections-Panel wird 260 statt 300 px breit.
|
||||
- Die Timing-Leiste ist ein `HFlowContainer` und bricht bei Bedarf um, statt
|
||||
seitlich abgeschnitten zu werden.
|
||||
- Geprüfte Landschaftsbreiten: 1024 px (iPad-Landscape) und 1400 px
|
||||
(Galaxy Tab S9+). Hochformat ist noch nicht gestaltet.
|
||||
|
||||
### Zeichen-Cache
|
||||
|
||||
`RinkCanvas` cached die in Bildschirmpunkte gesampelten Kurven pro Segment.
|
||||
Der Cache wird verworfen, sobald sich Pan/Zoom oder die Kontrollpunkte ändern.
|
||||
Gerade Linien (zwei Punkte ohne Griffe) werden direkt als zwei Punkte
|
||||
gezeichnet. Im Stresstest (480 Segmente, 12 Sections) sinkt die mittlere
|
||||
Redraw-Zeit dadurch von ca. 48 ms auf ca. 7–10 ms.
|
||||
|
||||
### Touch-Ziele
|
||||
|
||||
Mindestens 56 × 56 px. Für Desktop-Tests kann temporär
|
||||
`input_devices/pointing/emulate_touch_from_mouse=true` aktiviert werden;
|
||||
standardmäßig bleibt es aus.
|
||||
standardmäßig bleibt es aus. Chrome sendet zusätzlich synthetische
|
||||
Maus-Events: eines vor `touchstart` (wird beim Touch-Start verworfen) und
|
||||
ggf. eines nach `touchend` (300-ms-Guard).
|
||||
|
||||
## 6. Export und Persistenz
|
||||
|
||||
|
|
@ -191,9 +224,11 @@ standardmäßig bleibt es aus.
|
|||
- **Autosave** schreibt nach 1,5 s Inaktivität nach `user://autosave.tres`
|
||||
und wird beim Start automatisch wiederhergestellt. Der Dirty-State wird im
|
||||
Fenstertitel als `*` angezeigt. Beim Verlassen wird zusätzlich gespeichert.
|
||||
- **Web:** `FileAccess` schreibt in den IndexedDB-Speicher. Die Persistenz
|
||||
funktioniert dort über `user://`; ein echter Browser-/Tablet-Test steht
|
||||
noch aus.
|
||||
- **Web:** `FileAccess` schreibt in den IndexedDB-Speicher. Im echten
|
||||
Chrome-Touch-Test auf einem 1024-px- und einem 1400-px-Layout (DPR 2)
|
||||
überlebt die Kür einen Browser-Reload.
|
||||
- **Web-Build:** `tools/export_web.sh` exportiert nach `build/web/`
|
||||
(single-threaded, kein COOP/COEP nötig). Details in `docs/web-test.md`.
|
||||
|
||||
## 7. Tests
|
||||
|
||||
|
|
@ -225,6 +260,12 @@ Aktueller Stand:
|
|||
Kalibrierung, Undo, Persistenz und Schema-1-Migration.
|
||||
- **Export:** 17 Assertions für SVG-Struktur, Titel-Escaping, Section-Filter,
|
||||
Segmentfarben/-strichelung und das Schreiben der Exportdatei.
|
||||
- **Touch/Tablet:** 21 Assertions für Ein-Finger-Zeichnen, Zwei-Finger-Pan,
|
||||
Pinch-Zoom, Tipp-Auswahl, Griff-Bearbeitung, Abbruch bei zweitem Finger,
|
||||
Unterdrückung synthetischer Maus-Events aus Chrome sowie das responsive
|
||||
Leistenlayout bei 1024 und 1400 px.
|
||||
- **Performance:** Stresstest mit 480 Segmenten in 12 Sections; die mittlere
|
||||
Redraw-Zeit muss unter 120 ms bleiben (aktuell ca. 7–10 ms).
|
||||
|
||||
Autosave/Restore wird zusätzlich in einem isolierten `XDG_DATA_HOME`
|
||||
end-to-end geprüft.
|
||||
|
|
|
|||
|
|
@ -52,12 +52,14 @@ Voraussetzung für Phase 1.
|
|||
|
||||
### Nächster Schritt: Touch-/Tablet-/Web-Härtung
|
||||
|
||||
- [ ] Test auf echtem Tablet
|
||||
- [ ] Web-Export mit Compatibility-Renderer
|
||||
- [ ] Kleine Displays und Hochformat prüfen
|
||||
- [ ] Touch-Ziele, Gesten und Scrollverhalten prüfen
|
||||
- [ ] Performance bei vielen Segmenten und Sections
|
||||
- [ ] Persistenz auf Web/IndexedDB verifizieren
|
||||
- [x] Web-Export mit Compatibility-Renderer (`tools/export_web.sh`)
|
||||
- [x] Touch-Ziele auf 56 px erhöht, Chrome-Doppel-Segment-Guard
|
||||
- [x] Kleine Displays (1024 px) und kompakte Leiste geprüft
|
||||
- [x] Performance bei vielen Segmenten und Sections (Cache + Stresstest)
|
||||
- [x] Persistenz auf Web/IndexedDB verifizieren (Reload-Test)
|
||||
- [ ] Test auf echtem Tablet (Galaxy Tab S9+)
|
||||
- [ ] Hochformat-Layout (nur prüfen, falls benötigt)
|
||||
- [ ] Optional: iPad/Safari-Test
|
||||
|
||||
### Danach: Element-Marker
|
||||
|
||||
|
|
|
|||
95
docs/web-test.md
Normal file
95
docs/web-test.md
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# Web-/Tablet-Test
|
||||
|
||||
Zielgerät: **Samsung Galaxy Tab S9+**, Android, Chrome, Landscape.
|
||||
Zusätzlich geprüft: **1024 × 768 CSS-Pixel** (iPad-Landscape-Größe) und
|
||||
Desktop-Chromium.
|
||||
|
||||
## 1. Voraussetzungen
|
||||
|
||||
- Godot 4.7.2 (oder eine kompatible 4.x-Version) mit installierten
|
||||
**Web-Export-Templates** derselben Version.
|
||||
- Auf diesem Rechner waren bei der Einrichtung nur die 4.6-Web-Templates
|
||||
installiert; der erste Testbuild lief deshalb mit Godot 4.6. Für den
|
||||
finalen Build die 4.7.2-Templates über den Godot-Editor installieren
|
||||
(`Editor → Manage Export Templates`).
|
||||
|
||||
## 2. Web-Build erzeugen
|
||||
|
||||
```bash
|
||||
./tools/export_web.sh
|
||||
```
|
||||
|
||||
Das Skript importiert das Projekt und schreibt den Build nach:
|
||||
|
||||
```
|
||||
build/web/index.html
|
||||
```
|
||||
|
||||
`build/` ist nicht versioniert. Der Export ist **single-threaded** und braucht
|
||||
keine COOP/COEP-Header. Der Web-Renderer ist `gl_compatibility` (WebGL 2).
|
||||
|
||||
## 3. Lokal testen
|
||||
|
||||
```bash
|
||||
python3 -m http.server 8000 --directory build/web
|
||||
```
|
||||
|
||||
Auf dem Tablet im gleichen WLAN öffnen:
|
||||
|
||||
```
|
||||
http://<IP-des-Rechners>:8000/
|
||||
```
|
||||
|
||||
Die IP z. B. mit `ip addr` oder `hostname -I` ermitteln.
|
||||
|
||||
## 4. Testcheckliste auf dem Tablet
|
||||
|
||||
- [ ] Start im Landscape-Modus, Canvas füllt den Bildschirm
|
||||
- [ ] Ein-Finger-Ziehen zeichnet genau ein Segment (kein Doppel-Segment)
|
||||
- [ ] Zwei-Finger-Ziehen pannt
|
||||
- [ ] Pinch zoomt
|
||||
- [ ] Tippen im Modus „Auswählen“ wählt ein Segment
|
||||
- [ ] Start-/Endpunkt- und Bogen-Griffe lassen sich mit dem Finger ziehen
|
||||
- [ ] Richtung/Kante über die Toolbar ändern
|
||||
- [ ] Sections anlegen, wechseln, umbenennen, sortieren
|
||||
- [ ] Timing-Leiste: Dauer/Tempo ändern, Profil wählen, Kalibrieren
|
||||
- [ ] Playback: Start/Pause/Reset, Timeline-Scrub, Geschwindigkeit
|
||||
- [ ] Speichern/Laden über das Datei-Menü
|
||||
- [ ] Autosave: Seite neu laden → Kür ist wieder da
|
||||
- [ ] SVG- und PNG-Export erzeugen und Datei öffnen
|
||||
- [ ] Keine abgeschnittenen Buttons, kein horizontales Scrollen
|
||||
|
||||
## 5. UI-Skalierung im Browser
|
||||
|
||||
Der Web-Build läuft mit `window/stretch/mode="disabled"`. Godot legt das
|
||||
Canvas in Gerätepixeln an (bei DPR 2 also 2800 × 1580 für 1400 × 790 CSS).
|
||||
Der Controller setzt deshalb `Window.content_scale_factor` auf
|
||||
`DisplayServer.screen_get_scale()` (im Browser = `devicePixelRatio`). Damit
|
||||
gilt:
|
||||
|
||||
- Layout-Einheit = CSS-Pixel; ein 56-px-Button ist 56 CSS-Pixel groß.
|
||||
- Rendering bleibt scharf (2× Backing Store auf dem Tablet).
|
||||
- Ab 1280 CSS-Pixel erscheinen die vollen Beschriftungen, darunter die
|
||||
kompakte Leiste („Undo“, „Redo“, „Kalib.“, ohne Titel).
|
||||
|
||||
## 6. Bereits geprüft (Chromium, echtes Touch-Event)
|
||||
|
||||
- WebGL2/Compatibility-Renderer startet ohne Konsolenfehler
|
||||
- Ein Chrome-Touch-Drag erzeugt genau **ein** Segment; das synthetische
|
||||
Maus-Event vor `touchstart` wird verworfen, ein spätes nach `touchend`
|
||||
ebenfalls (300-ms-Guard)
|
||||
- Autosave/IndexedDB: Reload stellt die Kür wieder her (1024 und 1400 px)
|
||||
- Layout bei 1024 × 768 (kompakt) und 1400 × 790 (voll) ohne Abschneiden
|
||||
- Touch-Ziele 56 × 56 px; Menü/Undo/Redo sind Textbuttons, damit
|
||||
Web-Font-Fallbacks keine Kästchen erzeugen
|
||||
- Performance: 480 Segmente / 12 Sections ≈ 7–10 ms pro Redraw (headless,
|
||||
ohne GPU-Zeichnung)
|
||||
|
||||
## 7. Bekannte Grenzen
|
||||
|
||||
- **Hochformat** (< 1024 px Breite) ist noch nicht gestaltet; die
|
||||
Werkzeugleiste wäre dort zu breit. Ziel bleibt Landscape.
|
||||
- Safari/iOS ist noch nicht getestet. Der Build ist thread-frei und nutzt
|
||||
WebGL2, also grundsätzlich lauffähig; separat zu prüfen sind
|
||||
Touch-Event-Reihenfolge, IndexedDB-Limits und Safe-Area im Landscape.
|
||||
- Audio wird in Phase 1 nicht genutzt.
|
||||
35
rinkplanner/export_presets.cfg
Normal file
35
rinkplanner/export_presets.cfg
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
[preset.0]
|
||||
|
||||
name="Web"
|
||||
platform="Web"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="build/web/index.html"
|
||||
patches=PackedStringArray()
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
seed=0
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
variant/extensions_support=false
|
||||
variant/thread_support=false
|
||||
vram_texture_compression/for_desktop=false
|
||||
vram_texture_compression/for_mobile=false
|
||||
html/export_icon=true
|
||||
html/custom_html_shell=""
|
||||
html/head_include=""
|
||||
html/canvas_resize_policy=2
|
||||
html/focus_canvas_on_start=true
|
||||
html/experimental_virtual_keyboard=false
|
||||
progressive_web_app/enabled=false
|
||||
|
|
@ -34,9 +34,9 @@ zoom_out={
|
|||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1920
|
||||
window/size/viewport_height=1200
|
||||
window/stretch/mode="canvas_items"
|
||||
window/size/viewport_width=1440
|
||||
window/size/viewport_height=900
|
||||
window/stretch/mode="disabled"
|
||||
window/stretch/aspect="expand"
|
||||
|
||||
[rendering]
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ grow_vertical = 2
|
|||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="TopBar" type="PanelContainer" parent="Layout"]
|
||||
custom_minimum_size = Vector2(0, 72)
|
||||
custom_minimum_size = Vector2(0, 80)
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_top")
|
||||
|
||||
|
|
@ -70,6 +70,7 @@ layout_mode = 2
|
|||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Title" type="Label" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.882353, 0.909804, 0.941176, 1)
|
||||
theme_override_font_sizes/font_size = 22
|
||||
|
|
@ -78,25 +79,26 @@ vertical_alignment = 1
|
|||
|
||||
[node name="FileMenuButton" type="MenuButton" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
custom_minimum_size = Vector2(80, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "☰"
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Datei"
|
||||
tooltip_text = "Datei"
|
||||
|
||||
[node name="TitleSeparator" type="VSeparator" parent="Layout/TopBar/Tools"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ToolLabel" type="Label" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Werkzeug"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ToolOption" type="OptionButton" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(170, 48)
|
||||
custom_minimum_size = Vector2(170, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
|
||||
|
|
@ -105,7 +107,7 @@ layout_mode = 2
|
|||
|
||||
[node name="ForwardButton" type="Button" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(96, 48)
|
||||
custom_minimum_size = Vector2(96, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
toggle_mode = true
|
||||
|
|
@ -115,7 +117,7 @@ text = "Vorwärts"
|
|||
|
||||
[node name="BackwardButton" type="Button" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(96, 48)
|
||||
custom_minimum_size = Vector2(96, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
toggle_mode = true
|
||||
|
|
@ -127,7 +129,7 @@ layout_mode = 2
|
|||
|
||||
[node name="InsideButton" type="Button" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(80, 48)
|
||||
custom_minimum_size = Vector2(80, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
toggle_mode = true
|
||||
|
|
@ -136,7 +138,7 @@ text = "Innen"
|
|||
|
||||
[node name="OutsideButton" type="Button" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(80, 48)
|
||||
custom_minimum_size = Vector2(80, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
toggle_mode = true
|
||||
|
|
@ -150,25 +152,25 @@ size_flags_horizontal = 3
|
|||
|
||||
[node name="UndoButton" type="Button" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
custom_minimum_size = Vector2(100, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 20
|
||||
theme_override_font_sizes/font_size = 15
|
||||
disabled = true
|
||||
text = "↶"
|
||||
text = "Rückgängig"
|
||||
tooltip_text = "Rückgängig (Strg+Z)"
|
||||
|
||||
[node name="RedoButton" type="Button" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
custom_minimum_size = Vector2(110, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 20
|
||||
theme_override_font_sizes/font_size = 15
|
||||
disabled = true
|
||||
text = "↷"
|
||||
text = "Wiederholen"
|
||||
tooltip_text = "Wiederholen (Strg+Shift+Z)"
|
||||
|
||||
[node name="FitButton" type="Button" parent="Layout/TopBar/Tools"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(96, 48)
|
||||
custom_minimum_size = Vector2(96, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "Einpassen"
|
||||
|
|
@ -187,6 +189,7 @@ size_flags_vertical = 3
|
|||
script = ExtResource("2_canvas")
|
||||
|
||||
[node name="SectionsPanel" type="PanelContainer" parent="Layout/Content"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(300, 0)
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_sections")
|
||||
|
|
@ -212,7 +215,7 @@ size_flags_horizontal = 3
|
|||
|
||||
[node name="AddSectionButton" type="Button" parent="Layout/Content/SectionsPanel/SectionsVBox/Header"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
custom_minimum_size = Vector2(56, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "+"
|
||||
|
|
@ -239,18 +242,18 @@ theme_override_constants/separation = 6
|
|||
|
||||
[node name="MoveUpButton" type="Button" parent="Layout/Content/SectionsPanel/SectionsVBox/Footer/MoveRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Hoch"
|
||||
|
||||
[node name="MoveDownButton" type="Button" parent="Layout/Content/SectionsPanel/SectionsVBox/Footer/MoveRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Runter"
|
||||
|
||||
[node name="EditRow" type="HBoxContainer" parent="Layout/Content/SectionsPanel/SectionsVBox/Footer"]
|
||||
|
|
@ -259,58 +262,53 @@ theme_override_constants/separation = 6
|
|||
|
||||
[node name="RenameButton" type="Button" parent="Layout/Content/SectionsPanel/SectionsVBox/Footer/EditRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Umbenennen"
|
||||
|
||||
[node name="DeleteButton" type="Button" parent="Layout/Content/SectionsPanel/SectionsVBox/Footer/EditRow"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Abschnitt löschen"
|
||||
|
||||
[node name="TimingBar" type="PanelContainer" parent="Layout"]
|
||||
custom_minimum_size = Vector2(0, 64)
|
||||
custom_minimum_size = Vector2(0, 72)
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_playback")
|
||||
|
||||
[node name="TimingContent" type="HBoxContainer" parent="Layout/TimingBar"]
|
||||
[node name="TimingContent" type="HFlowContainer" parent="Layout/TimingBar"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
theme_override_constants/h_separation = 8
|
||||
theme_override_constants/v_separation = 6
|
||||
|
||||
[node name="TimingTitle" type="Label" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Timing"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="TimingSelectionLabel" type="Label" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(170, 48)
|
||||
custom_minimum_size = Vector2(170, 56)
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.85098, 0.890196, 0.941176, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Kein Segment ausgewählt"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="TimingSeparator1" type="VSeparator" parent="Layout/TimingBar/TimingContent"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DurationLabel" type="Label" parent="Layout/TimingBar/TimingContent"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
text = "Dauer"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="DurationMinusButton" type="Button" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
custom_minimum_size = Vector2(56, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 18
|
||||
disabled = true
|
||||
|
|
@ -319,17 +317,17 @@ tooltip_text = "Dauer verringern"
|
|||
|
||||
[node name="DurationValueLabel" type="Label" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(64, 48)
|
||||
custom_minimum_size = Vector2(58, 56)
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.85098, 0.890196, 0.941176, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "…"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="DurationPlusButton" type="Button" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
custom_minimum_size = Vector2(56, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 18
|
||||
disabled = true
|
||||
|
|
@ -339,16 +337,9 @@ tooltip_text = "Dauer erhöhen"
|
|||
[node name="TimingSeparator2" type="VSeparator" parent="Layout/TimingBar/TimingContent"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SpeedLabel" type="Label" parent="Layout/TimingBar/TimingContent"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
text = "Tempo"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="SpeedMinusButton" type="Button" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
custom_minimum_size = Vector2(56, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 18
|
||||
disabled = true
|
||||
|
|
@ -357,17 +348,17 @@ tooltip_text = "Tempo verringern"
|
|||
|
||||
[node name="SpeedValueLabel" type="Label" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(78, 48)
|
||||
custom_minimum_size = Vector2(72, 56)
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.85098, 0.890196, 0.941176, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "…"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="SpeedPlusButton" type="Button" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(48, 48)
|
||||
custom_minimum_size = Vector2(56, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 18
|
||||
disabled = true
|
||||
|
|
@ -379,31 +370,31 @@ layout_mode = 2
|
|||
|
||||
[node name="ProfileOption" type="OptionButton" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(140, 48)
|
||||
custom_minimum_size = Vector2(140, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
tooltip_text = "Geschwindigkeitsprofil für Auswahl bzw. neue Segmente"
|
||||
|
||||
[node name="CalibrateButton" type="Button" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(100, 48)
|
||||
custom_minimum_size = Vector2(100, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
disabled = true
|
||||
text = "Kalibrieren"
|
||||
tooltip_text = "Geschwindigkeit aus Strecke und gemessener Zeit berechnen"
|
||||
|
||||
[node name="ResetTimingButton" type="Button" parent="Layout/TimingBar/TimingContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(90, 48)
|
||||
custom_minimum_size = Vector2(90, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
disabled = true
|
||||
text = "Standard"
|
||||
tooltip_text = "Auf Adult Gold (4,3 m/s) zurücksetzen"
|
||||
|
||||
[node name="PlaybackBar" type="PanelContainer" parent="Layout"]
|
||||
custom_minimum_size = Vector2(0, 64)
|
||||
custom_minimum_size = Vector2(0, 72)
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_playback")
|
||||
|
||||
|
|
@ -413,35 +404,35 @@ theme_override_constants/separation = 8
|
|||
|
||||
[node name="PlayButton" type="Button" parent="Layout/PlaybackBar/PlaybackContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(80, 48)
|
||||
custom_minimum_size = Vector2(80, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
disabled = true
|
||||
text = "Start"
|
||||
tooltip_text = "Abspielen"
|
||||
|
||||
[node name="ResetPlaybackButton" type="Button" parent="Layout/PlaybackBar/PlaybackContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(80, 48)
|
||||
custom_minimum_size = Vector2(80, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
disabled = true
|
||||
text = "Reset"
|
||||
tooltip_text = "Zurücksetzen"
|
||||
|
||||
[node name="PlaybackTimeLabel" type="Label" parent="Layout/PlaybackBar/PlaybackContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(150, 48)
|
||||
custom_minimum_size = Vector2(150, 56)
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.85098, 0.890196, 0.941176, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "0,0 / 0,0 s"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="PlaybackTimeline" type="HSlider" parent="Layout/PlaybackBar/PlaybackContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
max_value = 0.0
|
||||
|
|
@ -450,13 +441,13 @@ editable = false
|
|||
|
||||
[node name="SpeedOption" type="OptionButton" parent="Layout/PlaybackBar/PlaybackContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(100, 48)
|
||||
custom_minimum_size = Vector2(100, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
tooltip_text = "Wiedergabegeschwindigkeit"
|
||||
|
||||
[node name="StatusBar" type="PanelContainer" parent="Layout"]
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
custom_minimum_size = Vector2(0, 64)
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_status")
|
||||
|
||||
|
|
@ -469,15 +460,15 @@ unique_name_in_owner = true
|
|||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Abschnitt 1 · 0 Segmente"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="DeleteSegmentButton" type="Button" parent="Layout/StatusBar/StatusBarContent"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(160, 48)
|
||||
custom_minimum_size = Vector2(160, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_font_sizes/font_size = 15
|
||||
disabled = true
|
||||
text = "Segment löschen"
|
||||
|
||||
|
|
@ -501,7 +492,7 @@ text = "Neuer Name"
|
|||
|
||||
[node name="RenameEdit" type="LineEdit" parent="RenameDialog/RenameBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DeleteDialog" type="ConfirmationDialog" parent="."]
|
||||
|
|
@ -536,7 +527,7 @@ text = "Name der Kür"
|
|||
|
||||
[node name="SaveNameEdit" type="LineEdit" parent="SaveAsDialog/SaveAsBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="OpenDialog" type="AcceptDialog" parent="."]
|
||||
|
|
@ -601,7 +592,7 @@ text = "Strecke (m)"
|
|||
|
||||
[node name="CalibrationDistanceEdit" type="LineEdit" parent="CalibrationDialog/CalibrationBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CalibrationTimeLabel" type="Label" parent="CalibrationDialog/CalibrationBox"]
|
||||
|
|
@ -610,7 +601,7 @@ text = "Gemessene Zeit (s)"
|
|||
|
||||
[node name="CalibrationTimeEdit" type="LineEdit" parent="CalibrationDialog/CalibrationBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CalibrationHint" type="Label" parent="CalibrationDialog/CalibrationBox"]
|
||||
|
|
@ -639,7 +630,7 @@ text = "Dateiname"
|
|||
|
||||
[node name="ExportNameEdit" type="LineEdit" parent="ExportDialog/ExportBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ExportFormatLabel" type="Label" parent="ExportDialog/ExportBox"]
|
||||
|
|
@ -648,7 +639,7 @@ text = "Format"
|
|||
|
||||
[node name="ExportFormatOption" type="OptionButton" parent="ExportDialog/ExportBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ExportScopeLabel" type="Label" parent="ExportDialog/ExportBox"]
|
||||
|
|
@ -657,7 +648,7 @@ text = "Umfang"
|
|||
|
||||
[node name="ExportScopeOption" type="OptionButton" parent="ExportDialog/ExportBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ExportHint" type="Label" parent="ExportDialog/ExportBox"]
|
||||
|
|
|
|||
|
|
@ -44,12 +44,17 @@ const EXPORT_IMAGE_SIZE := Vector2i(2560, 1600)
|
|||
const AUTOSAVE_PATH := "user://autosave.tres"
|
||||
const AUTOSAVE_DELAY_SECONDS := 1.5
|
||||
const MAX_HISTORY := 50
|
||||
const COMPACT_LAYOUT_WIDTH := 1280.0
|
||||
|
||||
## Tests disable these before adding the scene to the tree.
|
||||
@export var restore_autosave: bool = true
|
||||
@export var autosave_enabled: bool = true
|
||||
|
||||
@onready var rink_canvas: RinkCanvas = %RinkCanvas
|
||||
@onready var title_label: Label = %Title
|
||||
@onready var tool_label: Label = %ToolLabel
|
||||
@onready var timing_title: Label = %TimingTitle
|
||||
@onready var sections_panel: PanelContainer = %SectionsPanel
|
||||
@onready var tool_option: OptionButton = %ToolOption
|
||||
@onready var forward_button: Button = %ForwardButton
|
||||
@onready var backward_button: Button = %BackwardButton
|
||||
|
|
@ -187,6 +192,10 @@ func _ready() -> void:
|
|||
calibration_dialog.confirmed.connect(_on_calibration_confirmed)
|
||||
export_dialog.confirmed.connect(_on_export_confirmed)
|
||||
|
||||
resized.connect(_apply_responsive_layout)
|
||||
_apply_display_scale()
|
||||
_apply_responsive_layout.call_deferred()
|
||||
|
||||
_ensure_routines_dir()
|
||||
if not (restore_autosave and _try_load_autosave()):
|
||||
new_routine()
|
||||
|
|
@ -1587,6 +1596,42 @@ func _setup_export_controls() -> void:
|
|||
export_scope_option.select(0)
|
||||
|
||||
|
||||
func _apply_display_scale() -> void:
|
||||
var window := get_window()
|
||||
if window == null:
|
||||
return
|
||||
|
||||
# Touch-first UI: keep the logical layout at CSS-pixel size so 56 px
|
||||
# controls stay 56 CSS px on high-density tablets. Without this the web
|
||||
# build lays out in device pixels and every control shrinks by the DPR.
|
||||
var factor := maxf(1.0, DisplayServer.screen_get_scale())
|
||||
if not is_equal_approx(window.content_scale_factor, factor):
|
||||
window.content_scale_factor = factor
|
||||
|
||||
|
||||
func _apply_responsive_layout() -> void:
|
||||
if title_label == null or tool_label == null:
|
||||
return
|
||||
|
||||
_apply_display_scale()
|
||||
|
||||
var compact := size.x < COMPACT_LAYOUT_WIDTH
|
||||
title_label.visible = not compact
|
||||
tool_label.visible = not compact
|
||||
timing_title.visible = not compact
|
||||
sections_panel.custom_minimum_size.x = 260.0 if compact else 300.0
|
||||
|
||||
undo_button.text = "Undo" if compact else "Rückgängig"
|
||||
redo_button.text = "Redo" if compact else "Wiederholen"
|
||||
undo_button.custom_minimum_size.x = 76.0 if compact else 100.0
|
||||
redo_button.custom_minimum_size.x = 76.0 if compact else 110.0
|
||||
tool_option.custom_minimum_size.x = 150.0 if compact else 170.0
|
||||
calibrate_button.text = "Kalib." if compact else "Kalibrieren"
|
||||
calibrate_button.custom_minimum_size.x = 80.0 if compact else 100.0
|
||||
timing_selection_label.custom_minimum_size.x = 120.0 if compact else 170.0
|
||||
profile_option.custom_minimum_size.x = 120.0 if compact else 140.0
|
||||
|
||||
|
||||
func _open_export_dialog() -> void:
|
||||
if _routine == null:
|
||||
return
|
||||
|
|
@ -1700,7 +1745,7 @@ func _refresh_open_list() -> void:
|
|||
for file: String in entries:
|
||||
var button := Button.new()
|
||||
button.text = file.get_basename()
|
||||
button.custom_minimum_size = Vector2(0.0, 48.0)
|
||||
button.custom_minimum_size = Vector2(0.0, 56.0)
|
||||
button.alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
button.clip_text = true
|
||||
button.pressed.connect(
|
||||
|
|
@ -1769,7 +1814,7 @@ func _rebuild_section_list() -> void:
|
|||
button.button_pressed = section.section_id == _active_section.section_id
|
||||
button.text = "%d · %s" % [index + 1, section.title]
|
||||
button.tooltip_text = section.title
|
||||
button.custom_minimum_size = Vector2(0.0, 48.0)
|
||||
button.custom_minimum_size = Vector2(0.0, 56.0)
|
||||
button.alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
button.clip_text = true
|
||||
button.pressed.connect(_on_section_button_pressed.bind(section.section_id))
|
||||
|
|
|
|||
|
|
@ -40,10 +40,12 @@ const CENTER_CIRCLE_RADIUS_M := 4.5
|
|||
const CENTER_CIRCLE_SEGMENTS := 64
|
||||
const GHOST_ALPHA := 0.2
|
||||
const CURVE_SAMPLE_STEP_PX := 3.0
|
||||
const GHOST_SAMPLE_STEP_PX := 8.0
|
||||
const MAX_CURVE_SAMPLES := 2000
|
||||
const SEGMENT_HIT_RADIUS_PX := 14.0
|
||||
const HANDLE_HIT_RADIUS_PX := 22.0
|
||||
const HANDLE_RADIUS_PX := 7.0
|
||||
const TOUCH_MOUSE_GUARD_MSEC := 300
|
||||
|
||||
@export var fit_padding_px: float = 32.0
|
||||
@export var drawing_enabled: bool = true
|
||||
|
|
@ -60,6 +62,7 @@ var _auto_fit: bool = true
|
|||
var _panning: bool = false
|
||||
var _drawing: bool = false
|
||||
var _touch_points: Dictionary[int, Vector2] = {}
|
||||
var _ignore_mouse_until_msec: int = 0
|
||||
var _draw_touch_index: int = -1
|
||||
var _pan_touch_index: int = -1
|
||||
var _pinch_center: Vector2 = Vector2.ZERO
|
||||
|
|
@ -79,6 +82,12 @@ var _playback_section_id: String = ""
|
|||
var _playback_edge: PathSegment.Edge = PathSegment.Edge.OUTSIDE
|
||||
var _playback_direction: PathSegment.Direction = PathSegment.Direction.FORWARD
|
||||
|
||||
# Screen-space polyline cache. During playback only the marker moves, so the
|
||||
# sampled paths can be reused instead of re-baking every curve each frame.
|
||||
var _curve_cache: Dictionary[int, Dictionary] = {}
|
||||
var _curve_cache_scale: float = -1.0
|
||||
var _curve_cache_origin: Vector2 = Vector2.INF
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
focus_mode = Control.FOCUS_ALL
|
||||
|
|
@ -102,6 +111,7 @@ func get_rink() -> RinkDimensions:
|
|||
|
||||
func set_routine(routine: Routine, refit: bool = true) -> void:
|
||||
_routine = routine
|
||||
_curve_cache.clear()
|
||||
if routine != null and routine.rink != null:
|
||||
_rink = routine.rink
|
||||
if _active_section_id.is_empty() and routine != null and not routine.sections.is_empty():
|
||||
|
|
@ -384,13 +394,18 @@ func _draw_playback_marker() -> void:
|
|||
|
||||
|
||||
func _draw_section(section: RoutineSection, alpha: float) -> void:
|
||||
var step_px := GHOST_SAMPLE_STEP_PX if alpha < 1.0 else CURVE_SAMPLE_STEP_PX
|
||||
for segment: PathSegment in section.segments:
|
||||
if segment != null and segment.curve != null:
|
||||
_draw_segment(segment, alpha)
|
||||
_draw_segment(segment, alpha, step_px)
|
||||
|
||||
|
||||
func _draw_segment(segment: PathSegment, alpha: float) -> void:
|
||||
var points := _sample_curve_screen(segment.curve)
|
||||
func _draw_segment(
|
||||
segment: PathSegment,
|
||||
alpha: float,
|
||||
step_px: float = CURVE_SAMPLE_STEP_PX
|
||||
) -> void:
|
||||
var points := _sample_curve_screen(segment.curve, step_px)
|
||||
if points.is_empty():
|
||||
return
|
||||
|
||||
|
|
@ -418,7 +433,7 @@ func _draw_selection_highlight() -> void:
|
|||
if segment == null:
|
||||
return
|
||||
|
||||
var points := _sample_curve_screen(segment.curve)
|
||||
var points := _sample_segment_screen(segment)
|
||||
if points.size() < 2:
|
||||
return
|
||||
|
||||
|
|
@ -434,7 +449,7 @@ func _draw_selection_handles() -> void:
|
|||
if segment == null:
|
||||
return
|
||||
|
||||
var points := _sample_curve_screen(segment.curve)
|
||||
var points := _sample_segment_screen(segment)
|
||||
if points.is_empty():
|
||||
return
|
||||
|
||||
|
|
@ -515,23 +530,89 @@ func _draw_arrow_head(points: PackedVector2Array, color: Color) -> void:
|
|||
)
|
||||
|
||||
|
||||
func _sample_curve_screen(curve: Curve2D) -> PackedVector2Array:
|
||||
func _sample_curve_screen(
|
||||
curve: Curve2D,
|
||||
step_px: float = CURVE_SAMPLE_STEP_PX
|
||||
) -> PackedVector2Array:
|
||||
if curve.point_count == 2 and _is_straight_curve(curve):
|
||||
# Fast path: two points without handles are a plain line. Sampling the
|
||||
# baked curve would produce hundreds of redundant points.
|
||||
return PackedVector2Array([
|
||||
_transform.model_to_screen(curve.get_point_position(0)),
|
||||
_transform.model_to_screen(curve.get_point_position(1)),
|
||||
])
|
||||
|
||||
var curve_length := curve.get_baked_length()
|
||||
if curve_length <= 0.0:
|
||||
if curve.point_count == 0:
|
||||
return PackedVector2Array()
|
||||
return PackedVector2Array([_transform.model_to_screen(curve.get_point_position(0))])
|
||||
|
||||
var step_m := maxf(0.01, CURVE_SAMPLE_STEP_PX / _transform.pixels_per_meter)
|
||||
var step_m := maxf(0.01, step_px / _transform.pixels_per_meter)
|
||||
var sample_count: int = clampi(ceili(curve_length / step_m), 1, MAX_CURVE_SAMPLES)
|
||||
var points := PackedVector2Array()
|
||||
points.resize(sample_count + 1)
|
||||
var scale := _transform.pixels_per_meter
|
||||
var origin := _transform.origin_px
|
||||
for index: int in range(sample_count + 1):
|
||||
var offset := curve_length * float(index) / float(sample_count)
|
||||
points[index] = _transform.model_to_screen(curve.sample_baked(offset))
|
||||
points[index] = origin + curve.sample_baked(offset) * scale
|
||||
return points
|
||||
|
||||
|
||||
## Cached variant of [method _sample_curve_screen]. The cache is keyed by the
|
||||
## segment instance and dropped whenever the view transform changes. A cheap
|
||||
## control-point signature detects geometry edits (dragging a handle), so the
|
||||
## cached polyline is never stale.
|
||||
func _sample_segment_screen(
|
||||
segment: PathSegment,
|
||||
step_px: float = CURVE_SAMPLE_STEP_PX
|
||||
) -> PackedVector2Array:
|
||||
if segment == null or segment.curve == null:
|
||||
return PackedVector2Array()
|
||||
|
||||
if (
|
||||
_curve_cache_scale != _transform.pixels_per_meter
|
||||
or _curve_cache_origin != _transform.origin_px
|
||||
):
|
||||
_curve_cache.clear()
|
||||
_curve_cache_scale = _transform.pixels_per_meter
|
||||
_curve_cache_origin = _transform.origin_px
|
||||
|
||||
var cache_key := segment.get_instance_id()
|
||||
var signature := _curve_signature(segment.curve, step_px)
|
||||
var cached: Dictionary = _curve_cache.get(cache_key, {})
|
||||
if not cached.is_empty() and cached.get("signature", 0) == signature:
|
||||
return cached["points"]
|
||||
|
||||
var points := _sample_curve_screen(segment.curve, step_px)
|
||||
if _curve_cache.size() > 4096:
|
||||
_curve_cache.clear()
|
||||
_curve_cache[cache_key] = {"signature": signature, "points": points}
|
||||
return points
|
||||
|
||||
|
||||
func _is_straight_curve(curve: Curve2D) -> bool:
|
||||
if curve.point_count != 2:
|
||||
return false
|
||||
return (
|
||||
curve.get_point_in(0).is_zero_approx()
|
||||
and curve.get_point_out(0).is_zero_approx()
|
||||
and curve.get_point_in(1).is_zero_approx()
|
||||
and curve.get_point_out(1).is_zero_approx()
|
||||
)
|
||||
|
||||
|
||||
func _curve_signature(curve: Curve2D, step_px: float) -> int:
|
||||
var signature := hash(float(step_px))
|
||||
for index: int in range(curve.point_count):
|
||||
var position := curve.get_point_position(index)
|
||||
signature = (signature * 31 + hash(position)) & 0x7ffffff
|
||||
signature = (signature * 31 + hash(curve.get_point_in(index))) & 0x7ffffff
|
||||
signature = (signature * 31 + hash(curve.get_point_out(index))) & 0x7ffffff
|
||||
return signature
|
||||
|
||||
|
||||
func _curve_apex_screen(curve: Curve2D) -> Vector2:
|
||||
var curve_length := curve.get_baked_length()
|
||||
if curve_length <= 0.0:
|
||||
|
|
@ -640,9 +721,12 @@ func _to_screen(model_points: PackedVector2Array) -> PackedVector2Array:
|
|||
|
||||
func _gui_input(event: InputEvent) -> void:
|
||||
# Touch input also produces emulated mouse events. While a finger is down,
|
||||
# the touch handlers own the gesture.
|
||||
if not _touch_points.is_empty():
|
||||
if event is InputEventMouseButton or event is InputEventMouseMotion:
|
||||
# the touch handlers own the gesture. Some browsers deliver the synthetic
|
||||
# mouse event only after touchend; guard against that short tail as well.
|
||||
if event is InputEventMouseButton or event is InputEventMouseMotion:
|
||||
if not _touch_points.is_empty():
|
||||
return
|
||||
if Time.get_ticks_msec() < _ignore_mouse_until_msec:
|
||||
return
|
||||
|
||||
if event is InputEventMouseButton:
|
||||
|
|
@ -772,6 +856,14 @@ func _handle_screen_touch(event: InputEventScreenTouch) -> void:
|
|||
if event.pressed:
|
||||
_touch_points[event.index] = event.position
|
||||
if _touch_points.size() == 1:
|
||||
# Chrome can emit a synthetic mouse press immediately before the
|
||||
# real touch press. Cancel that stray mouse gesture so it cannot
|
||||
# leave a second, unfinished segment behind.
|
||||
_abort_handle_drag()
|
||||
if _drawing:
|
||||
_cancel_drawing()
|
||||
_panning = false
|
||||
|
||||
if _selection_enabled:
|
||||
_begin_selection_press(event.position)
|
||||
if _handle_drag != Handle.NONE:
|
||||
|
|
@ -801,6 +893,7 @@ func _handle_screen_touch(event: InputEventScreenTouch) -> void:
|
|||
_pan_touch_index = -1
|
||||
|
||||
_touch_points.erase(event.index)
|
||||
_ignore_mouse_until_msec = Time.get_ticks_msec() + TOUCH_MOUSE_GUARD_MSEC
|
||||
if _touch_points.size() < 2:
|
||||
_reset_pinch_reference()
|
||||
if _touch_points.size() == 1:
|
||||
|
|
|
|||
|
|
@ -38,6 +38,19 @@ $GODOT --headless --path rinkplanner --script res://tests/run_timing_tests.gd
|
|||
|
||||
# Run SVG export tests
|
||||
$GODOT --headless --path rinkplanner --script res://tests/run_export_tests.gd
|
||||
|
||||
# Run touch gesture tests
|
||||
$GODOT --headless --path rinkplanner --script res://tests/run_touch_tests.gd
|
||||
|
||||
# Run canvas performance stress test
|
||||
$GODOT --headless --path rinkplanner --script res://tests/run_perf_tests.gd
|
||||
```
|
||||
|
||||
Manueller visueller Smoke-Test (Layout bei einer Fenstergröße prüfen):
|
||||
|
||||
```bash
|
||||
xvfb-run -a $GODOT --path rinkplanner \
|
||||
--script res://tests/manual/capture.gd -- 1024 768 /tmp/capture.png
|
||||
```
|
||||
|
||||
Exit code `0` means all assertions passed. Failures are printed to stderr.
|
||||
|
|
|
|||
37
rinkplanner/tests/manual/capture.gd
Normal file
37
rinkplanner/tests/manual/capture.gd
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
extends SceneTree
|
||||
|
||||
## Manual visual smoke test: renders the whiteboard at a given window size.
|
||||
##
|
||||
## Usage:
|
||||
## xvfb-run -a godot --path rinkplanner \
|
||||
## --script res://tests/manual/capture.gd -- 1024 768 /tmp/capture.png
|
||||
##
|
||||
## The output path is optional. This is a development tool, not part of
|
||||
## `tools/test.sh`; the headless suites cover the behaviour.
|
||||
|
||||
func _init() -> void:
|
||||
_capture.call_deferred()
|
||||
|
||||
|
||||
func _capture() -> void:
|
||||
var args := OS.get_cmdline_user_args()
|
||||
var width := int(args[0]) if args.size() > 0 else 1024
|
||||
var height := int(args[1]) if args.size() > 1 else 768
|
||||
var output := args[2] if args.size() > 2 else "user://capture.png"
|
||||
|
||||
var packed := load("res://scenes/whiteboard/whiteboard.tscn") as PackedScene
|
||||
var instance := packed.instantiate()
|
||||
var controller := instance as WhiteboardController
|
||||
if controller != null:
|
||||
controller.restore_autosave = false
|
||||
controller.autosave_enabled = false
|
||||
root.add_child(instance)
|
||||
root.size = Vector2i(width, height)
|
||||
await process_frame
|
||||
await process_frame
|
||||
await RenderingServer.frame_post_draw
|
||||
|
||||
var path := ProjectSettings.globalize_path(output)
|
||||
root.get_texture().get_image().save_png(path)
|
||||
print("Saved %s at %dx%d" % [path, width, height])
|
||||
quit(0)
|
||||
1
rinkplanner/tests/manual/capture.gd.uid
Normal file
1
rinkplanner/tests/manual/capture.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://w420v5ksey3v
|
||||
133
rinkplanner/tests/run_perf_tests.gd
Normal file
133
rinkplanner/tests/run_perf_tests.gd
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
extends SceneTree
|
||||
|
||||
## Performance stress test for the whiteboard canvas.
|
||||
##
|
||||
## Builds many sections and segments, then measures the cost of a forced
|
||||
## redraw. The bound is deliberately generous so the test stays useful on
|
||||
## slow machines; the goal is to catch accidental super-linear behaviour,
|
||||
## not to benchmark exact frame times.
|
||||
|
||||
const WhiteboardScene := preload("res://scenes/whiteboard/whiteboard.tscn")
|
||||
const EXTRA_SECTIONS := 11
|
||||
const SEGMENTS_PER_SECTION := 40
|
||||
const MAX_AVG_DRAW_MS := 120.0
|
||||
|
||||
var _assertions: int = 0
|
||||
var _failures: PackedStringArray = PackedStringArray()
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
_run.call_deferred()
|
||||
|
||||
|
||||
func _run() -> void:
|
||||
var scene := WhiteboardScene.instantiate()
|
||||
var controller := scene as WhiteboardController
|
||||
if controller == null:
|
||||
printerr("FAIL: scene is not a WhiteboardController")
|
||||
quit(1)
|
||||
return
|
||||
controller.restore_autosave = false
|
||||
controller.autosave_enabled = false
|
||||
root.add_child(scene)
|
||||
await process_frame
|
||||
await process_frame
|
||||
|
||||
var canvas := controller.rink_canvas
|
||||
var routine := controller.get_routine()
|
||||
_fill_section(controller.get_active_section(), 0)
|
||||
for index: int in range(1, EXTRA_SECTIONS + 1):
|
||||
_fill_section(controller.add_section(), index)
|
||||
|
||||
var expected := (EXTRA_SECTIONS + 1) * SEGMENTS_PER_SECTION
|
||||
var total_segments := 0
|
||||
for section: RoutineSection in routine.sections:
|
||||
total_segments += section.segments.size()
|
||||
_check(
|
||||
total_segments == expected,
|
||||
"stress routine has %d segments (got %d)" % [expected, total_segments]
|
||||
)
|
||||
|
||||
canvas.fit_rink()
|
||||
canvas.refresh()
|
||||
await process_frame
|
||||
|
||||
# Warm up font/theme caches before measuring.
|
||||
for _index: int in range(3):
|
||||
canvas.refresh()
|
||||
await process_frame
|
||||
|
||||
var samples: PackedFloat64Array = PackedFloat64Array()
|
||||
for _index: int in range(20):
|
||||
var started := Time.get_ticks_usec()
|
||||
canvas.refresh()
|
||||
await process_frame
|
||||
samples.append(float(Time.get_ticks_usec() - started) / 1000.0)
|
||||
|
||||
var total := 0.0
|
||||
for sample: float in samples:
|
||||
total += sample
|
||||
var average := total / float(samples.size())
|
||||
print(
|
||||
"Perf: %d segments in %d sections, average redraw %.2f ms"
|
||||
% [total_segments, routine.sections.size(), average]
|
||||
)
|
||||
_check(
|
||||
average < MAX_AVG_DRAW_MS,
|
||||
"average redraw stays below %.0f ms (got %.2f ms)"
|
||||
% [MAX_AVG_DRAW_MS, average]
|
||||
)
|
||||
|
||||
scene.queue_free()
|
||||
await process_frame
|
||||
_finish()
|
||||
|
||||
|
||||
func _fill_section(section: RoutineSection, lane_offset: int) -> void:
|
||||
var rink := RinkDimensions.new()
|
||||
var lane_count := maxi(1, SEGMENTS_PER_SECTION)
|
||||
var usable := rink.get_half_width() * 2.0 - 4.0
|
||||
for index: int in range(lane_count):
|
||||
var y := -rink.get_half_width() + 2.0 + usable * float(index) / float(lane_count)
|
||||
y += float(lane_offset) * 0.05
|
||||
var start := Vector2(-rink.get_half_length() + 6.0, y)
|
||||
var end := Vector2(rink.get_half_length() - 6.0, y + 0.2)
|
||||
var segment := PathSegment.new()
|
||||
segment.segment_id = "perf-%d-%d" % [lane_offset, index]
|
||||
segment.curve = Curve2D.new()
|
||||
if index % 3 == 0:
|
||||
segment.template = PathSegment.Template.ARC
|
||||
segment.arc_bulge_left = index % 2 == 0
|
||||
segment.arc_depth_ratio = 0.12
|
||||
var points := ArcGeometry.build_points(
|
||||
start, end, segment.arc_bulge_left, segment.arc_depth_ratio, rink
|
||||
)
|
||||
for point: Vector2 in points:
|
||||
segment.curve.add_point(point)
|
||||
else:
|
||||
segment.template = PathSegment.Template.LINE
|
||||
segment.curve.add_point(start)
|
||||
segment.curve.add_point(end)
|
||||
segment.direction = (
|
||||
PathSegment.Direction.BACKWARD if index % 5 == 0
|
||||
else PathSegment.Direction.FORWARD
|
||||
)
|
||||
section.segments.append(segment)
|
||||
|
||||
|
||||
func _check(condition: bool, message: String) -> void:
|
||||
_assertions += 1
|
||||
if not condition:
|
||||
_failures.append(message)
|
||||
|
||||
|
||||
func _finish() -> void:
|
||||
if _failures.is_empty():
|
||||
print("PASS: %d assertions" % _assertions)
|
||||
quit(0)
|
||||
return
|
||||
|
||||
for failure: String in _failures:
|
||||
printerr("FAIL: %s" % failure)
|
||||
printerr("%d of %d assertions failed" % [_failures.size(), _assertions])
|
||||
quit(1)
|
||||
1
rinkplanner/tests/run_perf_tests.gd.uid
Normal file
1
rinkplanner/tests/run_perf_tests.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://tokudpp114t6
|
||||
284
rinkplanner/tests/run_touch_tests.gd
Normal file
284
rinkplanner/tests/run_touch_tests.gd
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
extends SceneTree
|
||||
|
||||
## Headless tests for the touch gesture layer.
|
||||
##
|
||||
## Run with:
|
||||
## godot --headless --path rinkplanner --script res://tests/run_touch_tests.gd
|
||||
|
||||
const WhiteboardScene := preload("res://scenes/whiteboard/whiteboard.tscn")
|
||||
|
||||
var _assertions: int = 0
|
||||
var _failures: PackedStringArray = PackedStringArray()
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
_run.call_deferred()
|
||||
|
||||
|
||||
func _run() -> void:
|
||||
var scene := WhiteboardScene.instantiate()
|
||||
var controller := scene as WhiteboardController
|
||||
if controller != null:
|
||||
controller.restore_autosave = false
|
||||
controller.autosave_enabled = false
|
||||
root.add_child(scene)
|
||||
await process_frame
|
||||
|
||||
_check(controller != null, "touch scene has a controller")
|
||||
if controller == null:
|
||||
_finish()
|
||||
return
|
||||
|
||||
var canvas := controller.rink_canvas
|
||||
var view := canvas.get_view_transform()
|
||||
var section := controller.get_active_section()
|
||||
_check(
|
||||
canvas.size.x > 0.0 and canvas.size.y > 0.0,
|
||||
"canvas receives a touch layout size"
|
||||
)
|
||||
|
||||
# One-finger drawing.
|
||||
controller.set_tool(WhiteboardController.Tool.LINE)
|
||||
var count_before_draw := section.segments.size()
|
||||
var draw_start := view.model_to_screen(Vector2(-10.0, 5.0))
|
||||
var draw_end := view.model_to_screen(Vector2(0.0, 5.0))
|
||||
_touch(canvas, 0, draw_start, true)
|
||||
_drag(canvas, 0, draw_end, draw_end - draw_start)
|
||||
_touch(canvas, 0, draw_end, false)
|
||||
|
||||
_check(
|
||||
section.segments.size() == count_before_draw + 1,
|
||||
"one-finger drag draws a segment"
|
||||
)
|
||||
var drawn := section.segments[section.segments.size() - 1]
|
||||
_check(drawn.get_length_m() > 9.5, "touch-drawn segment has the drag length")
|
||||
|
||||
# Chrome emits a synthetic mouse press immediately before the touch press.
|
||||
# The touch press must cancel that stray mouse segment.
|
||||
canvas._ignore_mouse_until_msec = 0
|
||||
controller.set_tool(WhiteboardController.Tool.LINE)
|
||||
var count_before_combined := section.segments.size()
|
||||
var combined_start := view.model_to_screen(Vector2(-8.0, -3.0))
|
||||
var combined_end := view.model_to_screen(Vector2(2.0, -3.0))
|
||||
_mouse_button(canvas, combined_start, true)
|
||||
_touch(canvas, 0, combined_start, true)
|
||||
_drag(canvas, 0, combined_end, combined_end - combined_start)
|
||||
_touch(canvas, 0, combined_end, false)
|
||||
_check(
|
||||
section.segments.size() == count_before_combined + 1,
|
||||
"touch replaces the preceding synthetic mouse segment"
|
||||
)
|
||||
controller.set_tool(WhiteboardController.Tool.LINE)
|
||||
|
||||
# Browsers may emit a synthetic mouse gesture after touchend. It must not
|
||||
# create a second segment.
|
||||
var count_after_touch := section.segments.size()
|
||||
var mouse_start := view.model_to_screen(Vector2(-10.0, -5.0))
|
||||
var mouse_end := view.model_to_screen(Vector2(0.0, -5.0))
|
||||
_mouse_button(canvas, mouse_start, true)
|
||||
_mouse_motion(canvas, mouse_end)
|
||||
_mouse_button(canvas, mouse_end, false)
|
||||
_check(
|
||||
section.segments.size() == count_after_touch,
|
||||
"synthetic mouse after touch is ignored"
|
||||
)
|
||||
|
||||
# Two-finger pan.
|
||||
controller.set_tool(WhiteboardController.Tool.SELECT)
|
||||
var count_before_pan := section.segments.size()
|
||||
var origin_before := view.origin_px
|
||||
var pan_a := view.model_to_screen(Vector2(20.0, -10.0))
|
||||
var pan_b := view.model_to_screen(Vector2(20.0, -6.0))
|
||||
_touch(canvas, 0, pan_a, true)
|
||||
_touch(canvas, 1, pan_b, true)
|
||||
_drag(canvas, 0, pan_a + Vector2(30.0, 0.0), Vector2(30.0, 0.0))
|
||||
_drag(canvas, 1, pan_b + Vector2(30.0, 0.0), Vector2(30.0, 0.0))
|
||||
_touch(canvas, 0, pan_a + Vector2(30.0, 0.0), false)
|
||||
_touch(canvas, 1, pan_b + Vector2(30.0, 0.0), false)
|
||||
_check(view.origin_px != origin_before, "two-finger drag pans the canvas")
|
||||
_check(
|
||||
section.segments.size() == count_before_pan,
|
||||
"two-finger pan does not create a segment"
|
||||
)
|
||||
|
||||
# Pinch zoom.
|
||||
canvas.fit_rink()
|
||||
var ppm_before := view.pixels_per_meter
|
||||
var center := canvas.size * 0.5
|
||||
var pinch_a := center + Vector2(-30.0, 0.0)
|
||||
var pinch_b := center + Vector2(30.0, 0.0)
|
||||
var pinch_a2 := center + Vector2(-60.0, 0.0)
|
||||
var pinch_b2 := center + Vector2(60.0, 0.0)
|
||||
_touch(canvas, 0, pinch_a, true)
|
||||
_touch(canvas, 1, pinch_b, true)
|
||||
_drag(canvas, 0, pinch_a2, pinch_a2 - pinch_a)
|
||||
_drag(canvas, 1, pinch_b2, pinch_b2 - pinch_b)
|
||||
_touch(canvas, 0, pinch_a2, false)
|
||||
_touch(canvas, 1, pinch_b2, false)
|
||||
_check(
|
||||
view.pixels_per_meter > ppm_before,
|
||||
"two-finger pinch zooms in"
|
||||
)
|
||||
|
||||
# Tap selection.
|
||||
canvas.fit_rink()
|
||||
var target := section.segments[0]
|
||||
var target_point := target.curve.sample_baked(target.get_length_m() * 0.5)
|
||||
_touch(canvas, 0, view.model_to_screen(target_point), true)
|
||||
_touch(canvas, 0, view.model_to_screen(target_point), false)
|
||||
_check(
|
||||
controller.get_selected_segment() == target,
|
||||
"touch tap selects a segment"
|
||||
)
|
||||
|
||||
# Touch handle editing.
|
||||
var old_start := target.curve.get_point_position(0)
|
||||
var new_start := old_start + Vector2(-2.0, 1.0)
|
||||
_touch(canvas, 0, view.model_to_screen(old_start), true)
|
||||
_drag(
|
||||
canvas,
|
||||
0,
|
||||
view.model_to_screen(new_start),
|
||||
view.model_to_screen(new_start) - view.model_to_screen(old_start)
|
||||
)
|
||||
_touch(canvas, 0, view.model_to_screen(new_start), false)
|
||||
_check_vec(
|
||||
target.curve.get_point_position(0),
|
||||
new_start,
|
||||
"touch handle drag moves the segment start"
|
||||
)
|
||||
|
||||
# A second finger cancels an in-progress drawing gesture.
|
||||
controller.set_tool(WhiteboardController.Tool.LINE)
|
||||
var count_before_cancel := section.segments.size()
|
||||
var inside := view.model_to_screen(Vector2(5.0, 5.0))
|
||||
_touch(canvas, 0, inside, true)
|
||||
_check(
|
||||
section.segments.size() == count_before_cancel + 1,
|
||||
"first finger starts a temporary segment"
|
||||
)
|
||||
_touch(canvas, 1, inside + Vector2(20.0, 0.0), true)
|
||||
_check(
|
||||
section.segments.size() == count_before_cancel,
|
||||
"second finger cancels the temporary segment"
|
||||
)
|
||||
_drag(canvas, 0, inside + Vector2(40.0, 0.0), Vector2(40.0, 0.0))
|
||||
_drag(canvas, 1, inside + Vector2(60.0, 0.0), Vector2(40.0, 0.0))
|
||||
_touch(canvas, 0, inside + Vector2(40.0, 0.0), false)
|
||||
_touch(canvas, 1, inside + Vector2(60.0, 0.0), false)
|
||||
_check(
|
||||
section.segments.size() == count_before_cancel,
|
||||
"pinch after cancel does not leave a segment"
|
||||
)
|
||||
|
||||
# Responsive toolbar: wide screens keep the full labels, tablet-landscape
|
||||
# width switches to the compact labels and must not clip the bars.
|
||||
root.size = Vector2i(1400, 900)
|
||||
await process_frame
|
||||
await process_frame
|
||||
_check(controller.get_node("%Title").visible, "wide layout shows the app title")
|
||||
_check(
|
||||
controller.get_node("%UndoButton").text == "Rückgängig",
|
||||
"wide layout uses the full undo label"
|
||||
)
|
||||
|
||||
root.size = Vector2i(1024, 768)
|
||||
await process_frame
|
||||
await process_frame
|
||||
_check(
|
||||
not controller.get_node("%Title").visible,
|
||||
"compact layout hides the app title"
|
||||
)
|
||||
_check(
|
||||
controller.get_node("%UndoButton").text == "Undo",
|
||||
"compact layout uses the short undo label"
|
||||
)
|
||||
var top_bar: Control = controller.get_node("Layout/TopBar")
|
||||
var timing_bar: Control = controller.get_node("Layout/TimingBar")
|
||||
var playback_bar: Control = controller.get_node("Layout/PlaybackBar")
|
||||
_check(
|
||||
top_bar.get_combined_minimum_size().x <= 1024.0,
|
||||
"top bar fits a 1024 px landscape tablet (min %.0f)"
|
||||
% top_bar.get_combined_minimum_size().x
|
||||
)
|
||||
_check(
|
||||
timing_bar.get_combined_minimum_size().x <= 1024.0,
|
||||
"timing bar fits a 1024 px landscape tablet"
|
||||
)
|
||||
_check(
|
||||
playback_bar.get_combined_minimum_size().x <= 1024.0,
|
||||
"playback bar fits a 1024 px landscape tablet"
|
||||
)
|
||||
|
||||
scene.queue_free()
|
||||
await process_frame
|
||||
_finish()
|
||||
|
||||
|
||||
func _touch(
|
||||
canvas: RinkCanvas,
|
||||
index: int,
|
||||
position: Vector2,
|
||||
pressed: bool
|
||||
) -> void:
|
||||
var event := InputEventScreenTouch.new()
|
||||
event.index = index
|
||||
event.position = position
|
||||
event.pressed = pressed
|
||||
canvas._gui_input(event)
|
||||
|
||||
|
||||
func _drag(
|
||||
canvas: RinkCanvas,
|
||||
index: int,
|
||||
position: Vector2,
|
||||
relative: Vector2
|
||||
) -> void:
|
||||
var event := InputEventScreenDrag.new()
|
||||
event.index = index
|
||||
event.position = position
|
||||
event.relative = relative
|
||||
canvas._gui_input(event)
|
||||
|
||||
|
||||
func _mouse_button(
|
||||
canvas: RinkCanvas,
|
||||
position: Vector2,
|
||||
pressed: bool
|
||||
) -> void:
|
||||
var event := InputEventMouseButton.new()
|
||||
event.button_index = MOUSE_BUTTON_LEFT
|
||||
event.pressed = pressed
|
||||
event.position = position
|
||||
canvas._gui_input(event)
|
||||
|
||||
|
||||
func _mouse_motion(canvas: RinkCanvas, position: Vector2) -> void:
|
||||
var event := InputEventMouseMotion.new()
|
||||
event.position = position
|
||||
canvas._gui_input(event)
|
||||
|
||||
|
||||
func _check(condition: bool, message: String) -> void:
|
||||
_assertions += 1
|
||||
if not condition:
|
||||
_failures.append(message)
|
||||
|
||||
|
||||
func _check_vec(actual: Vector2, expected: Vector2, message: String) -> void:
|
||||
_check(
|
||||
actual.distance_to(expected) <= 0.01,
|
||||
"%s (expected %s, got %s)" % [message, expected, actual]
|
||||
)
|
||||
|
||||
|
||||
func _finish() -> void:
|
||||
if _failures.is_empty():
|
||||
print("PASS: %d assertions" % _assertions)
|
||||
quit(0)
|
||||
return
|
||||
|
||||
for failure: String in _failures:
|
||||
printerr("FAIL: %s" % failure)
|
||||
printerr("%d of %d assertions failed" % [_failures.size(), _assertions])
|
||||
quit(1)
|
||||
1
rinkplanner/tests/run_touch_tests.gd.uid
Normal file
1
rinkplanner/tests/run_touch_tests.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cxkc6u04un1qn
|
||||
33
tools/export_web.sh
Executable file
33
tools/export_web.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
PROJECT_DIR="$REPO_ROOT/rinkplanner"
|
||||
BUILD_DIR="$REPO_ROOT/build/web"
|
||||
GODOT="${GODOT:-/opt/godot/Godot_v4.7.2-stable_linux.x86_64}"
|
||||
|
||||
if [[ ! -x "$GODOT" ]]; then
|
||||
echo "Godot binary not found: $GODOT" >&2
|
||||
echo "Set GODOT=/path/to/godot" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$GODOT" --headless --path "$PROJECT_DIR" --import >/dev/null
|
||||
mkdir -p "$BUILD_DIR"
|
||||
|
||||
if ! "$GODOT" --headless --path "$PROJECT_DIR" \
|
||||
--export-release "Web" "$BUILD_DIR/index.html"; then
|
||||
echo "Web export failed." >&2
|
||||
echo "Check that the Web export templates for this Godot version are installed" >&2
|
||||
echo "(Editor -> Manage Export Templates)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$BUILD_DIR/index.html" ]]; then
|
||||
echo "Web export produced no index.html." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Web build: $BUILD_DIR/index.html"
|
||||
echo "Serve it with:"
|
||||
echo " python3 -m http.server 8000 --directory \"$BUILD_DIR\""
|
||||
|
|
@ -39,3 +39,9 @@ fi
|
|||
|
||||
"$GODOT" --headless --path "$PROJECT_DIR" \
|
||||
--script res://tests/run_export_tests.gd
|
||||
|
||||
"$GODOT" --headless --path "$PROJECT_DIR" \
|
||||
--script res://tests/run_touch_tests.gd
|
||||
|
||||
"$GODOT" --headless --path "$PROJECT_DIR" \
|
||||
--script res://tests/run_perf_tests.gd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue