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

226
Vistas
Konva setAttr not a function error for children

I'm using Konva and trying to change the fill color of a tag using the setAttrs, however I keep getting an error "setAttrs is not a function" I'm trying to start by getting a child of the label, and setting the attribute of that. Any thought's on what I could be doing wrong?

// Add labels for each IO
      var IO = new Konva.Label({
        x: 10,
        y: 10,
        name: "Tag 1",
      });

      IO.add(
        new Konva.Tag({
                fill: '#C1EFF5',
                stroke: '#555',
                strokeWidth: 2,
        })
      );

      IO.add(
        new Konva.Text({
          text: "TestText",
          fontFamily: 'Calibri',
          fontSize: 12,
          padding: 5,
          fill: 'black',
        })
      );
            
    // Add listening Events such as clicking
    IO.on('click', function () {

        // get only Tag
        var tagsClicked = this.getChildren(function(node){
            return node.getClassName() === 'Tag';
        });
        tagsClicked.setAttrs({
            fill: 'red'
        });
    });
            
    // Add the input to the group for display
    group.add(IO);
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