mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed an iOS multitouch bug and added MouseInputSource::offscreenMousePos to replace some magic numbers
This commit is contained in:
parent
b27116607f
commit
b1c4d981da
6 changed files with 17 additions and 17 deletions
|
|
@ -88,7 +88,7 @@ public:
|
|||
{
|
||||
if (auto* peer = safeOldComponent->getPeer())
|
||||
{
|
||||
peer->handleMouseEvent (MouseInputSource::InputSourceType::mouse, { -1.0f, -1.0f }, mods,
|
||||
peer->handleMouseEvent (MouseInputSource::InputSourceType::mouse, MouseInputSource::offscreenMousePos, mods,
|
||||
MouseInputSource::invalidPressure, MouseInputSource::invalidOrientation, Time::currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,8 @@ public:
|
|||
|
||||
Point<float> getRawScreenPosition() const noexcept
|
||||
{
|
||||
return unboundedMouseOffset + MouseInputSource::getCurrentRawMousePosition();
|
||||
return unboundedMouseOffset + (inputType != MouseInputSource::InputSourceType::touch ? MouseInputSource::getCurrentRawMousePosition()
|
||||
: lastScreenPos);
|
||||
}
|
||||
|
||||
void setScreenPosition (Point<float> p)
|
||||
|
|
@ -271,7 +272,9 @@ public:
|
|||
if (newScreenPos != lastScreenPos || forceUpdate)
|
||||
{
|
||||
cancelPendingUpdate();
|
||||
lastScreenPos = newScreenPos;
|
||||
|
||||
if (newScreenPos != MouseInputSource::offscreenMousePos)
|
||||
lastScreenPos = newScreenPos;
|
||||
|
||||
if (auto* current = getComponentUnderMouse())
|
||||
{
|
||||
|
|
@ -648,6 +651,8 @@ const float MouseInputSource::invalidRotation = 0.0f;
|
|||
const float MouseInputSource::invalidTiltX = 0.0f;
|
||||
const float MouseInputSource::invalidTiltY = 0.0f;
|
||||
|
||||
const Point<float> MouseInputSource::offscreenMousePos { -10.0f, -10.0f };
|
||||
|
||||
// Deprecated method
|
||||
bool MouseInputSource::hasMouseMovedSignificantlySincePressed() const noexcept { return pimpl->hasMouseMovedSignificantlySincePressed(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -237,6 +237,11 @@ public:
|
|||
static const float invalidTiltX;
|
||||
static const float invalidTiltY;
|
||||
|
||||
/** An offscreen mouse position used when triggering mouse exits where we don't want to move
|
||||
the cursor over an existing component.
|
||||
*/
|
||||
static const Point<float> offscreenMousePos;
|
||||
|
||||
#if ! DOXYGEN
|
||||
// This method has been deprecated and replaced with the isLongPressOrDrag() and hasMovedSignificantlySincePressed()
|
||||
// methods. If you want the same behaviour you should use isLongPressOrDrag() which accounts for the amount of time
|
||||
|
|
|
|||
|
|
@ -900,7 +900,7 @@ void UIViewComponentPeer::handleTouches (UIEvent* event, const bool isDown, cons
|
|||
|
||||
if (isUp || isCancel)
|
||||
{
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, Point<float> (-1.0f, -1.0f), modsToSend,
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, MouseInputSource::offscreenMousePos, modsToSend,
|
||||
MouseInputSource::invalidPressure, MouseInputSource::invalidOrientation, time, {}, touchIndex);
|
||||
|
||||
if (! isValidPeer (this))
|
||||
|
|
|
|||
|
|
@ -632,7 +632,7 @@ public:
|
|||
sendMouseEvent (ev);
|
||||
else
|
||||
// moved into another window which overlaps this one, so trigger an exit
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::mouse, { -1.0f, -1.0f }, ModifierKeys::currentModifiers,
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::mouse, MouseInputSource::offscreenMousePos, ModifierKeys::currentModifiers,
|
||||
getMousePressure (ev), MouseInputSource::invalidOrientation, getMouseTime (ev));
|
||||
|
||||
showArrowCursorIfNeeded();
|
||||
|
|
|
|||
|
|
@ -621,9 +621,6 @@ int64 getMouseEventTime()
|
|||
return eventTimeOffset + thisMessageTime;
|
||||
}
|
||||
|
||||
Point<float> juce_lastTouchPos;
|
||||
static JUCE_CONSTEXPR Point<float> juce_invalidTouchPos { -10.0f, -10.0f };
|
||||
|
||||
//==============================================================================
|
||||
const int extendedKeyModifier = 0x10000;
|
||||
|
||||
|
|
@ -2442,8 +2439,6 @@ private:
|
|||
//==============================================================================
|
||||
void doMouseEvent (Point<float> position, float pressure, float orientation = 0.0f, ModifierKeys mods = ModifierKeys::currentModifiers)
|
||||
{
|
||||
juce_lastTouchPos = juce_invalidTouchPos;
|
||||
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::mouse, position, mods, pressure, orientation, getMouseEventTime());
|
||||
}
|
||||
|
||||
|
|
@ -2772,8 +2767,6 @@ private:
|
|||
const auto pressure = touchPressure;
|
||||
auto modsToSend = ModifierKeys::currentModifiers;
|
||||
|
||||
juce_lastTouchPos = pos;
|
||||
|
||||
if (isDown)
|
||||
{
|
||||
ModifierKeys::currentModifiers = ModifierKeys::currentModifiers.withoutMouseButtons().withFlags (ModifierKeys::leftButtonModifier);
|
||||
|
|
@ -2808,7 +2801,7 @@ private:
|
|||
|
||||
if (isUp)
|
||||
{
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, juce_invalidTouchPos, ModifierKeys::currentModifiers.withoutMouseButtons(),
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::touch, MouseInputSource::offscreenMousePos, ModifierKeys::currentModifiers.withoutMouseButtons(),
|
||||
pressure, orientation, time, {}, touchIndex);
|
||||
|
||||
if (! isValidPeer (this))
|
||||
|
|
@ -2921,7 +2914,7 @@ private:
|
|||
|
||||
if (isUp)
|
||||
{
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::pen, juce_invalidTouchPos, ModifierKeys::currentModifiers,
|
||||
handleMouseEvent (MouseInputSource::InputSourceType::pen, MouseInputSource::offscreenMousePos, ModifierKeys::currentModifiers,
|
||||
pressure, MouseInputSource::invalidOrientation, time, penDetails);
|
||||
|
||||
if (! isValidPeer (this))
|
||||
|
|
@ -4288,9 +4281,6 @@ bool MouseInputSource::SourceList::canUseTouch()
|
|||
|
||||
Point<float> MouseInputSource::getCurrentRawMousePosition()
|
||||
{
|
||||
if (juce_lastTouchPos != juce_invalidTouchPos)
|
||||
return juce_lastTouchPos;
|
||||
|
||||
POINT mousePos;
|
||||
GetCursorPos (&mousePos);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue