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

Side by Side Diff: samples/swipe/swipe.dart

Issue 11367040: Removing Element.rect. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library swipe; 5 library swipe;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'dart:math'; 8 import 'dart:math';
9 9
10 Element target; 10 Element target;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 }); 66 });
67 67
68 document.on.keyUp.add((event) => stopSpin()); 68 document.on.keyUp.add((event) => stopSpin());
69 } 69 }
70 70
71 void initialize3D() { 71 void initialize3D() {
72 target.classes.add("transformable"); 72 target.classes.add("transformable");
73 73
74 num childCount = target.elements.length; 74 num childCount = target.elements.length;
75 75
76 query("#target").rect.then((ElementRect r) { 76 window.requestLayoutFrame(() {
77 num width = r.client.width; 77 num width = query("#target").clientWidth;
78 figureWidth = (width / 2) ~/ tan(PI / childCount); 78 figureWidth = (width / 2) ~/ tan(PI / childCount);
79 79
80 target.style.transform = "translateZ(-${figureWidth}px)"; 80 target.style.transform = "translateZ(-${figureWidth}px)";
81 81
82 num radius = (figureWidth * 1.2).round(); 82 num radius = (figureWidth * 1.2).round();
83 query('#container2').style.width = "${radius}px"; 83 query('#container2').style.width = "${radius}px";
84 84
85 for (int i = 0; i < childCount; i++) { 85 for (int i = 0; i < childCount; i++) {
86 var panel = target.elements[i]; 86 var panel = target.elements[i];
87 87
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 /** 120 /**
121 * Stop any spin that may be in progress. 121 * Stop any spin that may be in progress.
122 */ 122 */
123 void stopSpin() { 123 void stopSpin() {
124 if (timeoutHandle != null) { 124 if (timeoutHandle != null) {
125 window.clearInterval(timeoutHandle); 125 window.clearInterval(timeoutHandle);
126 timeoutHandle = null; 126 timeoutHandle = null;
127 } 127 }
128 } 128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698