bc89eefa88
- 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.
130 lines
5.5 KiB
Markdown
130 lines
5.5 KiB
Markdown
# 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:
|
|
|
|
```bash
|
|
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:
|
|
|
|
```bash
|
|
#!/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 pipefail` catches 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:**
|
|
|
|
1. **New state fields on `HcieIcedApp`** (in `app.rs`):
|
|
```rust
|
|
/// 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,
|
|
```
|
|
|
|
2. **Update in `VectorSelectDragMove` handler** (in `app.rs`):
|
|
After `transform_shape` returns, set:
|
|
```rust
|
|
self.rotation_snap_active = self.modifiers.shift();
|
|
self.rotation_snap_angle = shape.angle();
|
|
```
|
|
|
|
3. **Clear on drag end** (in `VectorSelectDragEnd`):
|
|
```rust
|
|
self.rotation_snap_active = false;
|
|
```
|
|
|
|
4. **Render in overlay** (in `canvas/mod.rs` after the edit-handles block ~line 1355):
|
|
When `rotation_snap_active` is 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)`)
|
|
|
|
5. **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_15deg` in `vector_edit.rs` and applied in `transform_shape` when `snap_angle=true`.
|
|
- Resize aspect lock: ✅ Already implemented via `lock_aspect` in `resize_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_shape` as both `lock_aspect` and `snap_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;` where `color = self.fg_color`
|
|
- `hcie-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:
|
|
```rust
|
|
let fill_color = color;
|
|
```
|
|
to:
|
|
```rust
|
|
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
|
|
|
|
1. `cargo check -p hcie-iced-gui && cargo check -p hcie-gui-egui`
|
|
2. `cargo test -p hcie-iced-gui`
|
|
3. Manual: run `bash increment_build.sh` and verify `build.id` increments from 990 → 991
|