mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-10 09:59:47 -06:00
Mesh: Create Gradient Mesh at a point outside the object keeps the path
object.mesh.create with `at` ignored a failed line placement and still replaced the path with a bare 1x1 mesh. When the new mesh can't place its lines at the point, the object is left as it is, and when nothing was converted the command fails with "point is outside the object" and adds no undo step.
This commit is contained in:
@@ -59,7 +59,14 @@ pub(super) fn mesh_create(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
};
|
||||
let Some(mut m) = m else { continue };
|
||||
if let Some(q) = at {
|
||||
index = m.add_lines_at(q, tol);
|
||||
// A point the new mesh can't place its lines at leaves the object as it is.
|
||||
match m.add_lines_at(q, tol) {
|
||||
Some(i) => index = Some(i),
|
||||
None => {
|
||||
refused.get_or_insert("point is outside the object");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut mn = Node::new(n.id, NodeKind::Mesh(m));
|
||||
mn.name = n.name.clone();
|
||||
|
||||
Reference in New Issue
Block a user