Skip to content

Commit

Permalink
PEGASUS: Fix updating elements when the bounds change
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hoops committed Sep 21, 2011
1 parent 185f5fb commit d4a731c
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions engines/pegasus/elements.cpp
Expand Up @@ -71,27 +71,30 @@ void DisplayElement::stopDisplaying() {
}

void DisplayElement::setBounds(const tCoordType left, const tCoordType top, const tCoordType right, const tCoordType bottom) {
_bounds.left = left;
_bounds.top = top;
_bounds.right = right;
_bounds.bottom = bottom;
setBounds(Common::Rect(left, top, right, bottom));
}

void DisplayElement::getBounds(Common::Rect &r) const {
r = _bounds;
}

void DisplayElement::sizeElement(const tCoordType h, const tCoordType v) {
_bounds.right = _bounds.left + h;
_bounds.bottom = _bounds.top + v;
Common::Rect newBounds = _bounds;
newBounds.right = _bounds.left + h;
newBounds.bottom = _bounds.top + v;
setBounds(newBounds);
}

void DisplayElement::moveElementTo(const tCoordType h, const tCoordType v) {
_bounds.moveTo(h, v);
Common::Rect newBounds = _bounds;
newBounds.moveTo(h, v);
setBounds(newBounds);
}

void DisplayElement::moveElement(const tCoordType dh, const tCoordType dv) {
_bounds.translate(dh, dv);
Common::Rect newBounds = _bounds;
newBounds.translate(dh, dv);
setBounds(newBounds);
}

void DisplayElement::getLocation(tCoordType &h, tCoordType &v) const {
Expand All @@ -100,7 +103,9 @@ void DisplayElement::getLocation(tCoordType &h, tCoordType &v) const {
}

void DisplayElement::centerElementAt(const tCoordType h, const tCoordType v) {
_bounds.moveTo(h - (_bounds.width() / 2), v - (_bounds.height() / 2));
Common::Rect newBounds = _bounds;
newBounds.moveTo(h - (_bounds.width() / 2), v - (_bounds.height() / 2));
setBounds(newBounds);
}

void DisplayElement::getCenter(tCoordType &h, tCoordType &v) const {
Expand Down

0 comments on commit d4a731c

Please sign in to comment.