Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: sky/examples/style/hex-layout.sky

Issue 725203007: Specs: make sure all layout/paint/hitTest APIs are relative to the right coordinate space (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/examples/style/toolbar-layout.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/style/hex-layout.sky
diff --git a/sky/examples/style/hex-layout.sky b/sky/examples/style/hex-layout.sky
index ac2acaf35ed0d44d6717d224cc72ff2385b48edc..695c2dd4029c797cca552a20e7d6f167f4e3b007 100644
--- a/sky/examples/style/hex-layout.sky
+++ b/sky/examples/style/hex-layout.sky
@@ -96,12 +96,13 @@
canvas.save();
try {
canvas.beginPath();
- canvas.moveTo(child.x, child.y + cellDim/4);
- canvas.lineTo(child.x + cellDim/2, child.y);
- canvas.lineTo(child.x + cellDim, child.y + cellDim/4);
- canvas.lineTo(child.x + cellDim, child.y + 3*cellDim/4);
- canvas.lineTo(child.x + cellDim/2, child.y + cellDim);
- canvas.moveTo(child.x, child.y + 3*cellDim/4);
+ canvas.translate(child.x, child.y);
+ canvas.moveTo(0, cellDim/4);
+ canvas.lineTo(cellDim/2, 0);
+ canvas.lineTo(cellDim, cellDim/4);
+ canvas.lineTo(cellDim, 3*cellDim/4);
+ canvas.lineTo(cellDim/2, cellDim);
+ canvas.moveTo(0, 3*cellDim/4);
canvas.closePath();
canvas.clip();
child.paint(canvas);
@@ -133,7 +134,7 @@
while (!loop.done) {
let child = loop.value;
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();
}
return this.node;
« no previous file with comments | « no previous file | sky/examples/style/toolbar-layout.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698