Sdk/Canvas: Fix warning and optimize integer to float conversion
This commit is contained in:
parent
ec795269ad
commit
27b000470d
|
|
@ -84,11 +84,12 @@ namespace Ndk
|
||||||
const WidgetBox* bestEntry = nullptr;
|
const WidgetBox* bestEntry = nullptr;
|
||||||
float bestEntryArea = std::numeric_limits<float>::infinity();
|
float bestEntryArea = std::numeric_limits<float>::infinity();
|
||||||
|
|
||||||
|
Nz::Vector3f mousePos(float(event.x), float(event.y), 0.f);
|
||||||
for (const WidgetBox& entry : m_widgetBoxes)
|
for (const WidgetBox& entry : m_widgetBoxes)
|
||||||
{
|
{
|
||||||
const Nz::Boxf& box = entry.box;
|
const Nz::Boxf& box = entry.box;
|
||||||
|
|
||||||
if (box.Contains(Nz::Vector3f(event.x, event.y, 0.f)))
|
if (box.Contains(mousePos))
|
||||||
{
|
{
|
||||||
float area = box.width * box.height;
|
float area = box.width * box.height;
|
||||||
if (area < bestEntryArea)
|
if (area < bestEntryArea)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue