Skip to content

Commit cc230ca

Browse files
committed
feat(EAV-323): allow Take from Shuttle connected to Prompter View
1 parent 4f40cea commit cc230ca

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

packages/webui/src/client/ui/Prompter/PrompterView.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import { StudioScreenSaver } from '../StudioScreenSaver/StudioScreenSaver'
3333
import { PrompterControlManager } from './controller/manager'
3434
import { OverUnderTimer } from './OverUnderTimer'
3535
import { PrompterAPI, PrompterData, PrompterDataPart } from './prompter'
36+
import { doUserAction, UserAction } from '../../lib/clientUserAction'
37+
import { MeteorCall } from '../../lib/meteorApi'
3638

3739
const DEFAULT_UPDATE_THROTTLE = 250 //ms
3840
const PIECE_MISSING_UPDATE_THROTTLE = 2000 //ms
@@ -384,6 +386,17 @@ export class PrompterViewContent extends React.Component<Translated<IProps & ITr
384386
findAnchorPosition(startY: number, endY: number, sortDirection = 1): number | null {
385387
return (this.listAnchorPositions(startY, endY, sortDirection)[0] || [])[0] || null
386388
}
389+
take(e: Event | string): void {
390+
const { t } = this.props
391+
if (!this.props.rundownPlaylist) {
392+
logger.error('No active Rundown Playlist to perform a Take in')
393+
return
394+
}
395+
const playlist = this.props.rundownPlaylist
396+
doUserAction(t, e, UserAction.TAKE, (e, ts) =>
397+
MeteorCall.userAction.take(e, ts, playlist._id, playlist.currentPartInfo?.partInstanceId ?? null)
398+
)
399+
}
387400
private onWindowScroll = () => {
388401
this.triggerCheckCurrentTakeMarkers()
389402
}

packages/webui/src/client/ui/Prompter/controller/shuttle-webhid-device.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,15 @@ export class ShuttleWebHidController extends ControllerAbstract {
1111
private prompterView: PrompterViewInner
1212

1313
private speedMap = [0, 1, 2, 3, 5, 7, 9, 30]
14-
private jogMultiplierMap = this.speedMap.slice(1)
1514

16-
private readonly MIN_JOG_MULTIPLIER = 0
17-
private readonly MAX_JOG_MULTIPLIER = this.jogMultiplierMap.length - 1
18-
private readonly JOG_BASE_MOVEMENT_PX = 20
15+
private readonly JOG_BASE_MOVEMENT_PX = 100
1916

2017
private updateSpeedHandle: number | null = null
2118
private lastSpeed = 0
2219
private currentPosition = 0
2320

2421
private connectedShuttle: Shuttle | undefined
2522

26-
private jogMultiplierIndex = 3
27-
2823
private accessRequestCallback: AccessRequestCallback = {
2924
callback: this.requestAccess.bind(this),
3025
deviceName: 'Contour Shuttle',
@@ -127,7 +122,7 @@ export class ShuttleWebHidController extends ControllerAbstract {
127122
protected onButtonPressed(keyIndex: number): void {
128123
switch (keyIndex) {
129124
case 0:
130-
this.onJogMultipierDelta(-1)
125+
// no-op
131126
break
132127
case 1:
133128
this.resetSpeed()
@@ -142,23 +137,16 @@ export class ShuttleWebHidController extends ControllerAbstract {
142137
this.prompterView.scrollToFollowing()
143138
break
144139
case 4:
145-
this.onJogMultipierDelta(1)
140+
this.prompterView.take('Shuttle button 4 press')
146141
break
147142
}
148143
}
149144

150-
protected onJogMultipierDelta(delta: number): void {
151-
this.jogMultiplierIndex = Math.min(
152-
Math.max(this.jogMultiplierIndex + delta, this.MIN_JOG_MULTIPLIER),
153-
this.MAX_JOG_MULTIPLIER
154-
)
155-
}
156-
157145
protected onJog(delta: number): void {
158146
if (Math.abs(delta) > 1) return // this is a hack because sometimes, right after connecting to the device, the delta would be larger than 1 or -1
159147

160148
this.resetSpeed()
161-
window.scrollBy(0, this.JOG_BASE_MOVEMENT_PX * delta * this.jogMultiplierMap[this.jogMultiplierIndex])
149+
window.scrollBy(0, this.JOG_BASE_MOVEMENT_PX * delta)
162150
}
163151

164152
protected onShuttle(value: number): void {

0 commit comments

Comments
 (0)