Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

98
Vistas
Giving Text coordinates in Javascript

I have drawn a bunch of rectangles using canvas, now i want text to appear inside the boxes.

I have all the coordinates of the boxes, is there any way i can give text coordinates so they appear in the box?

var Rad = 10
var Kolonne = 10
var Bredde = 350
var Høyde = 100
var Kolonnetall=0
var MellomromKolonne=100
var MellomromRad=25

    btnTegn.onclick=function(){

for (var i = 0; i < 15; i++) {
  ctx.beginPath();
  ctx.rect(Kolonne,Rad,Bredde,Høyde)
  ctx.moveTo(Bredde/2+Kolonne,Rad)
  ctx.lineTo(Bredde/2+Kolonne,Rad+Høyde)
  ctx.stroke();
  Rad+=MellomromRad+Høyde
  Kolonnetall++

   if (Kolonnetall==5) {
    Rad=10
     Kolonne+=Bredde+MellomromKolonne
     Kolonnetall=0

 }
}
}

As you can see, i am making rectangels with a line in bewtween. I would like to be able to add text to them.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda