feat: Add isDragged in DragCallbacks mixin (#2472)

Adding a isDragged state for DragCallbacks mixin. This was available in the Draggable mixin.
This commit is contained in:
DevKage
2023-04-07 17:09:28 +05:30
committed by GitHub
parent e7ebf8e55a
commit de630a1c3a
8 changed files with 76 additions and 33 deletions

View File

@ -90,7 +90,6 @@ abstract class MyCollidable extends PositionComponent
late final Paint _dragIndicatorPaint;
final ScreenHitbox screenHitbox;
ShapeHitbox? hitbox;
bool isDragged = false;
MyCollidable(
Vector2 position,
@ -154,14 +153,9 @@ abstract class MyCollidable extends PositionComponent
}
@override
void onDragStart(DragStartEvent info) {
isDragged = true;
}
@override
void onDragEnd(DragEndEvent info) {
velocity.setFrom(info.velocity / 10);
isDragged = false;
void onDragEnd(DragEndEvent event) {
super.onDragEnd(event);
velocity.setFrom(event.velocity / 10);
}
}