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

193
Views
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 answers
Answer question

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