I am using jCanvas to build a HTML5 app, I need to remove a layer, which is a black circle on the canvas, you can see the code here.
var cvLingualWidth = 945;
var cvLingualHeight = 100;
var cvLingual = document.getElementById("cvLingual");
function drawGrid() {
var contextLingual = cvLingual.getContext("2d");
for (var y = 0.5; y < cvLingualHeight; y += 6) {
contextLingual.moveTo(0, y);
contextLingual.lineTo(cvLingualWidth, y);
}
contextLingual.strokeStyle = "#DDD";
contextLingual.stroke();
}
function drawCircle() {
$("#cvLingual").drawArc({
layer: true,
name: "circleLayer_18",
strokeStyle: "#000",
strokeWidth: 2,
x: 42,
y: 70,
radius: 8
});
}
function clearCircle() {
var circleLayer = $("#cvLingual").getLayer("circleLayer_18");
// TODO
}
$(function () {
drawGrid();
drawCircle();
$("#clear").click(function(){
clearCircle();
});
})
I tried removeLayer() but its not working. If I clear the canvas, the entire UI will be gone.
How can I clear the circle without affecting the background gridlines?