remove Hulls view tab and its supporting dead code
- VIEW_MODES: remove 'hulls' (gradient hull viz is now in the Hull node thumbnail) - App.jsx: remove case 'hulls': from the refresh switch; remove 'hulls' entry from the accent color map - lib.rs: remove the 'hulls' arm from get_pass_viz (per-pixel raster gradient render); update doc comment to reflect contours-only mode Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import { defaultPass, defaultGcodeConfig, PAPER_SIZES } from './store.js'
|
|||||||
import * as tauri from './hooks/useTauri.js'
|
import * as tauri from './hooks/useTauri.js'
|
||||||
import { useFps } from './hooks/useFps.js'
|
import { useFps } from './hooks/useFps.js'
|
||||||
|
|
||||||
const VIEW_MODES = ['source', 'detection', 'hulls', 'contours', 'fill', 'gcode']
|
const VIEW_MODES = ['source', 'detection', 'contours', 'fill', 'gcode']
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const [image, setImage] = useState(null)
|
const [image, setImage] = useState(null)
|
||||||
@@ -86,7 +86,6 @@ export default function App() {
|
|||||||
case 'detection':
|
case 'detection':
|
||||||
setDisplayB64(passes[activePass]?.vizB64 ?? null)
|
setDisplayB64(passes[activePass]?.vizB64 ?? null)
|
||||||
break
|
break
|
||||||
case 'hulls':
|
|
||||||
case 'contours':
|
case 'contours':
|
||||||
// Don't race getPassViz against generateFill — both need the AppState mutex.
|
// Don't race getPassViz against generateFill — both need the AppState mutex.
|
||||||
// filling=true means fill hasn't finished yet; the effect will re-run when it does.
|
// filling=true means fill hasn't finished yet; the effect will re-run when it does.
|
||||||
@@ -372,7 +371,7 @@ export default function App() {
|
|||||||
{/* Top bar — accent colors match the section dots in the left panel */}
|
{/* Top bar — accent colors match the section dots in the left panel */}
|
||||||
<div className="flex items-center gap-1 px-3 py-2 border-b border-neutral-800 bg-neutral-900/80">
|
<div className="flex items-center gap-1 px-3 py-2 border-b border-neutral-800 bg-neutral-900/80">
|
||||||
{VIEW_MODES.map(m => {
|
{VIEW_MODES.map(m => {
|
||||||
const accent = { detection: '#6366f1', hulls: '#14b8a6', contours: '#14b8a6', fill: '#a855f7', gcode: '#f59e0b' }[m]
|
const accent = { detection: '#6366f1', contours: '#14b8a6', fill: '#a855f7', gcode: '#f59e0b' }[m]
|
||||||
const label = m === 'gcode' ? 'G-code' : m.charAt(0).toUpperCase() + m.slice(1)
|
const label = m === 'gcode' ? 'G-code' : m.charAt(0).toUpperCase() + m.slice(1)
|
||||||
return (
|
return (
|
||||||
<button key={m}
|
<button key={m}
|
||||||
|
|||||||
24
src/lib.rs
24
src/lib.rs
@@ -706,8 +706,7 @@ fn compute_hull_holes(
|
|||||||
hull_holes
|
hull_holes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a viz image for an already-processed pass.
|
/// Return a contour SVG for an already-processed pass.
|
||||||
/// mode: "hulls" | "contours"
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn get_pass_viz(pass_index: usize, mode: String, state: State<Mutex<AppState>>) -> Result<String, String> {
|
fn get_pass_viz(pass_index: usize, mode: String, state: State<Mutex<AppState>>) -> Result<String, String> {
|
||||||
let st = state.lock().unwrap();
|
let st = state.lock().unwrap();
|
||||||
@@ -736,27 +735,6 @@ fn get_pass_viz(pass_index: usize, mode: String, state: State<Mutex<AppState>>)
|
|||||||
let hull_holes = compute_hull_holes(&pass.hulls, w, h);
|
let hull_holes = compute_hull_holes(&pass.hulls, w, h);
|
||||||
|
|
||||||
match mode.as_str() {
|
match mode.as_str() {
|
||||||
"hulls" => {
|
|
||||||
// Per-pixel raster: hull hue modulated by response intensity.
|
|
||||||
// intensity = (255 - response) / 255: max ink (resp=0) → full hue,
|
|
||||||
// threshold edge (resp≈threshold) → near black.
|
|
||||||
let response = &pass.response_map;
|
|
||||||
let mut rgba = vec![15u8; (w * h * 4) as usize];
|
|
||||||
for px in rgba.chunks_mut(4) { px[3] = 255; }
|
|
||||||
|
|
||||||
for hull in &pass.hulls {
|
|
||||||
let (hr, hg, hb) = hash_color(hull.id);
|
|
||||||
for &(px, py) in &hull.pixels {
|
|
||||||
let resp = response.get((py * w + px) as usize).copied().unwrap_or(0);
|
|
||||||
let intensity = (255u32 - resp as u32) as f32 / 255.0;
|
|
||||||
let i = ((py * w + px) * 4) as usize;
|
|
||||||
rgba[i] = (hr as f32 * intensity) as u8;
|
|
||||||
rgba[i+1] = (hg as f32 * intensity) as u8;
|
|
||||||
rgba[i+2] = (hb as f32 * intensity) as u8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(rgba_to_b64_png(&rgba, w, h))
|
|
||||||
}
|
|
||||||
"contours" => {
|
"contours" => {
|
||||||
let mut svg = format!(
|
let mut svg = format!(
|
||||||
r##"<svg xmlns="http://www.w3.org/2000/svg" width="{w}" height="{h}" viewBox="0 0 {w} {h}"><rect width="{w}" height="{h}" fill="#0f0f0f"/>"##
|
r##"<svg xmlns="http://www.w3.org/2000/svg" width="{w}" height="{h}" viewBox="0 0 {w} {h}"><rect width="{w}" height="{h}" fill="#0f0f0f"/>"##
|
||||||
|
|||||||
Reference in New Issue
Block a user