Phase 6 updates

Phase 6 · Slice 31 ·

UI Toolkit numeric fields

  • TextValueField and IntegerField, LongField, UnsignedIntegerField, UnsignedLongField, FloatField and DoubleField: Unity's structure (their own input elements, the label's dragger class), defaults (maxLength 1000; format strings #######0, g7 and R, R written as Unity's runtime writes it: 15 digits when they read back, else 17; no negative zero).
  • Text reads as Unity reads it: whole numbers clamped to the type's range, else an expression (+ - * / % ^, parentheses, pi, e, sqrt and other functions; each step kept to 15 significant digits) truncated toward zero; reals take a comma for the point, NaN and Infinity, and clamp to float's range; empty text is zero; anything else keeps the current value. Focus leaving takes the text (delayed or not) and shows the value again; text typed while focused stays as typed. TextInputBaseField.text's setter is protected, as in Unity.
  • Dragging: ApplyInputDeviceDelta moves by the pointer movement's length (signed by right and up) times a quarter (Slow), one or four (Fast), times the sensitivity (whole numbers: one, or the truncated square root of the start times 0.03; reals: 0.03 times the square root beyond one), reals rounded to the sensitivity's decimals, clamped to the type. FieldMouseDragger on the label drives it (Shift faster, Alt slower).
  • Checked by ui_toolkit_numeric_fields (6000.3): structures, classes, defaults, formatting, parsing of 27 texts for each type, commit on blur, drags at each speed from several starts, change events and the theme's styles. The label dragger itself (real pointer drags) isn't compared.
  • Next: vector fields (Vector2Field, Vector3Field and the like); virtualized ListView.