Skip to content

Instantly share code, notes, and snippets.

@michaelevensen
Created November 13, 2018 13:27
Show Gist options
  • Save michaelevensen/4ac9d72465327a874ea03e632aad8c16 to your computer and use it in GitHub Desktop.
Save michaelevensen/4ac9d72465327a874ea03e632aad8c16 to your computer and use it in GitHub Desktop.
Draw Canvas Label
drawLabel(angle) {
var canvas: any = document.getElementById("canvas"),
ctx: CanvasRenderingContext2D = canvas.getContext('2d');
// Clear canvas first
ctx.clearRect(0, 0, canvas.width, canvas.height);
canvas.width = 500;
// Draw text
ctx.font = "20px Helvetica";
ctx.fillText(`angle: ${angle}, left: ${this.state.confirmedAngles.left}, right: ${this.state.confirmedAngles.right}`, 10, 40);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment