Created
November 13, 2018 13:27
-
-
Save michaelevensen/4ac9d72465327a874ea03e632aad8c16 to your computer and use it in GitHub Desktop.
Draw Canvas Label
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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