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

180
Views
Konva Fail No se pueden leer las propiedades de undefined (leyendo 'newLine') de Array

Tengo un problema en Konva, esta secuencia de comandos dibuja algunos puntos y líneas entre el punto y lo que se puede arrastrar. Quiero seleccionar las líneas o los puntos y cuando paso el mouse o hago clic en la línea/punto creado, aparece un error, por ejemplo: Error de tipo no capturado: no se puede leer. propiedades de undefined (leyendo 'newLine')

 function updateObjects() { var shapes = stage.find('.line'); shapes.forEach((shape) => { shape.destroy(); }) targets.forEach((target) => { (function () { if (targets.length > 1) { if (target.id != targets.length - 1) { const targid = '#targets' + target.id; const targid2 = '#targets' + (target.id + 1); var ctarg = stage.find(targid)[0]; var entarg = stage.find(targid2)[0]; if (ctarg != null && entarg != null) { var newLine = new Konva.Line({ points: [ctarg.x(), ctarg.y(), entarg.x(), entarg.y()], stroke: 'black', strokeWidth: 5, lineCap: 'round', lineJoin: 'round', id: 'lineId=' + idCounter, name: 'line', }); idCounter++; //become an error on THIS this.newLine.on('mouseover', () => { document.body.style.cursor = 'pointer'; this.strokeWidth(12); }); layerLines.add(newLine); stage.add(layerLines); stage.add(layer); } } } })(); });

}

en this.strokeWidth(xx); tengo un error

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Error de alcance simple en su código - nueva línea r = declarado como

var newLine

luego referido como

this.newLine

¿Tal vez cometió un error al preparar su código de muestra para publicarlo?

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!