Browse Source

Android: Fixed a bug where getCurrentRawMousePosition() would incorrectly return the mouse position local to the peer that had the last touch event

tags/2021-05-28
hogliux 8 years ago
parent
commit
8892026ec7
1 changed files with 8 additions and 8 deletions
  1. +8
    -8
      modules/juce_gui_basics/native/juce_android_Windowing.cpp

+ 8
- 8
modules/juce_gui_basics/native/juce_android_Windowing.cpp View File

@@ -265,20 +265,20 @@ public:
setFullScreen (true);
}
Point<int> getScreenPosition() const
Point<float> getScreenPosition() const
{
return Point<int> (view.callIntMethod (ComponentPeerView.getLeft),
view.callIntMethod (ComponentPeerView.getTop)) / scale;
return Point<float> (view.callIntMethod (ComponentPeerView.getLeft),
view.callIntMethod (ComponentPeerView.getTop)) / scale;
}
Point<float> localToGlobal (Point<float> relativePosition) override
{
return relativePosition + getScreenPosition().toFloat();
return relativePosition + getScreenPosition();
}
Point<float> globalToLocal (Point<float> screenPosition) override
{
return screenPosition - getScreenPosition().toFloat();
return screenPosition - getScreenPosition();
}
void setMinimised (bool /*shouldBeMinimised*/) override
@@ -407,7 +407,7 @@ public:
void handleMouseDownCallback (int index, Point<float> sysPos, int64 time)
{
Point<float> pos = sysPos / scale;
lastMousePos = pos;
lastMousePos = localToGlobal (pos);
// this forces a mouse-enter/up event, in case for some reason we didn't get a mouse-up before.
handleMouseEvent (MouseInputSource::InputSourceType::touch, pos, currentModifiers.withoutMouseButtons(),
@@ -420,7 +420,7 @@ public:
void handleMouseDragCallback (int index, Point<float> pos, int64 time)
{
pos /= scale;
lastMousePos = pos;
lastMousePos = localToGlobal (pos);
jassert (index < 64);
touchesDown = (touchesDown | (1 << (index & 63)));
@@ -432,7 +432,7 @@ public:
void handleMouseUpCallback (int index, Point<float> pos, int64 time)
{
pos /= scale;
lastMousePos = pos;
lastMousePos = localToGlobal (pos);
jassert (index < 64);
touchesDown = (touchesDown & ~(1 << (index & 63)));


Loading…
Cancel
Save