Chromium Code Reviews| Index: samples/spirodraw/Spirodraw.dart |
| diff --git a/samples/spirodraw/Spirodraw.dart b/samples/spirodraw/Spirodraw.dart |
| index 98e03c39883d3da76871a40f7028169407300656..809291a26bc4a1453983f0cbfccbf6a3fc332c11 100644 |
| --- a/samples/spirodraw/Spirodraw.dart |
| +++ b/samples/spirodraw/Spirodraw.dart |
| @@ -102,7 +102,7 @@ class Spirodraw { |
| } |
| void onPenWidthChange() { |
| - penWidth = penWidthSlider.valueAsNumber.toInt(); |
| + penWidth = penWidthSlider.valueAsNumber.truncate(); |
| drawFrame(rad); |
| } |
| @@ -114,18 +114,18 @@ class Spirodraw { |
| // based on starting diameter == min / 2, fixed radius == 10 units |
| int min = Math.min(height, width); |
| double pixelsPerUnit = min / 40; |
| - RUnits = fixedRadiusSlider.valueAsNumber.toInt(); |
| + RUnits = fixedRadiusSlider.valueAsNumber.truncate(); |
| R = RUnits * pixelsPerUnit; |
| // Scale inner radius and pen distance in units of fixed radius |
| - rUnits = wheelRadiusSlider.valueAsNumber.toInt(); |
| + rUnits = wheelRadiusSlider.valueAsNumber.truncate(); |
| r = rUnits * R/RUnits * int.parse(inOrOut.value); |
| - dUnits = penRadiusSlider.valueAsNumber.toInt(); |
| + dUnits = penRadiusSlider.valueAsNumber.truncate(); |
| d = dUnits * R/RUnits; |
| numPoints = calcNumPoints(); |
| maxTurns = calcTurns(); |
| onSpeedChange(); |
| numTurns.text = "0 / ${maxTurns}"; |
| - penWidth = penWidthSlider.valueAsNumber.toInt(); |
| + penWidth = penWidthSlider.valueAsNumber.truncate(); |
| drawFrame(0.0); |
| } |
| @@ -157,7 +157,7 @@ class Spirodraw { |
| if (run && rad <= maxTurns * PI2) { |
| rad+=stepSize; |
| drawFrame(rad); |
| - int nTurns = (rad / PI2).toInt(); |
| + int nTurns = (rad / PI2).truncate(); |
|
Lasse Reichstein Nielsen
2013/01/04 10:29:42
/ -> ~/ ?
floitsch
2013/03/11 13:39:15
done in different CL.
|
| numTurns.text = '${nTurns}/$maxTurns'; |
| window.requestAnimationFrame(animate); |
| } else { |
| @@ -178,7 +178,7 @@ class Spirodraw { |
| int ru = rUnits.abs(); |
| int wrUnits = RUnits + rUnits; |
| int g = gcf (wrUnits, ru); |
| - return (ru ~/ g).toInt(); |
| + return ru ~/ g; |
| } |
| void stop() { |