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

Unified Diff: sky/framework/components/ink_well.dart

Issue 1092423003: [Effen] Reduce splashes when scrolling. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix comments from eseidel Created 5 years, 8 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 | « sky/framework/components/ink_splash.dart ('k') | sky/framework/components/scrollable.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/components/ink_well.dart
diff --git a/sky/framework/components/ink_well.dart b/sky/framework/components/ink_well.dart
index 205e9f38f771ea6d43186337859821b7ac406a2f..096fa007963b8465bbb0fdaf8b554921e9436857 100644
--- a/sky/framework/components/ink_well.dart
+++ b/sky/framework/components/ink_well.dart
@@ -6,8 +6,9 @@ import '../fn.dart';
import 'dart:collection';
import 'dart:sky' as sky;
import 'ink_splash.dart';
+import 'scrollable.dart';
-class InkWell extends Component {
+class InkWell extends Component implements ScrollClient {
static final Style _containmentStyleHack = new Style('''
transform: translateX(0);''');
@@ -55,9 +56,30 @@ class InkWell extends Component {
pointer: event.primaryPointer,
onDone: () { _splashDone(splash); });
_splashes.add(splash);
+ UINode node = parent;
+ while (node != null) {
+ if (node is Scrollable)
+ node.registerScrollClient(this);
+ node = node.parent;
+ }
});
}
+ bool ancestorScrolled(Scrollable ancestor) {
+ _abortSplashes();
+ return false;
+ }
+
+ void handleRemoved() {
+ UINode node = parent;
+ while (node != null) {
+ if (node is Scrollable)
+ node.unregisterScrollClient(this);
+ node = node.parent;
+ }
+ super.handleRemoved();
+ }
+
void _confirmSplash(sky.GestureEvent event) {
if (_splashes == null)
return;
@@ -65,6 +87,14 @@ class InkWell extends Component {
.forEach((splash) { splash.confirm(); });
}
+ void _abortSplashes() {
+ if (_splashes == null)
+ return;
+ setState(() {
+ _splashes.forEach((s) { s.abort(); });
+ });
+ }
+
void _cancelSplashes(sky.Event event) {
if (_splashes == null)
return;
« no previous file with comments | « sky/framework/components/ink_splash.dart ('k') | sky/framework/components/scrollable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698