Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(866)

Unified Diff: sky/sdk/lib/rendering/sky_binding.dart

Issue 1215743003: left + right mouse button causes dart exception (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/rendering/sky_binding.dart
diff --git a/sky/sdk/lib/rendering/sky_binding.dart b/sky/sdk/lib/rendering/sky_binding.dart
index 1dc76019fc14fda318a4f9ce1a42f09667bdb8a1..b18ca94c9b37b4f67284b4eef683fa96ab1f0c5f 100644
--- a/sky/sdk/lib/rendering/sky_binding.dart
+++ b/sky/sdk/lib/rendering/sky_binding.dart
@@ -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];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698