Skip to content

Commit

Permalink
broken import resize
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewis Hemens committed Sep 22, 2011
1 parent 74f713a commit b6612fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 6 additions & 0 deletions src/com/lewish/asciiflow/client/Canvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ public CellImpl getCell(int x, int y) {

public void drawCellStates(CellStateMap state) {
for (CellState cellState : state.getCellStates()) {
while (getWidth() < cellState.x && getWidth() < MAX_WIDTH) {
addColumn();
}
while (getHeight() < cellState.y && getHeight() < MAX_HEIGHT) {
addRow();
}
draw(cellState.x, cellState.y, cellState.value);
}
}
Expand Down
11 changes: 0 additions & 11 deletions src/com/lewish/asciiflow/client/ImportWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ protected void onShow() {

private void loadText(String text) {
CellStateMap state = new CellStateMap();
int maxWidth = 0;
int height = 0;
String[] lines = text.split("\n");
for(String line : lines) {
if(line.length() > maxWidth) {
maxWidth = line.length();
}
for(int i = 0; i< line.length(); i++) {
String val = new String(Character.toChars(line.codePointAt(i)));
if (!val.equals(" ")) {
Expand All @@ -71,13 +67,6 @@ private void loadText(String text) {
}
height++;
}
//Resize canvas
while(canvas.getWidth() < maxWidth) {
canvas.addColumn();
}
while(canvas.getHeight() < height) {
canvas.addRow();
}
storeModel.clearState();
EraseTool.draw(canvas);
canvas.drawCellStates(state);
Expand Down
1 change: 1 addition & 0 deletions src/com/lewish/asciiflow/client/StoreWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.lewish.asciiflow.shared.State;
import com.lewish.asciiflow.shared.Uri;

// TODO: Seperate Presenter, MVP?
@Singleton
public class StoreWidget extends Composite implements ModelChangeHandler {

Expand Down

0 comments on commit b6612fc

Please sign in to comment.