print stack

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-02-26 23:29:36 +08:00
parent 17f1c18c92
commit 0a52d64900
2 changed files with 21 additions and 6 deletions

View File

@ -503,8 +503,21 @@ class InputModel {
} }
x += d.x; x += d.x;
y += d.y; y += d.y;
var evtX = 0;
var evtY = 0;
try {
x.round();
y.round();
} catch (e) {
debugPrintStack(
label: 'canvasModel.scale value ${canvasModel.scale}, $e');
return;
}
if (x < d.x || y < d.y || x > (d.x + d.width) || y > (d.y + d.height)) { if (evtX < d.x ||
evtY < d.y ||
evtX > (d.x + d.width) ||
evtY > (d.y + d.height)) {
// If left mouse up, no early return. // If left mouse up, no early return.
if (evt['buttons'] != kPrimaryMouseButton || type != 'up') { if (evt['buttons'] != kPrimaryMouseButton || type != 'up') {
return; return;
@ -512,12 +525,12 @@ class InputModel {
} }
if (type != '') { if (type != '') {
x = 0; evtX = 0;
y = 0; evtY = 0;
} }
evt['x'] = '${x.round()}'; evt['x'] = '$evtX';
evt['y'] = '${y.round()}'; evt['y'] = '$evtY';
var buttons = ''; var buttons = '';
switch (evt['buttons']) { switch (evt['buttons']) {
case kPrimaryMouseButton: case kPrimaryMouseButton:

View File

@ -803,7 +803,9 @@ class CanvasModel with ChangeNotifier {
dyOffset = (y - dh * (y / size.height) - _y).toInt(); dyOffset = (y - dh * (y / size.height) - _y).toInt();
} }
} catch (e) { } catch (e) {
// Unhandled Exception: Unsupported operation: Infinity or NaN toInt debugPrintStack(
label:
'(x,y) ($x,$y), (_x,_y) ($_x,$_y), _scale $_scale, display size (${getDisplayWidth()},${getDisplayHeight()}), size $size, , $e');
return; return;
} }