Skip to content

Commit

Permalink
Un-reverts previous commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkryst committed Aug 20, 2018
1 parent 6ed820e commit e9eedc0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/com/valkryst/VTerminal/component/Layer.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,22 @@ public void removeComponent(final Component component) {
for (final EventListener listener : component.getEventListeners()) {
super.eventListeners.remove(listener);
}

// Reset all of the tiles where the component used to be.
final int startX = component.getTiles().getXPosition();
final int startY = component.getTiles().getYPosition();

final int endX = startX + component.getTiles().getWidth();
final int endY = startY + component.getTiles().getHeight();

for (int y = startY ; y < endY ; y++) {
for (int x = startX ; x < endX ; x++) {
final Tile tile = tiles.getTileAt(x, y);
tile.reset();
tile.setBackgroundColor(rootScreen.getColorPalette().getDefaultBackground());
tile.setForegroundColor(rootScreen.getColorPalette().getDefaultForeground());
}
}
}

/** Removes all components from the layer. */
Expand Down

0 comments on commit e9eedc0

Please sign in to comment.