Comments (3)
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.
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.
@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)
- Action required: Greenkeeper could not be activated 🚨
- FR: resize to avoid overlap HOT 5
- [Feature Request] Add option to "addCircle" to lock certain circles in place HOT 2
- [Feature Request] Ability to disable centering behavior HOT 5
- [Feature Request] Ability to modify circle radius HOT 3
- StopLoop incorrectly updates listeners HOT 1
- Execution environment HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circlepacker.