Skip to content

Commit 37eb249

Browse files
committed
quench warning in imagepanel, fix #369 from original nanogui repo
1 parent 11ef46f commit 37eb249

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/imagepanel.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ int ImagePanel::index_for_position(const Vector2i &p) const {
3232
(float)(m_thumb_size + m_spacing);
3333
float icon_region = m_thumb_size / (float)(m_thumb_size + m_spacing);
3434
bool over_image = pp.x() - std::floor(pp.x()) < icon_region &&
35-
pp.y() - std::floor(pp.y()) < icon_region;
35+
pp.y() - std::floor(pp.y()) < icon_region;
3636
Vector2i grid_pos(pp), grid = grid_size();
37-
over_image &= all(grid_pos >= 0 && grid_pos < grid);
37+
over_image &= all(grid_pos >= 0 && grid_pos < grid && pp >= 0);
3838
return over_image ? (grid_pos.x() + grid_pos.y() * grid.x()) : -1;
3939
}
4040

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

0 commit comments

Comments
 (0)