millennium-dev team mailing list archive
-
millennium-dev team
-
Mailing list archive
-
Message #00131
[Bug 1204852] Re: Incorrect on_clicked propagation by HBox and VBox.
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.
--
You received this bug notification because you are a member of
Millennium Developers, which is subscribed to Millennium Duel.
https://bugs.launchpad.net/bugs/1204852
Title:
Incorrect on_clicked propagation by HBox and VBox.
Status in Millennium Duel - a GUI frontend for Millennium:
Triaged
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!
i.item.on_clicked(SCoordinates(p.x - sum, p.y));
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
i.item.on_clicked(SCoordinates(p.x - sum, p.y));
should be replaced with
i.item.on_clicked(SCoordinates(p.x - (sum - i.size),
p.y));
or, more elegantly, addition to sum could be delayed:
for(auto i : children){
if(p.x <= sum + i.size) { // This item was clicked!
i.item.on_clicked(SCoordinates(p.x - sum, p.y));
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.
To manage notifications about this bug go to:
https://bugs.launchpad.net/millenniumduel/+bug/1204852/+subscriptions
References