Skip to content

Commit

Permalink
quench warning in imagepanel, fix #369 from original nanogui repo
Browse files Browse the repository at this point in the history
  • Loading branch information
wjakob committed Apr 22, 2019
1 parent 11ef46f commit 37eb249
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/imagepanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ int ImagePanel::index_for_position(const Vector2i &p) const {
(float)(m_thumb_size + m_spacing);
float icon_region = m_thumb_size / (float)(m_thumb_size + m_spacing);
bool over_image = pp.x() - std::floor(pp.x()) < icon_region &&
pp.y() - std::floor(pp.y()) < icon_region;
pp.y() - std::floor(pp.y()) < icon_region;
Vector2i grid_pos(pp), grid = grid_size();
over_image &= all(grid_pos >= 0 && grid_pos < grid);
over_image &= all(grid_pos >= 0 && grid_pos < grid && pp >= 0);
return over_image ? (grid_pos.x() + grid_pos.y() * grid.x()) : -1;
}

Expand All @@ -47,7 +47,7 @@ bool ImagePanel::mouse_motion_event(const Vector2i &p, const Vector2i & /* rel *
bool ImagePanel::mouse_button_event(const Vector2i &p, int /* button */, bool down,
int /* modifiers */) {
int index = index_for_position(p);
if (index >= 0 && index < m_images.size() && m_callback && down)
if (index >= 0 && index < (int) m_images.size() && m_callback && down)
m_callback(index);
return true;
}
Expand Down

0 comments on commit 37eb249

Please sign in to comment.