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

Side by Side Diff: sky/sdk/example/game/lib/node_with_size.dart

Issue 1226113007: Add @override annotation to known overriden methods (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 months 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 unified diff | Download patch
OLDNEW
1 part of sprites; 1 part of sprites;
2 2
3 /// The super class of any [Node] that has a size. 3 /// The super class of any [Node] that has a size.
4 /// 4 ///
5 /// NodeWithSize adds the ability for a node to have a size and a pivot point. 5 /// NodeWithSize adds the ability for a node to have a size and a pivot point.
6 class NodeWithSize extends Node { 6 class NodeWithSize extends Node {
7 7
8 /// Changing the size will affect the size of the rendering of the node. 8 /// Changing the size will affect the size of the rendering of the node.
9 /// 9 ///
10 /// myNode.size = new Size(1024.0, 1024.0); 10 /// myNode.size = new Size(1024.0, 1024.0);
(...skipping 30 matching lines...) Expand all
41 /// canvas.restore(); 41 /// canvas.restore();
42 /// } 42 /// }
43 void applyTransformForPivot(PaintingCanvas canvas) { 43 void applyTransformForPivot(PaintingCanvas canvas) {
44 if (pivot.x != 0 || pivot.y != 0) { 44 if (pivot.x != 0 || pivot.y != 0) {
45 double pivotInPointsX = size.width * pivot.x; 45 double pivotInPointsX = size.width * pivot.x;
46 double pivotInPointsY = size.height * pivot.y; 46 double pivotInPointsY = size.height * pivot.y;
47 canvas.translate(-pivotInPointsX, -pivotInPointsY); 47 canvas.translate(-pivotInPointsX, -pivotInPointsY);
48 } 48 }
49 } 49 }
50 50
51 @override
51 bool isPointInside (Point nodePoint) { 52 bool isPointInside (Point nodePoint) {
52 53
53 double minX = -size.width * pivot.x; 54 double minX = -size.width * pivot.x;
54 double minY = -size.height * pivot.y; 55 double minY = -size.height * pivot.y;
55 double maxX = minX + size.width; 56 double maxX = minX + size.width;
56 double maxY = minY + size.height; 57 double maxY = minY + size.height;
57 return (nodePoint.x >= minX && nodePoint.x < maxX && 58 return (nodePoint.x >= minX && nodePoint.x < maxX &&
58 nodePoint.y >= minY && nodePoint.y < maxY); 59 nodePoint.y >= minY && nodePoint.y < maxY);
59 } 60 }
60 } 61 }
OLDNEW
« no previous file with comments | « sky/sdk/example/game/lib/game_demo_world.dart ('k') | sky/sdk/example/game/lib/particle_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698