OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 this._innerAddSlice(sliceAngle, color); | 58 this._innerAddSlice(sliceAngle, color); |
59 }, | 59 }, |
60 | 60 |
61 /** | 61 /** |
62 * @param {number} sliceAngle | 62 * @param {number} sliceAngle |
63 * @param {string} color | 63 * @param {string} color |
64 */ | 64 */ |
65 _innerAddSlice: function(sliceAngle, color) | 65 _innerAddSlice: function(sliceAngle, color) |
66 { | 66 { |
67 var sliceElement = this.element.createChild("div", "pie-chart-slice"); | 67 var sliceElement = this.element.createChild("div", "pie-chart-slice"); |
68 // translate3d enables antialiasing for the slice. | 68 sliceElement.style.webkitTransform = "rotate(" + Number(this._lastAngle)
.toFixed(2) + "deg)" |
69 sliceElement.style.webkitTransform = "translate3d(0, 0, 0) rotate(" + Nu
mber(this._lastAngle).toFixed(2) + "deg)" | |
70 var innerSliceElement = sliceElement.createChild("div", "pie-chart-slice
-inner"); | 69 var innerSliceElement = sliceElement.createChild("div", "pie-chart-slice
-inner"); |
71 innerSliceElement.style.backgroundColor = color; | 70 innerSliceElement.style.backgroundColor = color; |
72 innerSliceElement.style.webkitTransform = "rotate(" + Number(sliceAngle)
.toFixed(2) + "deg)"; | 71 innerSliceElement.style.webkitTransform = "rotate(" + Number(sliceAngle)
.toFixed(2) + "deg)"; |
73 this._lastAngle += sliceAngle; | 72 this._lastAngle += sliceAngle; |
74 if (this._lastAngle > 360) | 73 if (this._lastAngle > 360) |
75 console.assert("Pie chard slices are greater than total."); | 74 console.assert("Pie chard slices are greater than total."); |
76 } | 75 } |
77 } | 76 } |
OLD | NEW |