Commit 090c9405 authored by Mike Greiling's avatar Mike Greiling

rename resize and animate methods for clarity

parent 2e40f0bd
...@@ -204,7 +204,7 @@ export default class BurndownChart { ...@@ -204,7 +204,7 @@ export default class BurndownChart {
} }
// reset width and height to match the svg element, then re-render if necessary // reset width and height to match the svg element, then re-render if necessary
resize() { handleResize() {
const dimensions = this.canvas.node().getBoundingClientRect(); const dimensions = this.canvas.node().getBoundingClientRect();
if (this.width !== dimensions.width || this.height !== dimensions.height) { if (this.width !== dimensions.width || this.height !== dimensions.height) {
this.width = dimensions.width; this.width = dimensions.width;
...@@ -320,7 +320,7 @@ export default class BurndownChart { ...@@ -320,7 +320,7 @@ export default class BurndownChart {
this.queuedRender = this.queuedRender || requestAnimationFrame(() => this.render()); this.queuedRender = this.queuedRender || requestAnimationFrame(() => this.render());
} }
animate(seconds = 5) { animateResize(seconds = 5) {
this.ticksLeft = this.ticksLeft || 0; this.ticksLeft = this.ticksLeft || 0;
if (this.ticksLeft <= 0) { if (this.ticksLeft <= 0) {
const interval = setInterval(() => { const interval = setInterval(() => {
...@@ -328,7 +328,7 @@ export default class BurndownChart { ...@@ -328,7 +328,7 @@ export default class BurndownChart {
if (this.ticksLeft <= 0) { if (this.ticksLeft <= 0) {
clearInterval(interval); clearInterval(interval);
} }
this.resize(); this.handleResize();
}, 20); }, 20);
} }
this.ticksLeft = seconds * 50; this.ticksLeft = seconds * 50;
......
...@@ -18,6 +18,6 @@ $(() => { ...@@ -18,6 +18,6 @@ $(() => {
}); });
chart.setData(testData); chart.setData(testData);
window.addEventListener('resize', () => chart.animate(1)); window.addEventListener('resize', () => chart.animateResize(1));
$(document).on('click', '.js-sidebar-toggle', () => chart.animate(2)); $(document).on('click', '.js-sidebar-toggle', () => chart.animateResize(2));
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment