Skip to content

Commit

Permalink
Add start pinch requirement option
Browse files Browse the repository at this point in the history
  • Loading branch information
martinstarkov committed May 22, 2024
1 parent 54f293a commit bd6125b
Show file tree
Hide file tree
Showing 6 changed files with 374 additions and 165 deletions.
24 changes: 21 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/.cache
/dist
/node_modules
.cache
.git
.idea

# build
build
dist

# module
node_modules

# packager
exe
out

package-lock.json
Library/
src/assets/ui/reset_button.xcf
src/data/config.json
src/data/*.csv
csv/*.csv
1 change: 1 addition & 0 deletions src/data/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"enableAutoSkip": false,
"autoSkipThreshold": 1,
"disableSonification": false,
"singlePinchRequirement": true,
"disableLayerProgression": false,
"indexFingerOnly": false,
"sonificationLevel": 1.0,
Expand Down
1 change: 1 addition & 0 deletions src/data/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"skipLoopThreshold": 1,
"enableAutoSkip": false,
"autoSkipThreshold": 1,
"singlePinchRequirement": true,
"disableSonification": false,
"disableLayerProgression": false,
"indexFingerOnly": false,
Expand Down
48 changes: 27 additions & 21 deletions src/ts/objects/finger.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
import { HandLandmarkIndex } from '../objects/handLandmarks'
import { fingerColors, fingerSpriteDepth } from '../core/config'
import { MatterSprite, Scene } from '../core/phaserTypes'
import setInteraction from '../util/interaction'
import { HandLandmarkIndex } from '../objects/handLandmarks';
import { fingerColors, fingerSpriteDepth } from '../core/config';
import { MatterSprite, Scene } from '../core/phaserTypes';
import setInteraction from '../util/interaction';

export default class Finger extends MatterSprite {
public readonly name: string
public readonly landmarkIndex: HandLandmarkIndex

constructor(scene: Scene, spriteKey: string, name: string, landmarkIndex: HandLandmarkIndex, spriteScale: number) {
public readonly name: string;
public readonly landmarkIndex: HandLandmarkIndex;

constructor(
scene: Scene,
spriteKey: string,
name: string,
landmarkIndex: HandLandmarkIndex,
spriteScale: number,
) {
super(scene.matter.world, 0, 0, spriteKey, undefined, {
render: {
visible: true
}
})
visible: true,
},
});

this.name = name
this.landmarkIndex = landmarkIndex
this.name = name;
this.landmarkIndex = landmarkIndex;

this.scene.add.existing(this)
this.scene.add.existing(this);

this.setScale(spriteScale)
this.setTint(fingerColors[this.name])
this.setDepth(fingerSpriteDepth)
this.setScale(spriteScale);
this.setTint(fingerColors[this.name]);
this.setDepth(fingerSpriteDepth);

this.setCircle(this.displayWidth / 2, {
label: this.name
})
label: this.name,
});

this.setSensor(true)
this.setSensor(true);

setInteraction(this, false)
setInteraction(this, false);
}
}
Loading

0 comments on commit bd6125b

Please sign in to comment.