浏览代码

Some improved mouse handling code.

master
Ben Kurtovic 12 年前
父节点
当前提交
f03f4e07d7
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. +5
    -5
      src/Render.java

+ 5
- 5
src/Render.java 查看文件

@@ -128,16 +128,16 @@ public class Render extends Canvas implements Runnable, MouseListener,
@Override
public void mouseDragged(MouseEvent e) {
try {
_grid.getPatch(e.getX() / scale, e.getY() / scale).setState(1);
draw(e.getX() / scale, e.getY() / scale, 0xffffff);
} catch (ArrayIndexOutOfBoundsException exception) {
}
if (e.getX() < 0 || e.getY() < 0 || e.getX() / scale > width || e.getY() / scale > height)
return;
_grid.getPatch(e.getX() / scale, e.getY() / scale).setState(1);
e.consume();
}
@Override
public void mouseClicked(MouseEvent e) {
_grid.getPatch(e.getX() / scale, e.getY() / scale).setState(1);
e.consume();
}
@Override


正在加载...
取消
保存