Skip to content

Commit

Permalink
change sketch_name references to sketch_id
Browse files Browse the repository at this point in the history
  • Loading branch information
MattFerraro committed Apr 10, 2024
1 parent 991bf5e commit a4d42ba
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
7 changes: 4 additions & 3 deletions packages/cadmium/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ fn main() {
});
let new_sketch_hash = el.append(Operation::NewSketch {
name: "Sketch1".to_string(),
unique_id: "qwerty".to_string(),
plane_name: "Front".to_string(),
});
el.append(Operation::NewRectangle {
sketch_name: "Sketch1".to_string(),
sketch_id: "qwerty".to_string(),
x: 0.0,
y: 0.0,
width: 100.0,
Expand All @@ -38,7 +39,7 @@ fn main() {
let extrude_sha = el.append(Operation::NewExtrusion {
name: "Extrude1".to_string(),
unique_id: "abc123".to_string(),
sketch_name: "Sketch1".to_string(),
sketch_id: "qwerty".to_string(),
click_x: 50.0,
click_y: 50.0,
depth: 100.0,
Expand All @@ -47,7 +48,7 @@ fn main() {
// Actually, let's try something different
el.checkout(new_sketch_hash);
el.append(Operation::NewCircle {
sketch_name: "Sketch1".to_string(),
sketch_id: "qwerty".to_string(),
x: 50.0,
y: 50.0,
radius: 50.0,
Expand Down
45 changes: 26 additions & 19 deletions packages/cadmium/src/oplog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,24 +148,25 @@ pub enum Operation {
NewSketch {
name: String,
plane_name: String,
unique_id: String,
},
NewRectangle {
sketch_name: String,
sketch_id: String,
x: f64,
y: f64,
width: f64,
height: f64,
},
NewCircle {
sketch_name: String,
sketch_id: String,
x: f64,
y: f64,
radius: f64,
},
NewExtrusion {
name: String,
unique_id: String,
sketch_name: String,
sketch_id: String,
click_x: f64,
click_y: f64,
depth: f64,
Expand All @@ -190,31 +191,33 @@ impl Operation {
Operation::NewPlane { name, plane } => {
hasher.update(format!("{name}-{plane:?}").as_bytes())
}
Operation::NewSketch { name, plane_name } => {
hasher.update(format!("{name}-{plane_name:?}").as_bytes())
}
Operation::NewSketch {
name,
plane_name,
unique_id,
} => hasher.update(format!("{name}-{plane_name:?}-{unique_id}").as_bytes()),
Operation::NewRectangle {
sketch_name,
sketch_id,
x,
y,
width,
height,
} => hasher.update(format!("{sketch_name}-{x}-{y}-{width}-{height}").as_bytes()),
} => hasher.update(format!("{sketch_id}-{x}-{y}-{width}-{height}").as_bytes()),
Operation::NewCircle {
sketch_name,
sketch_id,
x,
y,
radius,
} => hasher.update(format!("{sketch_name}-{x}-{y}-{radius}").as_bytes()),
} => hasher.update(format!("{sketch_id}-{x}-{y}-{radius}").as_bytes()),
Operation::NewExtrusion {
name,
unique_id,
sketch_name,
sketch_id,
click_x,
click_y,
depth,
} => hasher.update(
format!("{name}-{unique_id}-{sketch_name}-{click_x}-{click_y}-{depth}").as_bytes(),
format!("{name}-{unique_id}-{sketch_id}-{click_x}-{click_y}-{depth}").as_bytes(),
),
Operation::ModifyExtrusionDepth { unique_id, depth } => {
hasher.update(format!("{unique_id}-{depth}").as_bytes())
Expand All @@ -232,38 +235,42 @@ impl Operation {
commit,
} => format!("Describe: {} '{}'", commit, description),
Operation::NewPlane { name, plane } => format!("NewPlane: '{}'", name),
Operation::NewSketch { name, plane_name } => {
Operation::NewSketch {
name,
plane_name,
unique_id,
} => {
format!("NewSketch: '{}' on plane '{}'", name, plane_name)
}
Operation::NewRectangle {
sketch_name,
sketch_id,
x,
y,
width,
height,
} => format!(
"NewRectangle: {} {} {} {} on '{}'",
x, y, width, height, sketch_name
x, y, width, height, sketch_id
),
Operation::NewCircle {
sketch_name,
sketch_id,
x,
y,
radius,
} => format!(
"NewCircle: ({},{}) radius: {} on '{}'",
x, y, radius, sketch_name
x, y, radius, sketch_id
),
Operation::NewExtrusion {
name,
unique_id,
sketch_name,
sketch_id,
click_x,
click_y,
depth,
} => format!(
"NewExtrusion: '{}' on '{}' ({},{}) depth: {}",
name, sketch_name, click_x, click_y, depth
name, sketch_id, click_x, click_y, depth
),
Operation::ModifyExtrusionDepth { unique_id, depth } => {
format!("ModifyExtrusionDepth: {} to {}", unique_id, depth)
Expand Down

0 comments on commit a4d42ba

Please sign in to comment.