Skip to content
Browse files

색상 바꾼 상태에서 칠했던 곳은 덮어씌운다.

  • Loading branch information...
1 parent d11a8fd commit 156a7c89fcc22c913b4bec610bc18baf4d765a8b @chorr chorr committed Feb 16, 2012
Showing with 8 additions and 1 deletion.
  1. +2 −1 static/dot.canvas.js
  2. +6 −0 test/dot.test.js
View
3 static/dot.canvas.js
@@ -107,7 +107,8 @@ dot.Canvas = Backbone.Model.extend({
if (p.length <= aX || p[0].length <= aY) return;
if (!ignore) {
- p[aX][aY] = (p[aX][aY] && !drag) ? null : this.get("color");
+ p[aX][aY] = (p[aX][aY] && p[aX][aY] == this.get("color") && !drag)
+ ? null : this.get("color");
}
this.set("pixel", p, { silent: drag });
this.trigger("canvas:update");
View
6 test/dot.test.js
@@ -51,6 +51,12 @@ describe("Canvas Model", function() {
expect(c.get("color")).toBe("#000000");
});
+ it("브러쉬 색상을 바꾸고 그리면 덮어씌운다.", function() {
+ c.setColor("#ff0000");
+ c.point(319, 319);
+ expect(c.get("pixel")[15][15]).toBe("#ff0000");
+ });
+
it("데이터를 모두 삭제 한다.", function() {
var p, valid = null;
c.clearPixel(true);

0 comments on commit 156a7c8

Please sign in to comment.
Something went wrong with that request. Please try again.