1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-16 00:34:19 +00:00

Small change to method in RectanglePlacement and Drawable to use Rectangles instead of bare coordinates. Fix to make ValueTree::sort use an UndoManager, and to prevent different mouse buttons being interpreted as a double-click.

This commit is contained in:
Julian Storer 2010-10-18 16:04:32 +01:00
parent 85c32498dc
commit b80bb4bf38
15 changed files with 90 additions and 96 deletions

View file

@ -179,7 +179,7 @@ public:
if (current != 0)
{
registerMouseDown (screenPos, time, current);
registerMouseDown (screenPos, time, current, buttonState);
sendMouseDown (current, screenPos, time);
}
}
@ -328,16 +328,10 @@ public:
for (int i = 1; i < numElementsInArray (mouseDowns); ++i)
{
if (mouseDowns[0].time - mouseDowns[i].time < (int) (MouseEvent::getDoubleClickTimeout() * (1.0 + 0.25 * (i - 1)))
&& abs (mouseDowns[0].position.getX() - mouseDowns[i].position.getX()) < 8
&& abs (mouseDowns[0].position.getY() - mouseDowns[i].position.getY()) < 8)
{
if (mouseDowns[0].canBePartOfMultipleClickWith (mouseDowns[1], (int) (MouseEvent::getDoubleClickTimeout() * (1.0 + 0.25 * (i - 1)))))
++numClicks;
}
else
{
break;
}
}
}
@ -457,13 +451,23 @@ private:
Point<int> position;
int64 time;
Component* component;
ModifierKeys buttons;
bool canBePartOfMultipleClickWith (const RecentMouseDown& other, int maxTimeBetween) const
{
return time - other.time < maxTimeBetween
&& abs (position.getX() - other.position.getX()) < 8
&& abs (position.getY() - other.position.getY()) < 8
&& buttons == other.buttons;;
}
};
RecentMouseDown mouseDowns[4];
bool mouseMovedSignificantlySincePressed;
int64 lastTime;
void registerMouseDown (const Point<int>& screenPos, const int64 time, Component* const component) throw()
void registerMouseDown (const Point<int>& screenPos, const int64 time,
Component* const component, const ModifierKeys& modifiers) throw()
{
for (int i = numElementsInArray (mouseDowns); --i > 0;)
mouseDowns[i] = mouseDowns[i - 1];
@ -471,6 +475,7 @@ private:
mouseDowns[0].position = screenPos;
mouseDowns[0].time = time;
mouseDowns[0].component = component;
mouseDowns[0].buttons = modifiers.withOnlyMouseButtons();
mouseMovedSignificantlySincePressed = false;
}