mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
It is now possible to cancel attack-via-swiping by moving finger away
This commit is contained in:
parent
6283329aeb
commit
238a02eb5e
@ -100,7 +100,13 @@ void BattleFieldController::panning(bool on, const Point & initialPosition, cons
|
||||
|
||||
void BattleFieldController::gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance)
|
||||
{
|
||||
hoveredHex = getHexAtPosition(initialPosition);
|
||||
Point distance = currentPosition - initialPosition;
|
||||
|
||||
if (distance.length() < settings["battle"]["swipeAttackDistance"].Float())
|
||||
hoveredHex = getHexAtPosition(initialPosition);
|
||||
else
|
||||
hoveredHex = BattleHex::INVALID;
|
||||
|
||||
currentAttackOriginPoint = currentPosition;
|
||||
|
||||
if (pos.isInside(initialPosition))
|
||||
|
@ -286,7 +286,7 @@
|
||||
"type" : "object",
|
||||
"additionalProperties" : false,
|
||||
"default" : {},
|
||||
"required" : [ "speedFactor", "mouseShadow", "cellBorders", "stackRange", "movementHighlightOnHover", "showQueue", "queueSize" ],
|
||||
"required" : [ "speedFactor", "mouseShadow", "cellBorders", "stackRange", "movementHighlightOnHover", "showQueue", "swipeAttackDistance", "queueSize" ],
|
||||
"properties" : {
|
||||
"speedFactor" : {
|
||||
"type" : "number",
|
||||
@ -312,6 +312,10 @@
|
||||
"type" : "boolean",
|
||||
"default" : true
|
||||
},
|
||||
"swipeAttackDistance" : {
|
||||
"type" : "number",
|
||||
"default" : 250
|
||||
},
|
||||
"queueSize" : {
|
||||
"type" : "string",
|
||||
"default" : "auto",
|
||||
|
10
lib/Point.h
10
lib/Point.h
@ -101,6 +101,16 @@ public:
|
||||
return x > std::numeric_limits<int>::min() && y > std::numeric_limits<int>::min();
|
||||
}
|
||||
|
||||
constexpr int lengthSquared() const
|
||||
{
|
||||
return x * x + y * y;
|
||||
}
|
||||
|
||||
int length() const
|
||||
{
|
||||
return std::sqrt(lengthSquared());
|
||||
}
|
||||
|
||||
template <typename Handler>
|
||||
void serialize(Handler &h, const int version)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user