Rename Tapeable to Tapable

This commit is contained in:
Lukas Klingsbo
2019-09-24 12:39:31 -03:00
committed by Erick (CptBlackPixel)
parent f18e6bbea1
commit a349754428
8 changed files with 33 additions and 33 deletions

View File

@ -1,7 +1,7 @@
import 'dart:ui';
import 'package:flame/components/mixins/has_game_ref.dart';
import 'package:flame/components/mixins/tapeable.dart';
import 'package:flame/components/mixins/tapable.dart';
import 'package:flame/game.dart';
import 'package:ordered_set/comparing.dart';
import 'package:ordered_set/ordered_set.dart';
@ -37,7 +37,7 @@ import 'mixins/resizable.dart';
/// }
/// ```
///
mixin ComposedComponent on Component, HasGameRef, Tapeable {
mixin ComposedComponent on Component, HasGameRef, Tapable {
OrderedSet<Component> components =
OrderedSet(Comparing.on((c) => c.priority()));
@ -67,9 +67,9 @@ mixin ComposedComponent on Component, HasGameRef, Tapeable {
components.add(c);
}
// this is an important override for the Tapeable mixin
// this is an important override for the Tapable mixin
@override
Iterable<Tapeable> tapeableChildren() => _findT<Tapeable>();
Iterable<Tapable> tapableChildren() => _findT<Tapable>();
// this is an important override for the Resizable mixin
Iterable<Resizable> resizableChildren() => _findT<Resizable>();

View File

@ -2,7 +2,7 @@ import 'dart:ui';
import 'package:flutter/gestures.dart';
mixin Tapeable {
mixin Tapable {
Rect toRect();
void onTapCancel() {}
@ -15,23 +15,23 @@ mixin Tapeable {
if (checkTapOverlap(details.globalPosition)) {
onTapDown(details);
}
tapeableChildren().forEach((c) => c.handleTapDown(details));
tapableChildren().forEach((c) => c.handleTapDown(details));
}
void handleTapUp(TapUpDetails details) {
if (checkTapOverlap(details.globalPosition)) {
onTapUp(details);
}
tapeableChildren().forEach((c) => c.handleTapUp(details));
tapableChildren().forEach((c) => c.handleTapUp(details));
}
void handleTapCancel() {
onTapCancel();
tapeableChildren().forEach((c) => c.handleTapCancel());
tapableChildren().forEach((c) => c.handleTapCancel());
}
/// Overwrite this to add children to this [Tapeable].
/// Overwrite this to add children to this [Tapable].
///
/// If a [Tapeable] has children, its children be taped as well.
Iterable<Tapeable> tapeableChildren() => [];
/// If a [Tapable] has children, its children be taped as well.
Iterable<Tapable> tapableChildren() => [];
}