1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fix to make sure that ResizableWindow can't accidentally be dragged without first getting a mouseDown event.

This commit is contained in:
jules 2015-03-25 15:14:46 +00:00
parent e3dfaff0db
commit 72b49689bf
2 changed files with 20 additions and 12 deletions

View file

@ -22,24 +22,22 @@
==============================================================================
*/
ResizableWindow::ResizableWindow (const String& name,
const bool addToDesktop_)
: TopLevelWindow (name, addToDesktop_),
ResizableWindow::ResizableWindow (const String& name, bool shouldAddToDesktop)
: TopLevelWindow (name, shouldAddToDesktop),
ownsContentComponent (false),
resizeToFitContent (false),
fullscreen (false),
dragStarted (false),
constrainer (nullptr)
#if JUCE_DEBUG
, hasBeenResized (false)
#endif
{
initialise (addToDesktop_);
initialise (shouldAddToDesktop);
}
ResizableWindow::ResizableWindow (const String& name,
Colour backgroundColour_,
const bool addToDesktop_)
: TopLevelWindow (name, addToDesktop_),
ResizableWindow::ResizableWindow (const String& name, Colour bkgnd, bool shouldAddToDesktop)
: TopLevelWindow (name, shouldAddToDesktop),
ownsContentComponent (false),
resizeToFitContent (false),
fullscreen (false),
@ -48,9 +46,9 @@ ResizableWindow::ResizableWindow (const String& name,
, hasBeenResized (false)
#endif
{
setBackgroundColour (backgroundColour_);
setBackgroundColour (bkgnd);
initialise (addToDesktop_);
initialise (shouldAddToDesktop);
}
ResizableWindow::~ResizableWindow()
@ -574,15 +572,23 @@ bool ResizableWindow::restoreWindowStateFromString (const String& s)
void ResizableWindow::mouseDown (const MouseEvent& e)
{
if (! isFullScreen())
{
dragStarted = true;
dragger.startDraggingComponent (this, e);
}
}
void ResizableWindow::mouseDrag (const MouseEvent& e)
{
if (! isFullScreen())
if (dragStarted)
dragger.dragComponent (this, e, constrainer);
}
void ResizableWindow::mouseUp (const MouseEvent&)
{
dragStarted = false;
}
//==============================================================================
#if JUCE_DEBUG
void ResizableWindow::addChildComponent (Component* const child, int zOrder)