@@ -30,6 +30,7 @@ var VerletSimulation = function(width, height, canvas) {
30
30
this . mouseDown = false ;
31
31
this . draggedEntity = null ;
32
32
this . selectionRadius = 20 ;
33
+ this . highlightColor = "#4f545c" ;
33
34
var _this = this ;
34
35
35
36
// prevent context menu
@@ -223,15 +224,6 @@ VerletSimulation.prototype.draw = function() {
223
224
224
225
this . ctx . clearRect ( 0 , 0 , this . canvas . width , this . canvas . height ) ;
225
226
226
- // highlight nearest / dragged entity
227
- var nearest = this . draggedEntity || this . nearestEntity ( ) ;
228
- if ( nearest ) {
229
- this . ctx . beginPath ( ) ;
230
- this . ctx . arc ( nearest . pos . x , nearest . pos . y , 8 , 0 , 2 * Math . PI ) ;
231
- this . ctx . strokeStyle = "#4f545c" ;
232
- this . ctx . stroke ( ) ;
233
- }
234
-
235
227
// draw constraints
236
228
for ( c in this . composites ) {
237
229
if ( this . composites [ c ] . drawConstraints ) {
@@ -255,6 +247,16 @@ VerletSimulation.prototype.draw = function() {
255
247
for ( i in particles )
256
248
particles [ i ] . draw ( this . ctx ) ;
257
249
}
250
+
251
+
252
+ // highlight nearest / dragged entity
253
+ var nearest = this . draggedEntity || this . nearestEntity ( ) ;
254
+ if ( nearest ) {
255
+ this . ctx . beginPath ( ) ;
256
+ this . ctx . arc ( nearest . pos . x , nearest . pos . y , 8 , 0 , 2 * Math . PI ) ;
257
+ this . ctx . strokeStyle = this . highlightColor ;
258
+ this . ctx . stroke ( ) ;
259
+ }
258
260
}
259
261
260
262
VerletSimulation . prototype . nearestEntity = function ( ) {
0 commit comments