diff --git a/packages/flutter/lib/src/foundation/_bitfield_web.dart b/packages/flutter/lib/src/foundation/_bitfield_web.dart index 2fa843a201..e27377a200 100644 --- a/packages/flutter/lib/src/foundation/_bitfield_web.dart +++ b/packages/flutter/lib/src/foundation/_bitfield_web.dart @@ -5,7 +5,13 @@ import 'bitfield.dart' as bitfield; /// The dart:html implementation of [bitfield.kMaxUnsignedSMI]. -const int kMaxUnsignedSMI = 0; +/// +/// This value is used as an optimization to coerse some numbers to be within +/// the SMI range and avoid heap allocations. Because number encoding is +/// VM-specific, there's no guarantee that this optimization will be effective +/// on all JavaScript engines. The value picked here should be correct, but it +/// does not have to guarantee efficiency. +const int kMaxUnsignedSMI = -1; /// The dart:html implementation of [bitfield.Bitfield]. class BitField implements bitfield.BitField { diff --git a/packages/flutter/lib/src/gestures/events.dart b/packages/flutter/lib/src/gestures/events.dart index b36e9d2058..8df0e8f3c0 100644 --- a/packages/flutter/lib/src/gestures/events.dart +++ b/packages/flutter/lib/src/gestures/events.dart @@ -116,7 +116,8 @@ const int kTouchContact = kPrimaryButton; /// The bit of [PointerEvent.buttons] that corresponds to the nth mouse button. /// -/// The `number` argument can be at most 62. +/// The `number` argument can be at most 62 in Flutter for mobile and desktop, +/// and at most 32 on Flutter for web. /// /// See [kPrimaryMouseButton], [kSecondaryMouseButton], [kMiddleMouseButton], /// [kBackMouseButton], and [kForwardMouseButton] for semantic names for some @@ -125,7 +126,8 @@ int nthMouseButton(int number) => (kPrimaryMouseButton << (number - 1)) & kMaxUn /// The bit of [PointerEvent.buttons] that corresponds to the nth stylus button. /// -/// The `number` argument can be at most 62. +/// The `number` argument can be at most 62 in Flutter for mobile and desktop, +/// and at most 32 on Flutter for web. /// /// See [kPrimaryStylusButton] and [kSecondaryStylusButton] for semantic names /// for some stylus buttons.