Commit Graph
5 Commits
Author SHA1 Message Date
dotCooCoo 18297cc662 Unit Converter: a signed or inch- or foot-suffixed thousands comma is refused
+1,000 read as 1 pt and 1,000" as 1 inch, though a single number with a
thousands comma is refused. The check now allows a leading + as well as -,
and accepts " and ' as the unit after the number, so +1,000, 1,000" and
1,000' are refused in addon.units.convert and in the number fields.
2026-11-14 21:52:07 -08:00
dotCooCoo 71686757ec Unit Converter: a null unit is an error
addon.units.convert read {"value": 12, "unit": null} as 12 points. Only an
omitted unit is points now; a null unit is refused as an unknown unit.
2026-11-14 20:09:03 -08:00
dotCooCoo d6761e23ba Unit Converter: a comma in a sum reads as a decimal comma again
The number fields read a comma in a sum as a decimal comma, so 1,500+2 is
3.5 (widgets::decimal_point_tests::a_decimal_comma_reads_as_a_point), and
only a value that is one number with a thousands comma, such as 1,000 mm,
is refused. Checking each number of a sum for a thousands comma broke that
test. The check is back to the single number, and addon.units.convert reads
1,500+2 the same way the number fields do.
2026-11-14 19:51:04 -08:00
dotCooCoo e4955fb933 Unit Converter: a thousands comma in any number of a sum is refused
A value such as 1,000 mm+1 mm read the comma as a decimal point and gave
2 mm, because only a value that was one number was checked for a thousands
comma. Each number of a sum is now checked on its own, so 1,000 mm+1 mm,
+1,000 and 2*1,000 are refused in the number fields and in
addon.units.convert, and 100.5 mm-0,5 still reads as 100 mm.
2026-11-14 15:32:57 -08:00
dotCooCoo 907a759710 Unit Converter: one length in every unit, read from and applied to the selection
Object › Plug-ins › Unit Converter › Unit Converter Panel opens a panel
with one number field per unit of Preferences › Units › East Asian Type
(pt, picas, in, mm, cm, px, ft & in, m, yd, ft, Q, Ha). A length typed in
any field, with units and arithmetic as every number field reads them,
updates the others as it is typed; text that does not read leaves them as
they were. From Selection reads the selection's width and height as the
Transform panel measures them, and Width or Height picks which one the
fields show; the size read is dropped when the document, its selection,
Use Preview Bounds or Measure Type by Glyph Bounds changes. Apply sets
that side through object.setBounds as the Transform panel's W or H field
does (its reference point, Constrain Width and Height Proportions and
Transform Object Only, Pattern Only or Both), as one undo step, and adds
none when the size is already that length. Each field's copy button
copies its value, with its unit when Copy with Units is on, and is named
with its unit for screen readers.

- addon.units.convert {value, unit?} gives a length in every unit, and
  addon.units.selectionSize {} gives the selection's width and height the
  same way. Neither changes the document. convert reads at most 1024
  bytes and 128 + - * / signs.
- The decimal comma rule of the number fields moves from ui-egui to
  vectorcraft_doc::decimal_point, so the command reads "0,5 mm" as the
  fields do.
- The Transform panel's pattern switches are built by
  with_pattern_switches, which run_transform and Apply share.

Closes #5528, as proposed by @ruchirguitar.
2026-11-14 13:02:57 -08:00