Sdk/Canvas: Fix warning and optimize integer to float conversion

This commit is contained in:
Lynix 2017-01-18 23:39:22 +01:00
parent ec795269ad
commit 27b000470d
1 changed files with 2 additions and 1 deletions

View File

@ -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)