mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 12:28:03 +08:00
Sets PositionComponent#setByRect to also use anchor property. Change in #99 was a breaking change for setByRect when using the results of toRect as they now used different anchors which would cause the set rect to translate to a new incorrect position.
This commit is contained in:
@ -79,8 +79,8 @@ abstract class PositionComponent extends Component {
|
||||
Rect toRect() => Rect.fromLTWH(x - anchor.relativePosition.dx * width,
|
||||
y - anchor.relativePosition.dy * height, width, height);
|
||||
void setByRect(Rect rect) {
|
||||
x = rect.left;
|
||||
y = rect.top;
|
||||
x = rect.left + anchor.relativePosition.dx * rect.width;
|
||||
y = rect.top + anchor.relativePosition.dy * rect.height;
|
||||
width = rect.width;
|
||||
height = rect.height;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user