Commit graph

3 commits

Author SHA1 Message Date
8a32d5184e fix: Implement rotated lock stitches and improve PEN format handling
- Add lock stitch rotation based on movement direction (matches C# PesxToPen.cs)
- Calculate direction by accumulating vectors up to 5 stitches or 8.0 units
- Scale direction vectors from magnitude 8.0 down to 0.4 for proper lock stitch size
- Generate 8 lock stitches (not 4) alternating between +dir and -dir
- Remove PyStitch duplicate position stitches during color changes
- Add long jump detection with automatic lock stitches and cut commands
- Improve color change sequence: finish locks, cut, jump, COLOR_END, start locks
- Parse PEN data to get actual stitches for rendering (fixes jump stitch colors)
- Add encodeStitchPosition() helper function for coordinate encoding
- Improve pattern info refresh timing after mask trace
- Add detailed logging for PEN encoding and pattern info responses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-13 23:25:48 +01:00
0bd037b98a fix: Resolve pattern rendering and coordinate handling bugs
This commit addresses multiple critical issues in pattern rendering and coordinate handling:

1. Fixed Y-axis offset accumulation in penParser.ts
   - Corrected sign extension logic for 16-bit signed coordinates
   - Changed to interpret full 16-bit value as signed before shifting
   - Prevents coordinate drift and offset accumulation

2. Fixed color assignment for tack stitches in patternConverter.worker.ts
   - Added detection for small finishing stitches after COLOR_CHANGE commands
   - Assigns tack stitches to correct (previous) color instead of new color
   - Uses conservative pattern matching (< 1.0 unit, followed by JUMP)

3. Made jump stitches visible in pattern preview (KonvaComponents.tsx)
   - Render jump stitches in thread color instead of gray
   - Use dashed pattern [8, 4] to distinguish from regular stitches
   - Set appropriate opacity (0.8 completed, 0.5 not completed)
   - Fixed critical bug: include previous position in jump groups to create proper line segments

4. Updated konvaRenderers.ts for consistency
   - Applied same jump stitch rendering logic
   - Ensures consistent behavior across rendering methods

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-13 18:37:30 +01:00
Jan-Henrik Bruhn
acdf87b237 initial 2025-11-30 22:18:14 +01:00