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

202
Visualizações
How to arrange blocks in container when one square remove from it

I have blocks in container like below enter image description here

if i remove one block (ex: 1) it should arrange like below

enter image description here

assume i have all blocks coordinates like width, height of each block and x1,y1, x2, y2 from top i tried using recursive loops to find out all items below the deleted one and recursively move all items to move up.but its not working as expected as i need to consider collision (ex: if any block try to move up it should not collide with other blocks, ifcollision occur it should be in same place instead of moving up) any pointers to solution great help for me

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can declare an index for each block declaring position and width size for example for the first block you can store {x:1, y:1, w:2} ( x is position from left and y is position from top and w is block width which can be specified from your smallest block ) and every time that a block is removed you can rerender like : if a block with {x:1, y:1, w:2} is removed you search all the blocks and make a condition that if block.x and block.x + block.w is in (x .. x + w) range and block.y = y + 1 then you should replace this blocks absolute top postion with old top position - block height. I can help you rewrite the code better if you share your code.

about 4 years ago · Juan Pablo Isaza Relatório
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