강동현

캔버스 좌표 범위 변경

...@@ -103,8 +103,8 @@ export class Game { ...@@ -103,8 +103,8 @@ export class Game {
103 return { ok: false }; 103 return { ok: false };
104 } 104 }
105 105
106 - this.brush.x = Math.max(Math.min(message.x, 1), 0); 106 + this.brush.x = Math.max(Math.min(message.x, 640), 0);
107 - this.brush.y = Math.max(Math.min(message.y, 1), 0); 107 + this.brush.y = Math.max(Math.min(message.y, 480), 0);
108 108
109 this.room.broadcast( 109 this.room.broadcast(
110 "moveBrush", 110 "moveBrush",
......
...@@ -12,10 +12,10 @@ describe("라운드 브러시 이동", () => { ...@@ -12,10 +12,10 @@ describe("라운드 브러시 이동", () => {
12 it("영역을 벗어난 좌표는 Clamp 처리됩니다", () => { 12 it("영역을 벗어난 좌표는 Clamp 처리됩니다", () => {
13 const { drawerSocket, guesserSockets } = prepareGame(2); 13 const { drawerSocket, guesserSockets } = prepareGame(2);
14 14
15 - drawerSocket.testOk("moveBrush", { x: -1, y: 2 }); 15 + drawerSocket.testOk("moveBrush", { x: -1, y: 1000 });
16 expect(guesserSockets[0].socket.received("moveBrush")).deep.eq({ 16 expect(guesserSockets[0].socket.received("moveBrush")).deep.eq({
17 x: 0, 17 x: 0,
18 - y: 1, 18 + y: 480,
19 }); 19 });
20 }); 20 });
21 it("drawer가 아닌 다른 사람들은 브러시를 이동할 수 없습니다", () => { 21 it("drawer가 아닌 다른 사람들은 브러시를 이동할 수 없습니다", () => {
......