mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 11:43:19 +08:00
Rename Tapeable to Tapable
This commit is contained in:
committed by
Erick (CptBlackPixel)
parent
f18e6bbea1
commit
a349754428
@ -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>();
|
||||
|
||||
@ -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() => [];
|
||||
}
|
||||
Reference in New Issue
Block a user