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

194
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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