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

Side by Side Diff: sky/sdk/lib/framework/app.dart

Issue 1161323004: Export Point, Size, Rect, Color, Paint, Path, BoxDecoration, Border, BorderSide, EdgeDims, and Flex… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: without analyser changes Created 5 years, 6 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
« no previous file with comments | « no previous file | sky/sdk/lib/framework/components2/drawer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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' as sky; 5 import 'dart:sky' as sky;
6 import 'rendering/box.dart'; 6 import 'rendering/box.dart';
7 import 'rendering/object.dart'; 7 import 'rendering/object.dart';
8 import 'scheduler.dart' as scheduler; 8 import 'scheduler.dart' as scheduler;
9 9
10 class PointerState { 10 class PointerState {
11 HitTestResult result; 11 HitTestResult result;
12 sky.Point lastPosition; 12 Point lastPosition;
13 13
14 PointerState({ this.result, this.lastPosition }); 14 PointerState({ this.result, this.lastPosition });
15 } 15 }
16 16
17 class AppView { 17 class AppView {
18 18
19 AppView(RenderBox root) { 19 AppView(RenderBox root) {
20 sky.view.setEventCallback(_handleEvent); 20 sky.view.setEventCallback(_handleEvent);
21 scheduler.init(); 21 scheduler.init();
22 scheduler.addPersistentFrameCallback(_beginFrame); 22 scheduler.addPersistentFrameCallback(_beginFrame);
(...skipping 21 matching lines...) Expand all
44 onFrame(); 44 onFrame();
45 RenderObject.flushLayout(); 45 RenderObject.flushLayout();
46 _renderView.paintFrame(); 46 _renderView.paintFrame();
47 } 47 }
48 48
49 void _handleEvent(sky.Event event) { 49 void _handleEvent(sky.Event event) {
50 if (event is sky.PointerEvent) { 50 if (event is sky.PointerEvent) {
51 _handlePointerEvent(event); 51 _handlePointerEvent(event);
52 } else if (event is sky.GestureEvent) { 52 } else if (event is sky.GestureEvent) {
53 HitTestResult result = new HitTestResult(); 53 HitTestResult result = new HitTestResult();
54 _renderView.hitTest(result, position: new sky.Point(event.x, event.y)); 54 _renderView.hitTest(result, position: new Point(event.x, event.y));
55 dispatchEvent(event, result); 55 dispatchEvent(event, result);
56 } 56 }
57 } 57 }
58 58
59 PointerState _createStateForPointer(sky.PointerEvent event, sky.Point position ) { 59 PointerState _createStateForPointer(sky.PointerEvent event, Point position) {
60 HitTestResult result = new HitTestResult(); 60 HitTestResult result = new HitTestResult();
61 _renderView.hitTest(result, position: position); 61 _renderView.hitTest(result, position: position);
62 PointerState state = new PointerState(result: result, lastPosition: position ); 62 PointerState state = new PointerState(result: result, lastPosition: position );
63 _stateForPointer[event.pointer] = state; 63 _stateForPointer[event.pointer] = state;
64 return state; 64 return state;
65 } 65 }
66 66
67 void _handlePointerEvent(sky.PointerEvent event) { 67 void _handlePointerEvent(sky.PointerEvent event) {
68 sky.Point position = new sky.Point(event.x, event.y); 68 Point position = new Point(event.x, event.y);
69 69
70 PointerState state; 70 PointerState state;
71 switch(event.type) { 71 switch(event.type) {
72 case 'pointerdown': 72 case 'pointerdown':
73 state = _createStateForPointer(event, position); 73 state = _createStateForPointer(event, position);
74 break; 74 break;
75 case 'pointerup': 75 case 'pointerup':
76 case 'pointercancel': 76 case 'pointercancel':
77 state = _stateForPointer[event.pointer]; 77 state = _stateForPointer[event.pointer];
78 _stateForPointer.remove(event.pointer); 78 _stateForPointer.remove(event.pointer);
(...skipping 18 matching lines...) Expand all
97 node.handleEvent(event); 97 node.handleEvent(event);
98 } 98 }
99 99
100 String toString() => 'Render Tree:\n${_renderView}'; 100 String toString() => 'Render Tree:\n${_renderView}';
101 101
102 void debugDumpRenderTree() { 102 void debugDumpRenderTree() {
103 toString().split('\n').forEach(print); 103 toString().split('\n').forEach(print);
104 } 104 }
105 105
106 } 106 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/framework/components2/drawer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698