From db5d2b227bd396f9c07c9c7efebce1fa43bc7570 Mon Sep 17 00:00:00 2001 From: Jesse Greenberg Date: Fri, 31 Mar 2017 14:02:56 -0600 Subject: [PATCH] documentation cleanup, see #150 --- js/common/view/AtomView.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/common/view/AtomView.js b/js/common/view/AtomView.js index ead53981..97625d69 100644 --- a/js/common/view/AtomView.js +++ b/js/common/view/AtomView.js @@ -190,12 +190,16 @@ define( function( require ) { tandem: tandem.createTandem( bucket.sphereBucketTandem.tail + 'DragHandler' ) } ) ); + // a11y - pick up a particle to place it in the atom when user presses 'spacebar' or 'enter' - particle + // is extracted from the bucket and placed in the atom, the ElectronShellView handles the rest of + // the drag and drop interaction bucketFront.addAccessibleInputListener( { click: function() { if ( bucket.getParticleList().length > 0 ) { // get the closest particle to nucleus - var nearestParticle = bucket.extractClosestParticle( new Vector2( 0, 0 ) ); + var atomCenterInViewCoordinates = modelViewTransform.modelToViewPosition( model.particleAtom.positionProperty.get() ); + var nearestParticle = bucket.extractClosestParticle( atomCenterInViewCoordinates ); // move it to the first drop location (offset by a little to indicate it is still being placed) model.moveParticleToDropLocation( nearestParticle, model.particleAtom.positionProperty.get() ); @@ -207,10 +211,10 @@ define( function( require ) { } ); } ); - // Add the particle count indicator. + // Add the particle count indicator - display width arbitrarily chosen var particleCountDisplay = new ParticleCountDisplay( model.particleAtom, 13, 250, { tandem: tandem.createTandem( 'particleCountDisplay' ) - } ); // Width arbitrarily chosen. + } ); this.addChild( particleCountDisplay ); // Add the periodic table display inside of an accordion box.