| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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('spirodraw'); | 5 #library('spirodraw'); |
| 6 | 6 |
| 7 #import('dart:dom'); | 7 #import('dart:dom'); |
| 8 #source("ColorPicker.dart"); | 8 #source("ColorPicker.dart"); |
| 9 #resource("spirodraw.css"); | 9 #resource("spirodraw.css"); |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 inOrOut = doc.getElementById("in_out"); | 46 inOrOut = doc.getElementById("in_out"); |
| 47 fixedRadiusSlider = doc.getElementById("fixed_radius"); | 47 fixedRadiusSlider = doc.getElementById("fixed_radius"); |
| 48 wheelRadiusSlider = doc.getElementById("wheel_radius"); | 48 wheelRadiusSlider = doc.getElementById("wheel_radius"); |
| 49 penRadiusSlider = doc.getElementById("pen_radius"); | 49 penRadiusSlider = doc.getElementById("pen_radius"); |
| 50 penWidthSlider = doc.getElementById("pen_width"); | 50 penWidthSlider = doc.getElementById("pen_width"); |
| 51 speedSlider = doc.getElementById("speed"); | 51 speedSlider = doc.getElementById("speed"); |
| 52 numTurns = doc.getElementById("num_turns"); | 52 numTurns = doc.getElementById("num_turns"); |
| 53 mainDiv = doc.getElementById("main"); | 53 mainDiv = doc.getElementById("main"); |
| 54 frontCanvas = doc.getElementById("canvas"); | 54 frontCanvas = doc.getElementById("canvas"); |
| 55 front = frontCanvas.getContext("2d"); | 55 front = frontCanvas.getContext("2d"); |
| 56 backCanvas = doc.createElement("canvas"); | 56 backCanvas = new Element.tag("canvas"); |
| 57 back = backCanvas.getContext("2d"); | 57 back = backCanvas.getContext("2d"); |
| 58 paletteElement = doc.getElementById("palette"); | 58 paletteElement = doc.getElementById("palette"); |
| 59 window.addEventListener('resize', (Event) => onResize(), true); | 59 window.addEventListener('resize', (Event) => onResize(), true); |
| 60 initControlPanel(); | 60 initControlPanel(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void go() { | 63 void go() { |
| 64 onResize(); | 64 onResize(); |
| 65 } | 65 } |
| 66 | 66 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 int gcf(int n, int d) { | 301 int gcf(int n, int d) { |
| 302 if (n==d) | 302 if (n==d) |
| 303 return n; | 303 return n; |
| 304 int max = Math.max(n, d); | 304 int max = Math.max(n, d); |
| 305 for (int i = max ~/ 2; i > 1; i--) | 305 for (int i = max ~/ 2; i > 1; i--) |
| 306 if ((n % i == 0) && (d % i == 0)) | 306 if ((n % i == 0) && (d % i == 0)) |
| 307 return i; | 307 return i; |
| 308 return 1; | 308 return 1; |
| 309 } | 309 } |
| OLD | NEW |