Skip to content

fix: working drawing state (checkpoint)#2

Merged
ajianaz merged 8 commits into
developfrom
fix/checkpoint-working-state
Jul 11, 2026
Merged

fix: working drawing state (checkpoint)#2
ajianaz merged 8 commits into
developfrom
fix/checkpoint-working-state

Conversation

@ajianaz

@ajianaz ajianaz commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Checkpoint kondisi drawing yang sudah working sebelum lanjut polish UI (lucide, vertical toolbar, posisi kanan tengah).

Root causes yang diperbaiki

1. Black screen (overlay opaque)

  • fullscreen: true + transparent: true di macOS = opaque black backing layer
  • Fix: fullscreen: false, maximized: false, skipTaskbar: false

2. Drawing tidak bisa (pointer events bocor)

  • Startup apply_click_through(true) = window click-through = klik tidak sampai canvas
  • Fix: startup apply_click_through(false) + set_activation_policy(Regular)

3. Window geometry salah

  • maximized: true + center: true konflik → window di posisi (-240, 30)
  • Fix: set manual position+size di show_overlay() dari current_monitor()

4. Capabilities kurang

  • set-ignore-cursor-events, set-position, set-size, current-monitor belum di-allow
  • Fix: tambahkan permissions di capabilities/default.json

5. Phantom toggle (shortcut global)

  • Alt+Shift+D ter-trigger berulang tanpa input user → toggle ON/OFF sendiri
  • Fix: disable global shortcut selama dev

Cara pakai (dev)

  1. bun run tauri dev
  2. Cmd+Tab ke DrawOver (pastikan frontmost)
  3. Klik tombol Start Draw pojok kanan atas
  4. Coret layar

TODO berikutnya (branch lain)

  • Ganti emoji → lucide icons
  • Toolbar vertical di kanan tengah
  • Hover shortcut hint
  • Re-enable global shortcut (cari penyebab phantom toggle)
  • Accessibility permission untuk shortcut keyboard

Test

  • App start tanpa black screen
  • Tombol toggle clickable
  • Drawing jalan (strokes render)
  • Toolbar muncul saat draw mode ON

ajianaz added 8 commits July 12, 2026 00:21
Root causes fixed:
- tauri.conf.json: fullscreen:true + transparent:true on macOS forced
  opaque black backing layer. Switch to fullscreen:false + maximized:false.
- skipTaskbar:false so overlay window can receive keyboard focus.
- capabilities: add set-ignore-cursor-events, set-position, set-size,
  current-monitor permissions (were missing -> click-through + geometry
  calls silently failed).
- lib.rs show_overlay(): explicitly position window to current monitor
  origin+size (fixes maximized/center conflict leaving window at -240,30),
  re-assert always-on-top, log results.
- lib.rs do_toggle_draw_mode(): switch activation policy Regular<->Accessory
  so the overlay can become key window and capture mouse while drawing.
- lib.rs: add debug logging for shortcut registration/toggle.
- +page.svelte: add manual toggle button + debug overlay (work-in-progress
  while global shortcut capture is unreliable without Accessibility perm),
  sync initial draw mode from backend via is_draw_mode.

Known issue: global shortcut Option+Shift+D not reaching app from physical
keyboard (likely needs Accessibility/Input Monitoring permission). Manual
toggle button added as workaround during dev.

Follows PR #1 on develop.
- Toolbar: vertical layout, docked right-center on first paint, draggable.
- Replace emoji icons with @lucide/svelte (Pen, Highlighter, Eraser, Undo2,
  Trash2, X).
- Hover reveals keyboard shortcut badge on each tool button.
- Remove debug overlay + dev toggle button from +page.svelte.
- Add FAB (floating action button) bottom-right to enter draw mode.
- Keyboard shortcuts: Esc=exit, P/H/E=tool, Cmd+Z=undo.
- Startup click-through disabled so manual controls stay clickable.
- Startup: set_activation_policy(Regular) + show + set_focus + geometry +
  always_on_top so overlay is frontmost and clickable immediately.
- Keep click-through OFF on exit-draw-mode so FAB/tray can re-enter.
- Toolbar: replace emoji icons with @lucide/svelte (Pen, Highlighter, Eraser,
  Undo2, Trash2, X) at size=16. No logic changes.
- Dev logging in toggle_draw_mode command for debugging phantom events.
…ugh false

Rollback semua perubahan UI/lucide yang bikin toolbar hilang & click gagal.
Kembali ke commit 7b2be16 state (emoji icons, debug overlay, toggle button)
+ startup click-through false (fix yang membuat drawing bisa dipakai).
Shortcut global Alt+Shift+D memicu toggle berulang tanpa input user,
membatalkan klik tombol manual. Disable selama dev.
Kondisi working (drawing jalan):
- startup: apply_click_through(false) + activation policy Regular
- do_toggle: show_overlay() geometry, exit keep clickable + Regular
- shortcut global disabled (phantom toggle)
- UI: emoji toolbar + debug overlay + toggle button
- page.svelte: pdown/strokes counter di debug untuk tracing pointer events
- show_overlay: collapse nested if let Ok+Some menjadi if let Ok(Some(monitor))
- startup: hapus let _ = pada app.set_activation_policy (App::method return
  unit, AppHandle::method return Result). do_toggle tetap pakai let _ = karena
  app: &AppHandle -> Result.
@ajianaz ajianaz merged commit 198ace8 into develop Jul 11, 2026
3 checks passed
@ajianaz ajianaz deleted the fix/checkpoint-working-state branch July 11, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant