Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

97
Visualizações
Append canvas elements to a group

I want to group elements and when these elements are dragged over the rectangle(group) element, they move with each other How to implement such a feature? Is there a way to know whether an element is on top of that element and append it to it as a child or any other solution

const elements = [
  { // this is the rectangle which I want to append elements to it
    id: '1',
    type: 'group',
    data: {
      label: 'node 1',
    },
    position: { x: 250, y: 0 },
  },
  {
    id: '2',
    type: 'ec2',
    data: {
      label: 'node 2',
    },
    position: { x: 100, y: 100 },
  },
  {
    id: '3',
    type: 's3',
    data: {
      label: 'node 3',
    },
    position: { x: 80, y: 120 },
  }
];

enter image description here

Getting positions of elements enter image description here

P.S: I am using React.js & react-flow-library (If that could help)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda