toolstroke: rename getPreview to getBounds
git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@625 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
86a2f05201
commit
0f0d063957
2 changed files with 5 additions and 17 deletions
|
@ -32,7 +32,7 @@ public class ToolStroke
|
||||||
|
|
||||||
public ToolResult apply()
|
public ToolResult apply()
|
||||||
{
|
{
|
||||||
Rectangle r = getPreview();
|
Rectangle r = getBounds();
|
||||||
for (int i = r.y; i < r.y + r.height; i += tool.getHeight()) {
|
for (int i = r.y; i < r.y + r.height; i += tool.getHeight()) {
|
||||||
for (int j = r.x; j < r.x + r.width;
|
for (int j = r.x; j < r.x + r.width;
|
||||||
j += tool.getWidth()) {
|
j += tool.getWidth()) {
|
||||||
|
@ -106,7 +106,7 @@ public class ToolStroke
|
||||||
this.ydest = ydest;
|
this.ydest = ydest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle getPreview_line()
|
public Rectangle getBounds_line()
|
||||||
{
|
{
|
||||||
assert tool.getWidth() == 1;
|
assert tool.getWidth() == 1;
|
||||||
assert tool.getHeight() == 1;
|
assert tool.getHeight() == 1;
|
||||||
|
@ -131,13 +131,13 @@ public class ToolStroke
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle getPreview()
|
public Rectangle getBounds()
|
||||||
{
|
{
|
||||||
if (tool == MicropolisTool.RAIL ||
|
if (tool == MicropolisTool.RAIL ||
|
||||||
tool == MicropolisTool.ROADS ||
|
tool == MicropolisTool.ROADS ||
|
||||||
tool == MicropolisTool.WIRE)
|
tool == MicropolisTool.WIRE)
|
||||||
{
|
{
|
||||||
return getPreview_line();
|
return getBounds_line();
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle r = new Rectangle();
|
Rectangle r = new Rectangle();
|
||||||
|
@ -169,18 +169,6 @@ public class ToolStroke
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getPreviewDx()
|
|
||||||
{
|
|
||||||
int sgn = xdest > xpos ? 1 : -1;
|
|
||||||
return (sgn + (xdest - xpos) / tool.getWidth()) * tool.getWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
int getPreviewDy()
|
|
||||||
{
|
|
||||||
int sgn = ydest > ypos ? 1 : -1;
|
|
||||||
return (sgn + (ydest - ypos) / tool.getHeight()) * tool.getWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolResult apply3x3buildingTool(int xpos, int ypos, char tileBase)
|
ToolResult apply3x3buildingTool(int xpos, int ypos, char tileBase)
|
||||||
{
|
{
|
||||||
int mapH = xpos - 1;
|
int mapH = xpos - 1;
|
||||||
|
|
|
@ -957,7 +957,7 @@ public class MainWindow extends JFrame
|
||||||
if (toolStroke != null) {
|
if (toolStroke != null) {
|
||||||
toolStroke.dragTo(x, y);
|
toolStroke.dragTo(x, y);
|
||||||
drawingArea.setToolPreview(
|
drawingArea.setToolPreview(
|
||||||
toolStroke.getPreview(),
|
toolStroke.getBounds(),
|
||||||
parseColor(strings.getString("tool."+currentTool.name()+".border"))
|
parseColor(strings.getString("tool."+currentTool.name()+".border"))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue