| @@ -211,7 +211,8 @@ public: | |||||
| if (auto* current = getComponentUnderMouse()) | if (auto* current = getComponentUnderMouse()) | ||||
| { | { | ||||
| registerMouseDown (screenPos, time, *current, buttonState); | |||||
| registerMouseDown (screenPos, time, *current, buttonState, | |||||
| inputType == MouseInputSource::InputSourceType::touch); | |||||
| sendMouseDown (*current, screenPos, time); | sendMouseDown (*current, screenPos, time); | ||||
| } | } | ||||
| } | } | ||||
| @@ -522,23 +523,26 @@ private: | |||||
| Time time; | Time time; | ||||
| ModifierKeys buttons; | ModifierKeys buttons; | ||||
| uint32 peerID = 0; | uint32 peerID = 0; | ||||
| bool isTouch = false; | |||||
| bool canBePartOfMultipleClickWith (const RecentMouseDown& other, int maxTimeBetweenMs) const noexcept | bool canBePartOfMultipleClickWith (const RecentMouseDown& other, int maxTimeBetweenMs) const noexcept | ||||
| { | { | ||||
| return time - other.time < RelativeTime::milliseconds (maxTimeBetweenMs) | return time - other.time < RelativeTime::milliseconds (maxTimeBetweenMs) | ||||
| && std::abs (position.x - other.position.x) < 8 | |||||
| && std::abs (position.y - other.position.y) < 8 | |||||
| && std::abs (position.x - other.position.x) < getPositionToleranceForInputType() | |||||
| && std::abs (position.y - other.position.y) < getPositionToleranceForInputType() | |||||
| && buttons == other.buttons | && buttons == other.buttons | ||||
| && peerID == other.peerID; | && peerID == other.peerID; | ||||
| } | } | ||||
| int getPositionToleranceForInputType() const noexcept { return isTouch ? 25 : 8; } | |||||
| }; | }; | ||||
| RecentMouseDown mouseDowns[4]; | RecentMouseDown mouseDowns[4]; | ||||
| Time lastTime; | Time lastTime; | ||||
| bool mouseMovedSignificantlySincePressed = false; | bool mouseMovedSignificantlySincePressed = false; | ||||
| void registerMouseDown (Point<float> screenPos, Time time, | |||||
| Component& component, const ModifierKeys modifiers) noexcept | |||||
| void registerMouseDown (Point<float> screenPos, Time time, Component& component, | |||||
| const ModifierKeys modifiers, bool isTouchSource) noexcept | |||||
| { | { | ||||
| for (int i = numElementsInArray (mouseDowns); --i > 0;) | for (int i = numElementsInArray (mouseDowns); --i > 0;) | ||||
| mouseDowns[i] = mouseDowns[i - 1]; | mouseDowns[i] = mouseDowns[i - 1]; | ||||
| @@ -546,6 +550,7 @@ private: | |||||
| mouseDowns[0].position = screenPos; | mouseDowns[0].position = screenPos; | ||||
| mouseDowns[0].time = time; | mouseDowns[0].time = time; | ||||
| mouseDowns[0].buttons = modifiers.withOnlyMouseButtons(); | mouseDowns[0].buttons = modifiers.withOnlyMouseButtons(); | ||||
| mouseDowns[0].isTouch = isTouchSource; | |||||
| if (auto* peer = component.getPeer()) | if (auto* peer = component.getPeer()) | ||||
| mouseDowns[0].peerID = peer->getUniqueID(); | mouseDowns[0].peerID = peer->getUniqueID(); | ||||