Commit 483f7f1 1 parent 76d7d86 commit 483f7f1 Copy full SHA for 483f7f1
File tree 3 files changed +11
-6
lines changed
3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -54,16 +54,21 @@ class Bucket extends SphereBucket {
54
54
55
55
// Create the atoms for each element and add them to the bucket.
56
56
for ( let i = 0 ; i < quantity ; i ++ ) {
57
- this . addParticleFirstOpen ( new Atom2 ( element , stepEmitter ) , false ) ;
57
+ this . addParticleNearestOpen ( new Atom2 ( element , stepEmitter ) , false ) ;
58
58
}
59
59
}
60
60
61
61
// Instantly place the atom in the correct position, whether or not it is in the bucket
62
- placeAtom ( atom ) {
62
+ placeAtom ( atom , addFirstOpen ) {
63
63
if ( this . containsParticle ( atom ) ) {
64
64
this . removeParticle ( atom , true ) ;
65
65
}
66
- this . addParticleFirstOpen ( atom , false ) ;
66
+ if ( addFirstOpen ) {
67
+ this . addParticleFirstOpen ( atom , false ) ;
68
+ }
69
+ else {
70
+ this . addParticleNearestOpen ( atom , false ) ;
71
+ }
67
72
}
68
73
69
74
/**
@@ -75,7 +80,7 @@ class Bucket extends SphereBucket {
75
80
this . fullState . forEach ( atom => {
76
81
if ( ! this . particleList . contains ( atom ) ) {
77
82
this . particleList . push ( atom ) ;
78
- this . placeAtom ( atom ) ;
83
+ this . placeAtom ( atom , true ) ;
79
84
}
80
85
} ) ;
81
86
}
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ class Kit {
93
93
atom . reset ( ) ;
94
94
95
95
// THEN place it so we overwrite its "bad" position and destination info
96
- this . getBucketForElement ( atom . element ) . placeAtom ( atom ) ;
96
+ this . getBucketForElement ( atom . element ) . placeAtom ( atom , true ) ;
97
97
} ) ;
98
98
99
99
// if reset kit ignores collection boxes, add in other atoms that are equivalent to how the bucket started
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ class KitNode extends Node {
128
128
129
129
// Add the particle to the bucket atom layer and the bucket's particles.
130
130
this . atomLayer . addChild ( atomNode ) ;
131
- bucket . placeAtom ( atom ) ;
131
+ bucket . placeAtom ( atom , false ) ;
132
132
133
133
// Add a drag listener that will move the model element when the user
134
134
// drags this atom.
You can’t perform that action at this time.
0 commit comments