mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +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)
|
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;
|
currentAttackOriginPoint = currentPosition;
|
||||||
|
|
||||||
if (pos.isInside(initialPosition))
|
if (pos.isInside(initialPosition))
|
||||||
|
@ -286,7 +286,7 @@
|
|||||||
"type" : "object",
|
"type" : "object",
|
||||||
"additionalProperties" : false,
|
"additionalProperties" : false,
|
||||||
"default" : {},
|
"default" : {},
|
||||||
"required" : [ "speedFactor", "mouseShadow", "cellBorders", "stackRange", "movementHighlightOnHover", "showQueue", "queueSize" ],
|
"required" : [ "speedFactor", "mouseShadow", "cellBorders", "stackRange", "movementHighlightOnHover", "showQueue", "swipeAttackDistance", "queueSize" ],
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"speedFactor" : {
|
"speedFactor" : {
|
||||||
"type" : "number",
|
"type" : "number",
|
||||||
@ -312,6 +312,10 @@
|
|||||||
"type" : "boolean",
|
"type" : "boolean",
|
||||||
"default" : true
|
"default" : true
|
||||||
},
|
},
|
||||||
|
"swipeAttackDistance" : {
|
||||||
|
"type" : "number",
|
||||||
|
"default" : 250
|
||||||
|
},
|
||||||
"queueSize" : {
|
"queueSize" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"default" : "auto",
|
"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();
|
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>
|
template <typename Handler>
|
||||||
void serialize(Handler &h, const int version)
|
void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user