| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import '../node.dart'; | 5 import '../node.dart'; |
| 6 import '../scheduler.dart' as scheduler; | 6 import '../scheduler.dart' as scheduler; |
| 7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
| 8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
| 9 | 9 |
| 10 class ParentData { | 10 class ParentData { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // PAINTING | 172 // PAINTING |
| 173 | 173 |
| 174 static bool debugDoingPaint = false; | 174 static bool debugDoingPaint = false; |
| 175 void markNeedsPaint() { | 175 void markNeedsPaint() { |
| 176 assert(!debugDoingPaint); | 176 assert(!debugDoingPaint); |
| 177 scheduler.ensureVisualUpdate(); | 177 scheduler.ensureVisualUpdate(); |
| 178 } | 178 } |
| 179 void paint(RenderNodeDisplayList canvas) { } | 179 void paint(RenderNodeDisplayList canvas) { } |
| 180 | 180 |
| 181 | 181 |
| 182 // EVENTS |
| 183 |
| 184 void handleEvent(sky.Event event) { |
| 185 // override this if you have a client, to hand it to the client |
| 186 // override this if you want to do anything with the event |
| 187 } |
| 188 |
| 189 |
| 182 // HIT TESTING | 190 // HIT TESTING |
| 183 | 191 |
| 184 void handlePointer(sky.PointerEvent event) { | |
| 185 // override this if you have a client, to hand it to the client | |
| 186 // override this if you want to do anything with the pointer event | |
| 187 } | |
| 188 | |
| 189 // RenderNode subclasses are expected to have a method like the | 192 // RenderNode subclasses are expected to have a method like the |
| 190 // following (with the signature being whatever passes for coordinates | 193 // following (with the signature being whatever passes for coordinates |
| 191 // for this particular class): | 194 // for this particular class): |
| 192 // bool hitTest(HitTestResult result, { sky.Point position }) { | 195 // bool hitTest(HitTestResult result, { sky.Point position }) { |
| 193 // // If (x,y) is not inside this node, then return false. (You | 196 // // If (x,y) is not inside this node, then return false. (You |
| 194 // // can assume that the given coordinate is inside your | 197 // // can assume that the given coordinate is inside your |
| 195 // // dimensions. You only need to check this if you're an | 198 // // dimensions. You only need to check this if you're an |
| 196 // // irregular shape, e.g. if you have a hole.) | 199 // // irregular shape, e.g. if you have a hole.) |
| 197 // // Otherwise: | 200 // // Otherwise: |
| 198 // // For each child that intersects x,y, in z-order starting from the top, | 201 // // For each child that intersects x,y, in z-order starting from the top, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 385 } |
| 383 } | 386 } |
| 384 | 387 |
| 385 ChildType get firstChild => _firstChild; | 388 ChildType get firstChild => _firstChild; |
| 386 ChildType get lastChild => _lastChild; | 389 ChildType get lastChild => _lastChild; |
| 387 ChildType childAfter(ChildType child) { | 390 ChildType childAfter(ChildType child) { |
| 388 assert(child.parentData is ParentDataType); | 391 assert(child.parentData is ParentDataType); |
| 389 return child.parentData.nextSibling; | 392 return child.parentData.nextSibling; |
| 390 } | 393 } |
| 391 } | 394 } |
| OLD | NEW |