From ff7bc8c1f0a535dffd9f72795fc625a5f58da52b Mon Sep 17 00:00:00 2001 From: klockky Date: Sat, 23 May 2026 07:04:04 +0000 Subject: [PATCH] =?UTF-8?q?debug:=20=D0=B2=D0=B8=D0=B7=D1=83=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=B7=D0=B8?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D0=BF=D0=B0=D0=BB=D1=8C=D1=86=D0=B0,=20?= =?UTF-8?q?=D1=86=D0=B5=D0=BD=D1=82=D1=80=D0=BE=D0=B2=20=D0=BA=D0=BD=D0=BE?= =?UTF-8?q?=D0=BF=D0=BE=D0=BA=20=D0=B8=20=D1=81=D0=BE=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D1=8F=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D0=BB=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widgets/message_actions_overlay.dart | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/lib/frontend/widgets/message_actions_overlay.dart b/lib/frontend/widgets/message_actions_overlay.dart index 38801db..80e6ae2 100644 --- a/lib/frontend/widgets/message_actions_overlay.dart +++ b/lib/frontend/widgets/message_actions_overlay.dart @@ -286,6 +286,7 @@ class _MessageActionsLayerState extends State<_MessageActionsLayer> { ), ..._buildButtons(t), _buildLabelBanner(size, t), + _buildDebugOverlay(), ], ), ); @@ -293,6 +294,23 @@ class _MessageActionsLayerState extends State<_MessageActionsLayer> { ); } + Widget _buildDebugOverlay() { + return Positioned.fill( + child: IgnorePointer( + child: CustomPaint( + painter: _DebugPainter( + pointerPosition: widget.controller.pointer, + initialPointer: widget.controller.initialPointer, + buttonCenters: _buttonCenters, + hoveredIndex: _hoveredIndex, + committed: widget.controller.committed, + moved: widget.controller.movedSignificantly, + ), + ), + ), + ); + } + List _buildButtons(double t) { final n = _actions.length; return [ @@ -382,6 +400,79 @@ class _MessageActionsLayerState extends State<_MessageActionsLayer> { } } +class _DebugPainter extends CustomPainter { + final Offset? pointerPosition; + final Offset? initialPointer; + final List buttonCenters; + final int hoveredIndex; + final bool committed; + final bool moved; + + _DebugPainter({ + required this.pointerPosition, + required this.initialPointer, + required this.buttonCenters, + required this.hoveredIndex, + required this.committed, + required this.moved, + }); + + @override + void paint(Canvas canvas, Size size) { + final centerPaint = Paint()..color = const Color(0xFFFFFFFF); + final centerBorder = Paint() + ..color = const Color(0xFF000000) + ..style = PaintingStyle.stroke + ..strokeWidth = 1.5; + for (var i = 0; i < buttonCenters.length; i++) { + canvas.drawCircle(buttonCenters[i], 5, centerPaint); + canvas.drawCircle(buttonCenters[i], 5, centerBorder); + } + + final initial = initialPointer; + if (initial != null) { + final paint = Paint()..color = const Color(0xFFFFEB3B); + canvas.drawCircle(initial, 8, paint); + } + + final p = pointerPosition; + if (p != null) { + final paint = Paint()..color = const Color(0xFFFF1744); + canvas.drawCircle(p, 14, paint); + final border = Paint() + ..color = const Color(0xFFFFFFFF) + ..style = PaintingStyle.stroke + ..strokeWidth = 2; + canvas.drawCircle(p, 14, border); + } + + final textPainter = TextPainter( + text: TextSpan( + text: + 'h=$hoveredIndex c=$committed mov=$moved\n' + 'p=${pointerPosition?.dx.toStringAsFixed(0)},${pointerPosition?.dy.toStringAsFixed(0)}', + style: const TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 14, + fontWeight: FontWeight.w700, + backgroundColor: Color(0xCC000000), + ), + ), + textDirection: TextDirection.ltr, + ); + textPainter.layout(); + textPainter.paint(canvas, const Offset(12, 60)); + } + + @override + bool shouldRepaint(covariant _DebugPainter old) { + return old.pointerPosition != pointerPosition || + old.hoveredIndex != hoveredIndex || + old.committed != committed || + old.moved != moved; + } +} + class _Action { final IconData icon; final String label;