mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 03:15:43 +08:00
Making Flame events aware of camera (#755)
* some initial refactoring * Fixing examples and joystick component * Fixing examples * Addressing comments from PR * Fixing tutorials * Updating docs * Fixing tests * PR followup * A big follow up * linting * doc nit * Changelog and fix tutorial * Addressing comments * Fixing BaseGame project and scale offset methods * Formatting * doc suggestions * Update packages/flame/lib/src/gestures/events.dart Co-authored-by: Luan Nico <luanpotter27@gmail.com> * Hopefully, the last follow up * Linting and adding dart-code-metrics again * fixing tutorial Co-authored-by: Luan Nico <luanpotter27@gmail.com>
This commit is contained in:
@ -5,6 +5,7 @@ import 'package:flame/components.dart';
|
||||
import 'package:flame/extensions.dart';
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:flame/geometry.dart';
|
||||
import 'package:flame/gestures.dart';
|
||||
import 'package:flame/palette.dart';
|
||||
import 'package:flutter/material.dart' hide Image, Draggable;
|
||||
|
||||
@ -81,14 +82,14 @@ abstract class MyCollidable extends PositionComponent
|
||||
}
|
||||
|
||||
@override
|
||||
bool onDragUpdate(int pointerId, DragUpdateDetails details) {
|
||||
bool onDragUpdate(int pointerId, _) {
|
||||
_isDragged = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
bool onDragEnd(int pointerId, DragEndDetails details) {
|
||||
velocity.setFrom(details.velocity.pixelsPerSecond.toVector2() / 10);
|
||||
bool onDragEnd(int pointerId, DragEndInfo event) {
|
||||
velocity.setFrom(event.velocity / 10);
|
||||
_isDragged = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user