mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 14:50:05 +00:00
Mouse picking boilerplate
This commit is contained in:
parent
c7487281ad
commit
38b56be7c4
10 changed files with 115 additions and 17 deletions
|
|
@ -76,6 +76,26 @@ void DrawLayer::Deinitialize()
|
|||
}
|
||||
}
|
||||
|
||||
bool DrawLayer::RunMousePicking(
|
||||
const QMapLibreGL::CustomLayerRenderParameters& params)
|
||||
{
|
||||
bool itemPicked = false;
|
||||
|
||||
// For each draw item in the draw list in reverse
|
||||
for (auto it = p->drawList_.rbegin(); it != p->drawList_.rend(); ++it)
|
||||
{
|
||||
// Run mouse picking on each draw item
|
||||
if ((*it)->RunMousePicking(params))
|
||||
{
|
||||
// If a draw item was picked, don't process additional items
|
||||
itemPicked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return itemPicked;
|
||||
}
|
||||
|
||||
void DrawLayer::AddDrawItem(const std::shared_ptr<gl::draw::DrawItem>& drawItem)
|
||||
{
|
||||
p->drawList_.push_back(drawItem);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue