Files
vectorcraft/crates/tools
dotCooCoo a315b7ef6b Tools: setting a tool option with a bad value returns an error
tool.setOption checks every option it is given before it sets any. An
option the tool does not have, a value of the wrong type, a number
outside the tool's range or an unknown choice is an error that names the
tool and the option, for example "tool `smooth`: `fidelity` must be a
number from 0.05 to 100". On an error no option, saved preference or
undo step changes, also when another option in the same call is good.
`{}` reads the options and sets nothing. A `tool` that is not a string,
a `values` that is not an object, a `key` without a `value` and an
option given both as `key` and in `values` are errors too.

- Tool::check_option (and check_options for options set together) is
  added beside set_option, and every tool with options implements it.
  A tool without options takes none. Most checks use the range the
  setter clamped to. The Arc tool's lengthX and lengthY now take a
  number greater than 0 and at most 1e6, and the Line tool's length 0
  to 1e6; before, a negative length was taken as its absolute value
  and the Arc lengths had no upper limit. The Live Paint tools and the
  Shape Builder use check_builder_options, so their width and gapLength
  are still clamped to their range.
- A Place `current` given with a new `queue` is an index into that
  queue, and the queue is set first. A parametric shape's `kind` is
  set before the values given with it, and those values are checked
  against the new kind's ranges.
- Tool Options dialogs (freehand, Liquify, Symbolism, Live Paint, Shape
  Builder, Objects on Path, Flare, the grid, arc and line tools and the
  path add-ons) stay open when an option is refused.
- docs/control-protocol.md, docs/mcp.md and the tool.setOption params
  text describe the errors.
2026-11-13 17:25:12 -08:00
..