Skip to content

Commit

Permalink
initial commit getting markers working, see #21 and #20
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Oct 29, 2021
1 parent a571e58 commit 336d450
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
39 changes: 39 additions & 0 deletions js/quadrilateral/view/QuadrilateralMarkerInput.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2020-2021, University of Colorado Boulder

/**
* This file adds mechamarkers as an input controller to Ratio and Proportion
*
* @author Michael Kauzmann (PhET Interactive Simulations)
*/

import MarkerInput from '../../../../tangible/js/MarkerInput.js';
import quadrilateral from '../../quadrilateral.js';

// constants
// Note marker 2 of original aruco doesn't work well when camera is flipped.
const BASE_MARKER = 4;
const RATIO_MARKER_LEFT = 2;
const RATIO_MARKER_RIGHT = 0;

class QuadrilateralMarkerInput extends MarkerInput {

/**
*/
constructor() {
super();
}

/**
* @public
*/
step() {
phet.log && phet.log( [
RATIO_MARKER_LEFT, this.Beholder.getMarker( RATIO_MARKER_LEFT ).present, '\n',
BASE_MARKER, this.Beholder.getMarker( BASE_MARKER ).present, '\n',
RATIO_MARKER_RIGHT, this.Beholder.getMarker( RATIO_MARKER_RIGHT ).present, '\n'
] );
}
}

quadrilateral.register( 'QuadrilateralMarkerInput', QuadrilateralMarkerInput );
export default QuadrilateralMarkerInput;
6 changes: 6 additions & 0 deletions js/quadrilateral/view/QuadrilateralScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import QuadrilateralConstants from '../../common/QuadrilateralConstants.js';
import quadrilateral from '../../quadrilateral.js';
import QuadrilateralModel from '../model/QuadrilateralModel.js';
import QuadrilateralQueryParameters from '../QuadrilateralQueryParameters.js';
import QuadrilateralMarkerInput from './QuadrilateralMarkerInput.js';
import QuadrilateralNode from './QuadrilateralNode.js';
import QuadrilateralSoundView from './QuadrilateralSoundView.js';
import SideDemonstrationNode from './SideDemonstrationNode.js';
Expand Down Expand Up @@ -72,6 +73,9 @@ class QuadrilateralScreenView extends ScreenView {
tandem: tandem.createTandem( 'resetAllButton' )
} );
this.addChild( resetAllButton );

// testing marker input
this.markerInput = new QuadrilateralMarkerInput();
}

/**
Expand Down Expand Up @@ -124,6 +128,8 @@ class QuadrilateralScreenView extends ScreenView {
if ( this.demonstrationNode ) {
this.demonstrationNode.step( dt );
}

this.markerInput.step( dt );
}

/**
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
"phet-io",
"adapted-from-phet"
],
"phetLibs": [
"tangible"
],
"preload": [
"../sherpa/lib/beholder-detection-1.1.12.js"
],
"simFeatures": {
"supportsInteractiveDescription": true,
"supportsVoicing": true,
Expand Down
9 changes: 8 additions & 1 deletion quadrilateral_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"phet-io",
"adapted-from-phet"
],
"phetLibs": [
"tangible"
],
"preload": [
"../sherpa/lib/beholder-detection-1.1.12.js"
],
"simFeatures": {
"supportsInteractiveDescription": true,
"supportsVoicing": true,
Expand Down Expand Up @@ -98,7 +104,8 @@
'../sherpa/lib/base64-js-1.2.0.js',
'../sherpa/lib/TextEncoderLite-3c9f6f0.js',
'../tandem/js/PhetioIDUtils.js',
'../perennial-alias/js/common/SimVersion.js'
'../perennial-alias/js/common/SimVersion.js',
'../sherpa/lib/beholder-detection-1.1.12.js'
];

if ( brand === 'phet-io' ) {
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"references": [
{
"path": "../joist"
},
{
"path": "../tangible"
}
],
"include": [
Expand Down

0 comments on commit 336d450

Please sign in to comment.