File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ function average(array) {
7979function particleCollisions ( checkIndex , particles ) {
8080 particle = particles [ checkIndex ] ;
8181 particles . map ( function ( particleToCheck , i ) {
82- if ( i != checkIndex && i != 0 && i < checkIndex ) {
82+ if ( i < checkIndex ) {
8383 var distance = particleToCheck . distance ( particle ) ;
8484 if ( distance . r <= particleToCheck . radius + particle . radius ) {
8585 let wallAngle = distance . deg + 90 ;
Original file line number Diff line number Diff line change @@ -152,12 +152,33 @@ function printInputs() {
152152 } else {
153153 settingInput . val ( initValue ) ;
154154 }
155-
155+ if ( settingInput . attr ( 'type' ) == 'range' ) {
156+ settingContainer . append ( $ ( '<button class="adder">+</buttom>' ) ) ;
157+ settingContainer . append ( $ ( '<button class="subtractor">-</buttom>' ) ) ;
158+ }
156159 } ) ;
157160 $ ( '[type="range"]' ) . change ( function ( e ) {
158161 let target = $ ( this ) ;
159162 target . parent ( ) . children ( 'p' ) . html ( target . val ( ) )
160163 } ) ;
164+ $ ( '.adder' ) . click ( function ( e ) {
165+ let target = $ ( this ) ;
166+ let varName = target . parent ( ) . attr ( 'var' ) ;
167+ let value = window [ varName ] ;
168+ value ++ ;
169+ window [ varName ] = value ;
170+ target . parent ( ) . children ( 'input' ) . val ( value ) ;
171+ target . parent ( ) . children ( 'p' ) . html ( value ) ;
172+ } ) ;
173+ $ ( '.subtractor' ) . click ( function ( e ) {
174+ let target = $ ( this ) ;
175+ let varName = target . parent ( ) . attr ( 'var' ) ;
176+ let value = window [ varName ] ;
177+ value -- ;
178+ window [ varName ] = value ;
179+ target . parent ( ) . children ( 'input' ) . val ( value ) ;
180+ target . parent ( ) . children ( 'p' ) . html ( value ) ;
181+ } ) ;
161182 //Clock is http://flipclockjs.com/
162183
163184}
You can’t perform that action at this time.
0 commit comments