@@ -103,13 +103,6 @@ VerletJS.prototype.Composite.prototype.pin = function(index, pos) {
103
103
return pc ;
104
104
}
105
105
106
- VerletJS . prototype . point = function ( pos ) {
107
- var composite = new this . Composite ( ) ;
108
- composite . particles . push ( new Particle ( pos ) ) ;
109
- this . composites . push ( composite ) ;
110
- return composite ;
111
- }
112
-
113
106
VerletJS . prototype . frame = function ( step ) {
114
107
var i , j , c ;
115
108
@@ -173,31 +166,26 @@ VerletJS.prototype.draw = function() {
173
166
174
167
this . ctx . clearRect ( 0 , 0 , this . canvas . width , this . canvas . height ) ;
175
168
176
- // draw constraints
177
169
for ( c in this . composites ) {
170
+ // draw constraints
178
171
if ( this . composites [ c ] . drawConstraints ) {
179
172
this . composites [ c ] . drawConstraints ( this . ctx , this . composites [ c ] ) ;
180
- continue ;
173
+ } else {
174
+ var constraints = this . composites [ c ] . constraints ;
175
+ for ( i in constraints )
176
+ constraints [ i ] . draw ( this . ctx ) ;
181
177
}
182
178
183
- var constraints = this . composites [ c ] . constraints ;
184
- for ( i in constraints )
185
- constraints [ i ] . draw ( this . ctx ) ;
186
- }
187
-
188
- // draw particles
189
- for ( c in this . composites ) {
179
+ // draw particles
190
180
if ( this . composites [ c ] . drawParticles ) {
191
181
this . composites [ c ] . drawParticles ( this . ctx , this . composites [ c ] ) ;
192
- continue ;
182
+ } else {
183
+ var particles = this . composites [ c ] . particles ;
184
+ for ( i in particles )
185
+ particles [ i ] . draw ( this . ctx ) ;
193
186
}
194
-
195
- var particles = this . composites [ c ] . particles ;
196
- for ( i in particles )
197
- particles [ i ] . draw ( this . ctx ) ;
198
187
}
199
-
200
-
188
+
201
189
// highlight nearest / dragged entity
202
190
var nearest = this . draggedEntity || this . nearestEntity ( ) ;
203
191
if ( nearest ) {
0 commit comments