Skip to content

Commit

Permalink
Fix/102 (#106)
Browse files Browse the repository at this point in the history
* fix/102 improve osx feedback on navigation
* fix/102 refactor enable / disable OSC in
  • Loading branch information
cpvalente authored Apr 10, 2022
1 parent 67ddcd8 commit b01145c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
1 change: 0 additions & 1 deletion client/src/features/modals/OscSettingsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export default function OscSettingsModal() {
active={formData.enabled}
text={formData.enabled ? 'OSC IN Enabled' : 'OSC IN Disabled'}
actionHandler={() => handleChange('enabled', !formData.enabled)}
onClick={() => console.log('yay')}
/>
</FormControl>
<FormControl id='portIn'>
Expand Down
35 changes: 17 additions & 18 deletions server/src/classes/EventTimer.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,11 @@ export class EventTimer extends Timer {
case 'onPause':
// broadcast current state
this.broadcastState();

// send OSC
this.sendOsc(this.osc.implemented.pause);
if (this.prevCycle === this.cycleState.onUpdate) {
this.sendOsc(this.osc.implemented.pause);
}

// check integrations - http
if (h?.onLoad?.enabled) {
Expand Down Expand Up @@ -1278,21 +1281,19 @@ export class EventTimer extends Timer {
if (this.selectedEventIndex === 0) return;

// if there is no event running, go to first
if (this.selectedEventIndex == null) {
if (!this.selectedEventIndex) {
this.loadEvent(0);
return;
} else {
const gotoEvent = this.selectedEventIndex > 0 ? this.selectedEventIndex - 1 : 0;
if (gotoEvent === this.selectedEventIndex) return;
this.loadEvent(gotoEvent);
}

// send OSC
this.sendOsc(this.osc.implemented.previous);

// change playstate
this.pause();

const gotoEvent = this.selectedEventIndex > 0 ? this.selectedEventIndex - 1 : 0;

if (gotoEvent === this.selectedEventIndex) return;
this.loadEvent(gotoEvent);
}

next() {
Expand All @@ -1303,24 +1304,22 @@ export class EventTimer extends Timer {
if (this.selectedEventIndex === this.numEvents - 1) return;

// if there is no event running, go to first
if (this.selectedEventIndex == null) {
if (!this.selectedEventIndex) {
this.loadEvent(0);
return;
} else {
const gotoEvent =
this.selectedEventIndex < this.numEvents - 1
? this.selectedEventIndex + 1
: this.numEvents - 1;
if (gotoEvent === this.selectedEventIndex) return;
this.loadEvent(gotoEvent);
}

// send OSC
this.sendOsc(this.osc.implemented.next);

// change playstate
this.pause();

const gotoEvent =
this.selectedEventIndex < this.numEvents - 1
? this.selectedEventIndex + 1
: this.numEvents - 1;

if (gotoEvent === this.selectedEventIndex) return;
this.loadEvent(gotoEvent);
}

unload() {
Expand Down

0 comments on commit b01145c

Please sign in to comment.