Incorrect on_clicked propagation by HBox and VBox.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Millennium Duel |
Fix Released
|
High
|
Adam Malinowski |
Bug Description
In function
HBox::on_clicked
there is a piece of code:
for(auto i : children){
sum += i.size;
if(p.x <= sum) { // This item was clicked!
return;
}
sum += spacing;
if(p.x <= sum){ // Empty space between items was clicked
return;
}
}
It probably causes click event to be propagated to item i with wrong coordinates. Line
should be replaced with
or, more elegantly, addition to sum could be delayed:
for(auto i : children){
if(p.x <= sum + i.size) { // This item was clicked!
return;
}
sum += i.size;
sum += spacing;
if(p.x <= sum){ // Empty space between items was clicked
return;
}
}
The same bug affects function VBox::on_clicked.
Changed in millenniumduel: | |
assignee: | Rafał Cieślak (rafalcieslak256) → Adam Malinowski (adayah) |
Changed in millenniumduel: | |
status: | Triaged → In Progress |
Changed in millenniumduel: | |
status: | In Progress → Fix Committed |
Changed in millenniumduel: | |
status: | Fix Committed → Fix Released |
Note: this bug had not been discovered before, because we had only used buttons inside Boxes. Buttons do not care about the coordinates they're clicked at.