提交 13dc6e21 编写于 作者: A Adam Barth

left + right mouse button causes dart exception

We should remove the state from our map only if the last button is going up.

Fixes #260

R=chinmaygarde@google.com

Review URL: https://codereview.chromium.org/1215743003.
上级 c06fc958
......@@ -9,6 +9,17 @@ import '../base/hit_test.dart';
import 'box.dart';
import 'object.dart';
int _hammingWeight(int value) {
if (value == 0)
return 0;
int weight = 0;
for (int i = 0; i < value.bitLength; ++i) {
if (value & (1 << i) != 0)
++weight;
}
return weight;
}
class PointerState {
PointerState({ this.result, this.lastPosition });
HitTestResult result;
......@@ -104,7 +115,8 @@ class SkyBinding {
case 'pointerup':
case 'pointercancel':
state = _stateForPointer[event.pointer];
_stateForPointer.remove(event.pointer);
if (_hammingWeight(event.buttons) <= 1)
_stateForPointer.remove(event.pointer);
break;
case 'pointermove':
state = _stateForPointer[event.pointer];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册