Hyungi Ahn aa2ff7d4bc fix(study): HandwriteCanvas 전면 재작성 — Apple Pencil 입력 파이프라인 통합 fix
기존 문제: 점선 stroke / 연속 입력 누락 / 버튼 focus zoom / Safari 선택 팝업.
원인을 4축으로 분리해서 한꺼번에 fix.

[1] 입력 수집 (PointerEvent 상태머신)
- isDrawing flag + activePointerId 매칭으로 stroke 누락 방지
- pointerdown: 이전 inflight 가 살아있으면 finalize 후 새 stroke 시작
- setPointerCapture (try-catch) — element 외 pointer move 도 받음
- pointerup / pointercancel / pointerleave 통합 endStroke
- pointerType === 'pen' (mouse 도 데스크톱) 만, 손가락 거부

[2] coalesced events
- pointermove 의 e.getCoalescedEvents() 모두 points 에 push
- 빠른 필기에서 sparse point → 점선 현상 방지 핵심
- normalizePressure: 0/비정상 값은 0.5 fallback

[3] 렌더링: perfect-freehand polygon fill
- getStroke(thinning:0.4, smoothing:0.62, streamline:0.5, last:true)
- getSvgPathFromStroke (perfect-freehand README 표준 builder)
  → Path2D → ctx.fill() — anti-aliased polygon
- 1점 케이스: arc fill 폴백
- last: true 항상 (진행 중에도 polygon 닫힘)

[4] autosave 입력 분리
- 3초 idle debounce
- flushSave 는 setTimeout 0 으로 다음 macrotask
- PATCH 응답이 strokes 를 덮어쓰지 않음 (응답 무시, fire-and-forget)

[5] Safari/Chrome hardening
- 캔버스/컨테이너: touch-action: none + user-select: none +
  -webkit-touch-callout: none + -webkit-tap-highlight-color: transparent
- canvas 에 oncontextmenu / onselectstart preventDefault
- 모든 toolbar 버튼: clickThenBlur(fn) + tabindex=-1 + BTN_STYLE
  → button focus zoom 차단 (사용자 보고 "버튼 누르면 화면 확대" 핵심)

[6] resize 정책
- ResizeObserver + window resize/orientationchange 만 트리거
- pointermove 마다 resize 절대 안 함
- DPR 반영 + setTransform(dpr,...) 으로 retina 선명

수정 범위 (사용자 명시): HandwriteCanvas.svelte 만. 다른 영역 무수정.
2026-04-27 11:08:36 +09:00

hyungi_Document_Server

Self-hosted 개인 지식관리(PKM) 웹 애플리케이션

기술 스택

  • 백엔드: FastAPI + SQLAlchemy (async)
  • 데이터베이스: PostgreSQL 16 + pgvector + pg_trgm
  • 프론트엔드: SvelteKit
  • 문서 파싱: kordoc (HWP/HWPX/PDF → Markdown)
  • AI: Qwen3.5-35B-A3B (MLX), nomic-embed-text, Claude API (폴백)
  • 인프라: Docker Compose, Caddy, Synology NAS

주요 기능

  • 문서 자동 분류/태그/요약 (AI 기반)
  • 전문검색 + 벡터 유사도 검색
  • HWP/PDF/Markdown 문서 뷰어
  • 법령 변경 모니터링 (산업안전보건법 등)
  • 이메일 자동 수집 (MailPlus IMAP)
  • 일일 다이제스트
  • CalDAV 태스크 연동 (Synology Calendar)

Quick Start

git clone https://git.hyungi.net/hyungi/hyungi_document_server.git hyungi_Document_Server
cd hyungi_Document_Server

# 인증 정보 설정
cp credentials.env.example credentials.env
nano credentials.env  # 실제 값 입력

# 실행
docker compose up -d

http://localhost:8000/docs 에서 API 문서 확인

디렉토리 구조

├── app/              FastAPI 백엔드 (API, 워커, AI 클라이언트)
├── frontend/         SvelteKit 프론트엔드
├── services/kordoc/  문서 파싱 마이크로서비스 (Node.js)
├── gpu-server/       GPU 서버 배포 (AI Gateway)
├── migrations/       PostgreSQL 스키마
├── docs/             설계 문서, 배포 가이드
└── tests/            테스트 코드

인프라 구성

서버 역할
Mac mini M4 Pro Docker Compose (FastAPI, PostgreSQL, kordoc, Caddy) + MLX AI
Synology NAS 파일 원본 저장, Synology Office/Drive/Calendar/MailPlus
GPU 서버 AI Gateway, 벡터 임베딩, OCR, 리랭킹

문서

S
Description
No description provided
Readme 14 MiB
Languages
Python 67%
Svelte 23.1%
Swift 5.3%
TypeScript 3.2%
Shell 0.5%
Other 0.9%