Commit 8d2b5c3b authored by Hixie's avatar Hixie

Specs: make sure all layout/paint/hitTest APIs are relative to the right coordinate space

Review URL: https://codereview.chromium.org/725203007
parent 13163261
...@@ -96,12 +96,13 @@ ...@@ -96,12 +96,13 @@
canvas.save(); canvas.save();
try { try {
canvas.beginPath(); canvas.beginPath();
canvas.moveTo(child.x, child.y + cellDim/4); canvas.translate(child.x, child.y);
canvas.lineTo(child.x + cellDim/2, child.y); canvas.moveTo(0, cellDim/4);
canvas.lineTo(child.x + cellDim, child.y + cellDim/4); canvas.lineTo(cellDim/2, 0);
canvas.lineTo(child.x + cellDim, child.y + 3*cellDim/4); canvas.lineTo(cellDim, cellDim/4);
canvas.lineTo(child.x + cellDim/2, child.y + cellDim); canvas.lineTo(cellDim, 3*cellDim/4);
canvas.moveTo(child.x, child.y + 3*cellDim/4); canvas.lineTo(cellDim/2, cellDim);
canvas.moveTo(0, 3*cellDim/4);
canvas.closePath(); canvas.closePath();
canvas.clip(); canvas.clip();
child.paint(canvas); child.paint(canvas);
...@@ -133,7 +134,7 @@ ...@@ -133,7 +134,7 @@
while (!loop.done) { while (!loop.done) {
let child = loop.value; let child = loop.value;
if (this.inHex(child.x, child.y, child.width, child.height, x, y)) if (this.inHex(child.x, child.y, child.width, child.height, x, y))
return child.layoutManager.hitText(x, y); return child.layoutManager.hitTest(x-child.x, y-child.y);
loop = children.next(); loop = children.next();
} }
return this.node; return this.node;
......
...@@ -195,7 +195,8 @@ SKY MODULE ...@@ -195,7 +195,8 @@ SKY MODULE
canvas.save(); canvas.save();
try { try {
canvas.beginPath(); canvas.beginPath();
canvas.rect(child.x, child.y, child.width, child.height); canvas.translate(child.x, child.y);
canvas.rect(0, 0, child.width, child.height);
canvas.clip(); canvas.clip();
child.paint(canvas); child.paint(canvas);
} finally { } finally {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment