mirror of
https://github.com/storytold/deckcraft.git
synced 2026-11-20 17:14:49 +00:00
Shapes: the 3- and 4-bend elbow and curved connectors follow presetShapeDefinitions (#1851)
* Shapes: the 3- and 4-bend elbow and curved connectors follow presetShapeDefinitions PowerPoint routes connectors around shapes with bentConnector4 and 5 and their curved counterparts. They were drawn as bentConnector3 and curvedConnector3, using adj1 alone, and curvedConnector2 as a two-cubic S where the spec has one cubic. Each now draws the spec's path, and the elbows get a handle per adjust value where the spec puts it. None of these is in the gallery, so their adjust values had no defaults: a file giving none, or only adj2, drew them at 0. adjust_defaults() adds the spec's 50000s for presets outside the gallery, and the reader, writer, Adjust command and handle drag use it. * Shapes: elbow handles take the spec's whole adjust range The handles clamped a dragged value to ±1000000, so dragging one on an imported route with a value beyond that moved the route. They now take presetShapeDefinitions' ±2147483647 (noted in review).
This commit is contained in:
1 parent
6c52db0172
commit
f9bc097b4e
4 files changed
+26
-4
No files matched your search
@@ -9,7 +9,7 @@ pub(super) fn adjust(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let v = f64_param(p, "value").ok_or_else(|| bad("shape.adjust", "missing `value`"))?;
|
||||
edit_geometry(s, p, "shape.adjust", |sh| {
|
||||
if let Geom::Preset { name, adj } = &mut sh.geom {
|
||||
let defaults = deckcraft_geom::preset::info(name).map(|x| x.defaults).unwrap_or(&[]);
|
||||
let defaults = deckcraft_geom::preset::adjust_defaults(name);
|
||||
while adj.len() <= i {
|
||||
let k = adj.len();
|
||||
adj.push(defaults.get(k).copied().unwrap_or(0.0));
|
||||
|
||||
@@ -293,7 +293,7 @@ impl Session {
|
||||
if let Some(sh) = deckcraft_model::find_shape_mut(list, id)
|
||||
&& let deckcraft_model::Geom::Preset { name, adj } = &mut sh.geom
|
||||
{
|
||||
let defaults = deckcraft_geom::preset::info(name).map(|x| x.defaults).unwrap_or(&[]);
|
||||
let defaults = deckcraft_geom::preset::adjust_defaults(name);
|
||||
for (i, v) in &vals {
|
||||
while adj.len() <= *i {
|
||||
let k = adj.len();
|
||||
|
||||
Reference in new issue
Block a user