I'm attempting to create a circle wherever the user clicks on the screen using Angular on canvas. However, my code doesn't seem to be functioning correctly. Feel free to check out my plnk link below:
http://plnkr.co/edit/rYVLgB14IutNh1F4MN6T?p=preview
var app = angular.module('plunker', []);
app.controller('MainController', function($scope) {
$scope.doClick = function(event){
var x = event.clientX;
var y = event.clientY;
var offsetX = event.offsetX;
var offsetY = event.offsetY;
//alert(x, y, offsetX, offsetY);
//console.log(x, y, offsetX, offsetY);
var ctx = getContext("2d");
//draw a circle
ctx.beginPath();
ctx.arc(x, y, 10, 0, Math.PI*2, true);
ctx.closePath();
ctx.fill();
};
$scope.test="test";
});
Any assistance would be greatly appreciated.