Giter VIP home page Giter VIP logo

Comments (3)

dev-bjoern avatar dev-bjoern commented on September 18, 2024 1

Was closing because I thought I was doing something wrong. But I think I know the issue now.

I made a bug demo at: https://js-khse8x.stackblitz.io/ (source at https://stackblitz.com/edit/js-khse8x?file=index.js)
Click on the 'shift target' button. Sometimes you have to click it repeatedly or wait for the previous animation to completely stop or click 'random target' before.
It will sometimes not complete the circle movements. They will abruptly stop.

I think this is because setTarget inside shiftTarget only modifies the x value. Thus the hasItemMoved function inside CirclePacker.js returns false even though movement still happens along the x axis.

I fixed it by changing
Math.abs(positions[id].delta.x) > 0.005 && Math.abs(positions[id].delta.y) > 0.005
to
Math.abs(positions[id].delta.x) > 0.005 || Math.abs(positions[id].delta.y) > 0.005

inside the hasItemMoved function. Makes more sense to me like this for now. But I am not sure if this has other unwanted consequences somewhere else?

Thank you for looking into this!

from circlepacker.

snorpey avatar snorpey commented on September 18, 2024

hey @chickenwing, thank you for reporting this bug! did you close this issue intentionally or does the bug still exist? I will have a look at the code throughout the next couple of days and try to reproduce the issue.

from circlepacker.

snorpey avatar snorpey commented on September 18, 2024

@chickenwing thank you for taking the time to create a demo and for proposing a fix! i just published version 1.1.5 that includes your proposed fix.

from circlepacker.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.