baldav/src/measures.js
4aiman b26264538b GPS point ordering + GPX export + chart zoom fixes
GPS background recording:
- Batched writes (10s flush) in native service
- Polling lock prevents parallel processing
- Track by timestamp instead of line count
- Recovery idempotent via max DB timestamp
- Seq numbers on live recorded points

GPX export:
- Button in session detail
- SAF file picker on Android (ACTION_CREATE_DOCUMENT)
- GPS config in metadata (accuracy, minSpeed, minDist)

Charts:
- Pinch zoom enabled at creation (Hammer.js registers handlers)
- touch-action: pan-y blocks pinch in normal view (page scrolls)
- Fullscreen: CSS-only expand (no canvas manipulation)
- Downsampled to 500 points for smooth rendering
- Back gesture collapses fullscreen before closing modal

Build: --real flag finds first non-emulator device
2026-05-16 21:21:13 +03:00

44 lines
1.4 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Household measures → grams/ml
// Used by parser.js to convert "ст.л." → 15g, etc.
export const MEASURES = {
// Spoons
"ч.л.": 5,
"чайная ложка": 5,
"чайн ложк": 5,
"д.л.": 10,
"десертная ложка": 10,
"ст.л.": 15,
"столовая ложка": 15,
"стол ложк": 15,
// Cups / glasses
"стакан": 250,
"полстакана": 125,
"кружка": 300,
// Pieces (generic, product-specific overrides in food-table)
"кусок хлеба": 30,
"кусок": 30,
"ломтик": 20,
"долька": 10,
// Pinches
"щепотка": 1,
"горсть": 30,
};
// Pattern aliases for parser regex matching
export const MEASURE_PATTERNS = [
{ pattern: /\bч\.?\s*л\.?\b/i, grams: 5 },
{ pattern: /\bчайн\w*\s+ложк\w*\b/i, grams: 5 },
{ pattern: /\bд\.?\s*л\.?\b/i, grams: 10 },
{ pattern: /\bдесертн\w*\s+ложк\w*\b/i, grams: 10 },
{ pattern: /\bст\.?\s*л\.?\b/i, grams: 15 },
{ pattern: /\bстолов\w*\s+ложк\w*\b/i, grams: 15 },
{ pattern: /\bстакан\w*\b/i, grams: 250 },
{ pattern: /\bполстакан\w*\b/i, grams: 125 },
{ pattern: /\bкружк\w*\b/i, grams: 300 },
{ pattern: /\bгорст\w*\b/i, grams: 30 },
{ pattern: /\bщепотк\w*\b/i, grams: 1 },
];