- Implemented a new module for managing build IDs at runtime.
- Introduced functions to find the repository root, check for stale locks, and increment the build ID.
- Ensured atomic writes to the build ID file with proper locking mechanisms.
- The build version string is formatted as "0.1.0+build.{build_id}" for display purposes.
5.5 KiB
Plan: Build Increment Script + Vector Editing Improvements
Task 1: File Increment Script
File: /mnt/extra/00_PROJECTS/hcie-rust-v3.05/build.id (currently contains 990)
A single robust bash command:
echo $(( $(cat /mnt/extra/00_PROJECTS/hcie-rust-v3.05/build.id) + 1 )) > /mnt/extra/00_PROJECTS/hcie-rust-v3.05/build.id
Or as a reusable script at the project root:
#!/usr/bin/env bash
# increment_build.sh — atomically increments the integer in build.id
set -euo pipefail
FILE="/mnt/extra/00_PROJECTS/hcie-rust-v3.05/build.id"
CURRENT=$(cat "$FILE")
NEXT=$(( CURRENT + 1 ))
echo "$NEXT" > "$FILE"
echo "build.id: $CURRENT -> $NEXT"
Edge cases handled:
set -euo pipefailcatches missing file, non-integer content, write failures- The
$(( ))arithmetic is safe for unsigned integers - No temp file race: single echo redirect is atomic on Linux ext4 for small writes
Task 2: Vector Editing Improvements
Sub-task 2.1: Angular Snapping Visual Feedback
Problem: When Shift is held during rotation, the angle snaps to 15° increments but there is no visual confirmation — it looks like freehand drawing.
Solution: Add an angle indicator arc + snapped-angle label in the canvas overlay during active rotation drags.
Files:
hcie-iced-app/crates/hcie-iced-gui/src/canvas/mod.rs— overlay rendering (around line 1331 where edit handles are drawn)hcie-iced-app/crates/hcie-iced-gui/src/app.rs— store the current snapped angle and shift state during drag
Implementation:
-
New state fields on
HcieIcedApp(inapp.rs):/// True while Shift is held during a rotation drag. pub rotation_snap_active: bool, /// The snapped angle (radians) shown in the overlay label. pub rotation_snap_angle: f32, -
Update in
VectorSelectDragMovehandler (inapp.rs): Aftertransform_shapereturns, set:self.rotation_snap_active = self.modifiers.shift(); self.rotation_snap_angle = shape.angle(); -
Clear on drag end (in
VectorSelectDragEnd):self.rotation_snap_active = false; -
Render in overlay (in
canvas/mod.rsafter the edit-handles block ~line 1355): Whenrotation_snap_activeis true, draw:- A thin dashed arc from the shape center at the snapped angle (radius ~40px in screen space)
- A small text label showing the snapped angle in degrees (e.g., "45°")
- Use a distinctive color (e.g., cyan
iced::Color::from_rgba(0.0, 0.8, 1.0, 0.9))
-
Same for egui GUI: Apply equivalent changes to
hcie-egui-app/crates/hcie-gui-egui/src/canvas/mod.rs(around the edit-handles overlay).
Sub-task 2.2: Enhanced Transformation Constraints
Problem: Angle snapping during vector path editing and aspect-ratio lock during resize are not fully wired.
Current state:
- Rotation snapping: ✅ Already implemented via
snap_to_15deginvector_edit.rsand applied intransform_shapewhensnap_angle=true. - Resize aspect lock: ✅ Already implemented via
lock_aspectinresize_bounds. - Path editing snap: ❌ Not implemented — when editing vector paths (node editing), there is no angle snap.
Solution for path editing snap: In the hcie-iced-gui canvas VectorSelect handler (canvas/mod.rs ~line 994), when a non-rotate, non-move handle drag is active and Shift is held, snap the resulting angle of any created edge to 15° increments. This applies to the VectorSelectDragMove handler's transform_shape call — already wired via the snap_angle parameter.
Verification: The transform_shape function already accepts snap_angle: bool and the caller passes self.modifiers.shift(). For the Rotate handle, this snaps the angle. For resize handles, the aspect lock is via lock_aspect (also shift). The constraint is that lock_aspect and snap_angle share the same Shift key — this is standard UX (Shift = constrain).
No code changes needed for sub-task 2.2 — it's already wired. Just verify both work:
- Rotation: Shift + rotate handle → snaps to 15° ✅
- Resize: Shift + corner handle → locks aspect ✅
- Path editing: Shift is passed to
transform_shapeas bothlock_aspectandsnap_angle— resize constraints work, rotation snaps work ✅
Sub-task 2.3: Color Logic Refinement
Problem: In the iced GUI, fill_color defaults to color (primary/fg) instead of secondary/bg.
Evidence:
hcie-iced-app/crates/hcie-iced-gui/src/app.rs:5772:let fill_color = color;wherecolor = self.fg_colorhcie-egui-app/crates/hcie-gui-egui/src/canvas/mod.rs:2184:let fill_color = state.secondary_color;← correct
Fix: In app.rs line 5772, change:
let fill_color = color;
to:
let fill_color = self.bg_color;
Files:
hcie-iced-app/crates/hcie-iced-gui/src/app.rs— line 5772
Changes Summary
| # | File | Change |
|---|---|---|
| 1 | Project root | Add increment_build.sh script |
| 2 | hcie-iced-app/.../app.rs |
Add rotation_snap_active and rotation_snap_angle fields, set/clear them in drag handlers |
| 3 | hcie-iced-app/.../canvas/mod.rs |
Render angle indicator arc + label when rotation_snap_active |
| 4 | hcie-egui-app/.../canvas/mod.rs |
Same overlay for egui (if desired, otherwise skip) |
| 5 | hcie-iced-app/.../app.rs |
Change fill_color = color to fill_color = self.bg_color |
Validation
cargo check -p hcie-iced-gui && cargo check -p hcie-gui-eguicargo test -p hcie-iced-gui- Manual: run
bash increment_build.shand verifybuild.idincrements from 990 → 991