mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-07 04:10:08 +00:00
This commit is contained in:
parent
b915aea53e
commit
76acff4add
16 changed files with 1672 additions and 1653 deletions
|
|
@ -127,15 +127,23 @@ const Rectangle Desktop::getMainMonitorArea (const bool clippedToWorkArea) const
|
|||
|
||||
const Rectangle Desktop::getMonitorAreaContaining (int cx, int cy, const bool clippedToWorkArea) const throw()
|
||||
{
|
||||
Rectangle best (getMainMonitorArea (clippedToWorkArea));
|
||||
double bestDistance = 1.0e10;
|
||||
|
||||
for (int i = getNumDisplayMonitors(); --i > 0;)
|
||||
{
|
||||
const Rectangle rect (getDisplayMonitorCoordinates (i, clippedToWorkArea));
|
||||
const double distance = juce_hypot ((double) (rect.getCentreX() - cx),
|
||||
(double) (rect.getCentreY() - cy));
|
||||
|
||||
if (rect.contains (cx, cy))
|
||||
return rect;
|
||||
if (distance < bestDistance)
|
||||
{
|
||||
bestDistance = distance;
|
||||
best = rect;
|
||||
}
|
||||
}
|
||||
|
||||
return getMainMonitorArea (clippedToWorkArea);
|
||||
return best;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue