Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
Javascipt Canvas, elimine un círculo después de hacer clic en él

En este código creo un círculo y lo coloco donde quiero en el lienzo; Quiero eliminarlo después de hacer clic en él y, si vuelvo a hacer clic, mostrarlo. ¿Como puedo hacer esto?

 var createCircle = new ShootyController(); createCircle.x; createCircle.y; createCircle.radius = 10; createCircle.color = "red"; canvas.addEventListener( "click", function (e) { createCircle.x = e.clientX; createCircle.y = e.clientY; createCircle.x -= canvas.offsetLeft; createCircle.y -= canvas.offsetTop; }, {once: true} );
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Tienes que despejar la parte del lienzo donde se dibuja tu círculo.

 let canvas = document.getElementById("myCanvasID"); let context = canvas.getContext('2d'); context.clearRect(0, 0, canvas.width, canvas.height);
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!