Skip to content

Commit

Permalink
rename drag handlers, #45
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jul 13, 2017
1 parent 06ab19d commit 1545d67
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ define( function( require ) {
* @param {Node} relativeNode - angles are computed relative to this Node
* @constructor
*/
function MoleculeAngleHandler( molecule, relativeNode ) {
function MoleculeAngleDragHandler( molecule, relativeNode ) {

var previousAngle; // angle between the pointer and the molecule when the drag started

Expand Down Expand Up @@ -53,7 +53,7 @@ define( function( require ) {
} );
}

moleculePolarity.register( 'MoleculeAngleHandler', MoleculeAngleHandler );
moleculePolarity.register( 'MoleculeAngleDragHandler', MoleculeAngleDragHandler );

return inherit( SimpleDragHandler, MoleculeAngleHandler );
return inherit( SimpleDragHandler, MoleculeAngleDragHandler );
} );
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ define( function( require ) {
* @param {Property.<number>} bondAngleProperty - Property that this handler modifies
* @constructor
*/
function BondAngleHandler( molecule, bondAngleProperty ) {
function BondAngleDragHandler( molecule, bondAngleProperty ) {

var previousAngle = 0;

Expand Down Expand Up @@ -58,7 +58,7 @@ define( function( require ) {
} );
}

moleculePolarity.register( 'BondAngleHandler', BondAngleHandler );
moleculePolarity.register( 'BondAngleDragHandler', BondAngleDragHandler );

return inherit( SimpleDragHandler, BondAngleHandler );
return inherit( SimpleDragHandler, BondAngleDragHandler );
} );
14 changes: 7 additions & 7 deletions js/threeatoms/view/TriatomicMoleculeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ define( function( require ) {
// import
var ArrowsHandler = require( 'MOLECULE_POLARITY/threeatoms/view/ArrowsHandler' );
var AtomNode = require( 'MOLECULE_POLARITY/common/view/AtomNode' );
var BondAngleHandler = require( 'MOLECULE_POLARITY/threeatoms/view/BondAngleHandler' );
var BondAngleDragHandler = require( 'MOLECULE_POLARITY/threeatoms/view/BondAngleDragHandler' );
var BondDipoleNode = require( 'MOLECULE_POLARITY/common/view/BondDipoleNode' );
var BondNode = require( 'MOLECULE_POLARITY/common/view/BondNode' );
var inherit = require( 'PHET_CORE/inherit' );
var MolecularDipoleNode = require( 'MOLECULE_POLARITY/common/view/MolecularDipoleNode' );
var RotateArrowsNode = require( 'MOLECULE_POLARITY/threeatoms/view/RotateArrowsNode' );
var MoleculeAngleHandler = require( 'MOLECULE_POLARITY/common/view/MoleculeAngleHandler' );
var MoleculeAngleDragHandler = require( 'MOLECULE_POLARITY/common/view/MoleculeAngleDragHandler' );
var moleculePolarity = require( 'MOLECULE_POLARITY/moleculePolarity' );
var Node = require( 'SCENERY/nodes/Node' );
var PartialChargeNode = require( 'MOLECULE_POLARITY/common/view/PartialChargeNode' );
Expand Down Expand Up @@ -63,14 +63,14 @@ define( function( require ) {

// rotate molecule by dragging bonds or atom B
bondABNode.cursor = bondBCNode.cursor = atomBNode.cursor = 'pointer';
bondABNode.addInputListener( new MoleculeAngleHandler( molecule, this ) );
bondBCNode.addInputListener( new MoleculeAngleHandler( molecule, this ) );
atomBNode.addInputListener( new MoleculeAngleHandler( molecule, this ) );
bondABNode.addInputListener( new MoleculeAngleDragHandler( molecule, this ) );
bondBCNode.addInputListener( new MoleculeAngleDragHandler( molecule, this ) );
atomBNode.addInputListener( new MoleculeAngleDragHandler( molecule, this ) );

// change bond angles by dragging atom A or C
atomANode.cursor = atomCNode.cursor = 'pointer';
atomANode.addInputListener( new BondAngleHandler( molecule, molecule.bondAngleAProperty ) );
atomCNode.addInputListener( new BondAngleHandler( molecule, molecule.bondAngleCProperty ) );
atomANode.addInputListener( new BondAngleDragHandler( molecule, molecule.bondAngleAProperty ) );
atomCNode.addInputListener( new BondAngleDragHandler( molecule, molecule.bondAngleCProperty ) );

// arrows that act as interactivity cues
atomANode.addInputListener( new ArrowsHandler( arrowsANode ) );
Expand Down
4 changes: 2 additions & 2 deletions js/twoatoms/view/DiatomicMoleculeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ define( function( require ) {
var ElectronDensityNode = require( 'MOLECULE_POLARITY/twoatoms/view/ElectronDensityNode' );
var ElectrostaticPotentialNode = require( 'MOLECULE_POLARITY/twoatoms/view/ElectrostaticPotentialNode' );
var inherit = require( 'PHET_CORE/inherit' );
var MoleculeAngleHandler = require( 'MOLECULE_POLARITY/common/view/MoleculeAngleHandler' );
var MoleculeAngleDragHandler = require( 'MOLECULE_POLARITY/common/view/MoleculeAngleDragHandler' );
var moleculePolarity = require( 'MOLECULE_POLARITY/moleculePolarity' );
var Node = require( 'SCENERY/nodes/Node' );
var PartialChargeNode = require( 'MOLECULE_POLARITY/common/view/PartialChargeNode' );
Expand Down Expand Up @@ -56,7 +56,7 @@ define( function( require ) {

// rotate molecule by dragging anywhere
this.cursor = 'pointer';
this.addInputListener( new MoleculeAngleHandler( molecule, this ) );
this.addInputListener( new MoleculeAngleDragHandler( molecule, this ) );

// arrows that act as interactivity cues
atomANode.addInputListener( new ArrowsHandler( arrowsANode ) );
Expand Down
4 changes: 2 additions & 2 deletions js/twoatoms/view/ElectronDensityNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define( function( require ) {
// modules
var inherit = require( 'PHET_CORE/inherit' );
var LinearGradient = require( 'SCENERY/util/LinearGradient' );
var MoleculeAngleHandler = require( 'MOLECULE_POLARITY/common/view/MoleculeAngleHandler' );
var MoleculeAngleDragHandler = require( 'MOLECULE_POLARITY/common/view/MoleculeAngleDragHandler' );
var moleculePolarity = require( 'MOLECULE_POLARITY/moleculePolarity' );
var MPColors = require( 'MOLECULE_POLARITY/common/MPColors' );
var MPConstants = require( 'MOLECULE_POLARITY/common/MPConstants' );
Expand Down Expand Up @@ -72,7 +72,7 @@ define( function( require ) {
} );

this.cursor = 'pointer';
this.addInputListener( new MoleculeAngleHandler( molecule, this ) );
this.addInputListener( new MoleculeAngleDragHandler( molecule, this ) );
}

moleculePolarity.register( 'ElectronDensityNode', ElectronDensityNode );
Expand Down
4 changes: 2 additions & 2 deletions js/twoatoms/view/ElectrostaticPotentialNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define( function( require ) {
// modules
var inherit = require( 'PHET_CORE/inherit' );
var LinearGradient = require( 'SCENERY/util/LinearGradient' );
var MoleculeAngleHandler = require( 'MOLECULE_POLARITY/common/view/MoleculeAngleHandler' );
var MoleculeAngleDragHandler = require( 'MOLECULE_POLARITY/common/view/MoleculeAngleDragHandler' );
var moleculePolarity = require( 'MOLECULE_POLARITY/moleculePolarity' );
var MPColors = require( 'MOLECULE_POLARITY/common/MPColors' );
var MPConstants = require( 'MOLECULE_POLARITY/common/MPConstants' );
Expand Down Expand Up @@ -72,7 +72,7 @@ define( function( require ) {
} );

this.cursor = 'pointer';
this.addInputListener( new MoleculeAngleHandler( molecule, this ) );
this.addInputListener( new MoleculeAngleDragHandler( molecule, this ) );
}

moleculePolarity.register( 'ElectrostaticPotentialNode', ElectrostaticPotentialNode );
Expand Down

0 comments on commit 1545d67

Please sign in to comment.