Chromium Code Reviews| 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 'dart:sky'; | 5 import 'dart:sky'; |
| 6 import 'dart:math' as math; | 6 import 'dart:math' as math; |
| 7 | 7 |
| 8 import 'package:mojom/intents/intents.mojom.dart'; | |
| 8 import 'package:sky/mojo/net/image_cache.dart' as image_cache; | 9 import 'package:sky/mojo/net/image_cache.dart' as image_cache; |
| 10 import 'package:sky/mojo/shell.dart' as shell; | |
| 9 import 'package:sky/painting/text_style.dart'; | 11 import 'package:sky/painting/text_style.dart'; |
| 10 import 'package:sky/rendering/box.dart'; | 12 import 'package:sky/rendering/box.dart'; |
| 11 import 'package:sky/rendering/flex.dart'; | 13 import 'package:sky/rendering/flex.dart'; |
| 12 import 'package:sky/rendering/object.dart'; | 14 import 'package:sky/rendering/object.dart'; |
| 13 import 'package:sky/rendering/paragraph.dart'; | 15 import 'package:sky/rendering/paragraph.dart'; |
| 14 import 'package:sky/rendering/sky_binding.dart'; | 16 import 'package:sky/rendering/sky_binding.dart'; |
| 15 | 17 |
| 16 import 'solid_color_box.dart'; | 18 import 'solid_color_box.dart'; |
| 17 | 19 |
| 18 class Touch { | 20 class Touch { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 38 | 40 |
| 39 RenderImageGrow image; | 41 RenderImageGrow image; |
| 40 | 42 |
| 41 Map<int, Touch> touches = new Map(); | 43 Map<int, Touch> touches = new Map(); |
| 42 void handleEvent(event) { | 44 void handleEvent(event) { |
| 43 if (event is PointerEvent) { | 45 if (event is PointerEvent) { |
| 44 if (event.type == 'pointermove') | 46 if (event.type == 'pointermove') |
| 45 image.growth = math.max(0.0, image.growth + event.x - touches[event.pointe r].x); | 47 image.growth = math.max(0.0, image.growth + event.x - touches[event.pointe r].x); |
| 46 touches[event.pointer] = new Touch(event.x, event.y); | 48 touches[event.pointer] = new Touch(event.x, event.y); |
| 47 } | 49 } |
| 50 if (event.type == "back") { | |
| 51 ActivityManagerProxy activityManager = new ActivityManagerProxy.unbound(); | |
| 52 shell.requestService('mojo:sky_viewer', activityManager); | |
| 53 activityManager.ptr.finishCurrentActivity(); | |
| 54 } | |
|
abarth-chromium
2015/07/07 18:10:26
Should we factor this into a library since we have
jackson
2015/07/07 19:17:30
Done.
| |
| 48 } | 55 } |
| 49 | 56 |
| 50 void main() { | 57 void main() { |
| 51 void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int fl ex: 0 }) { | 58 void addFlexChildSolidColor(RenderFlex parent, Color backgroundColor, { int fl ex: 0 }) { |
| 52 RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); | 59 RenderSolidColorBox child = new RenderSolidColorBox(backgroundColor); |
| 53 parent.add(child); | 60 parent.add(child); |
| 54 child.parentData.flex = flex; | 61 child.parentData.flex = flex; |
| 55 } | 62 } |
| 56 | 63 |
| 57 var row = new RenderFlex(direction: FlexDirection.horizontal); | 64 var row = new RenderFlex(direction: FlexDirection.horizontal); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 column.parentData.flex = 8; | 101 column.parentData.flex = 8; |
| 95 | 102 |
| 96 RenderDecoratedBox root = new RenderDecoratedBox( | 103 RenderDecoratedBox root = new RenderDecoratedBox( |
| 97 decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)), | 104 decoration: new BoxDecoration(backgroundColor: const Color(0xFFFFFFFF)), |
| 98 child: row | 105 child: row |
| 99 ); | 106 ); |
| 100 | 107 |
| 101 new SkyBinding(root: root); | 108 new SkyBinding(root: root); |
| 102 view.setEventCallback(handleEvent); | 109 view.setEventCallback(handleEvent); |
| 103 } | 110 } |
| OLD | NEW |