Skip to content

Commit

Permalink
feat: edit mode for drag operations
Browse files Browse the repository at this point in the history
  • Loading branch information
mint-dewit committed Dec 18, 2024
1 parent 1284f9f commit b075967
Show file tree
Hide file tree
Showing 11 changed files with 372 additions and 266 deletions.
7 changes: 7 additions & 0 deletions packages/blueprints-integration/src/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ export interface IShelfAction extends ITriggeredActionBase {
filterChain: IGUIContextFilterLink[]
}

export interface IEditModeAction extends ITriggeredActionBase {
action: ClientActions.editMode
state: true | false | 'toggle'
filterChain: IGUIContextFilterLink[]
}

export interface IGoToOnAirLineAction extends ITriggeredActionBase {
action: ClientActions.goToOnAirLine
filterChain: IGUIContextFilterLink[]
Expand Down Expand Up @@ -318,6 +324,7 @@ export type SomeAction =
| IRundownPlaylistResetAction
| IRundownPlaylistResyncAction
| IShelfAction
| IEditModeAction
| IGoToOnAirLineAction
| IRewindSegmentsAction
| IShowEntireCurrentSegmentAction
Expand Down
7 changes: 7 additions & 0 deletions packages/meteor-lib/src/triggers/RundownViewEventBus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export enum RundownViewEvents {
REVEAL_IN_SHELF = 'revealInShelf',
SWITCH_SHELF_TAB = 'switchShelfTab',
SHELF_STATE = 'shelfState',
EDIT_MODE = 'editMode',
MINI_SHELF_QUEUE_ADLIB = 'miniShelfQueueAdLib',
GO_TO_PART = 'goToPart',
GO_TO_PART_INSTANCE = 'goToPartInstance',
Expand Down Expand Up @@ -74,6 +75,10 @@ export interface ShelfStateEvent extends IEventContext {
state: boolean | 'toggle'
}

export interface EditModeEvent extends IEventContext {
state: boolean | 'toggle'
}

export interface MiniShelfQueueAdLibEvent extends IEventContext {
forward: boolean
}
Expand Down Expand Up @@ -139,6 +144,7 @@ class RundownViewEventBus0 extends EventEmitter {
emit(event: RundownViewEvents.SEGMENT_ZOOM_ON): boolean
emit(event: RundownViewEvents.SEGMENT_ZOOM_OFF): boolean
emit(event: RundownViewEvents.SHELF_STATE, e: ShelfStateEvent): boolean
emit(event: RundownViewEvents.EDIT_MODE, e: EditModeEvent): boolean
emit(event: RundownViewEvents.REVEAL_IN_SHELF, e: RevealInShelfEvent): boolean
emit(event: RundownViewEvents.SWITCH_SHELF_TAB, e: SwitchToShelfTabEvent): boolean
emit(event: RundownViewEvents.MINI_SHELF_QUEUE_ADLIB, e: MiniShelfQueueAdLibEvent): boolean
Expand Down Expand Up @@ -175,6 +181,7 @@ class RundownViewEventBus0 extends EventEmitter {
on(event: RundownViewEvents.SEGMENT_ZOOM_OFF, listener: () => void): this
on(event: RundownViewEvents.REVEAL_IN_SHELF, listener: (e: RevealInShelfEvent) => void): this
on(event: RundownViewEvents.SHELF_STATE, listener: (e: ShelfStateEvent) => void): this
on(event: RundownViewEvents.EDIT_MODE, listener: (e: EditModeEvent) => void): this
on(event: RundownViewEvents.SWITCH_SHELF_TAB, listener: (e: SwitchToShelfTabEvent) => void): this
on(event: RundownViewEvents.MINI_SHELF_QUEUE_ADLIB, listener: (e: MiniShelfQueueAdLibEvent) => void): this
on(event: RundownViewEvents.GO_TO_PART, listener: (e: GoToPartEvent) => void): this
Expand Down
13 changes: 13 additions & 0 deletions packages/meteor-lib/src/triggers/actionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,17 @@ function createShelfAction(_filterChain: IGUIContextFilterLink[], state: boolean
}
}

function createEditModeAction(_filterChain: IGUIContextFilterLink[], state: boolean | 'toggle'): ExecutableAction {
return {
action: ClientActions.editMode,
execute: () => {
RundownViewEventBus.emit(RundownViewEvents.EDIT_MODE, {
state,
})
},
}
}

function createMiniShelfQueueAdLibAction(_filterChain: IGUIContextFilterLink[], forward: boolean): ExecutableAction {
return {
action: ClientActions.miniShelfQueueAdLib,
Expand Down Expand Up @@ -443,6 +454,8 @@ export function createAction(
switch (action.action) {
case ClientActions.shelf:
return createShelfAction(action.filterChain, action.state)
case ClientActions.editMode:
return createEditModeAction(action.filterChain, action.state)
case ClientActions.goToOnAirLine:
return createGoToOnAirLineAction(action.filterChain)
case ClientActions.rewindSegments:
Expand Down
1 change: 1 addition & 0 deletions packages/shared-lib/src/core/model/ShowStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export enum ClientActions {
'rewindSegments' = 'rewindSegments',
'showEntireCurrentSegment' = 'showEntireCurrentSegment',
'miniShelfQueueAdLib' = 'miniShelfQueueAdLib',
'editMode' = 'editMode',
}

export enum DeviceActions {
Expand Down
5 changes: 4 additions & 1 deletion packages/webui/src/client/lib/ui/pieceUiClassNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export function pieceUiClassNames(
uiState?: {
leftAnchoredWidth: number
rightAnchoredWidth: number
}
},
draggable?: boolean
): string {
const typeClass = layerType ? RundownUtils.getSourceLayerClassName(layerType) : ''

Expand Down Expand Up @@ -57,5 +58,7 @@ export function pieceUiClassNames(
'invert-flash': highlight,

'element-selected': selected,

'draggable-element': draggable,
})
}
28 changes: 16 additions & 12 deletions packages/webui/src/client/styles/elementSelected.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
$glow-color: rgba(255, 255, 255, 0.58);

.element-selected {
box-shadow: inset 0 0 15px $glow-color;
animation: subtle-glow 1s ease-in-out infinite;
box-shadow: inset 0 0 15px $glow-color;
animation: subtle-glow 1s ease-in-out infinite;

@keyframes subtle-glow {
0%, 100% {
box-shadow: inset 0 0 15px $glow-color;
}
50% {
box-shadow: inset 0 0 25px $glow-color,
inset 0 0 35px $glow-color;
}
}
}
@keyframes subtle-glow {
0%,
100% {
box-shadow: inset 0 0 15px $glow-color;
}
50% {
box-shadow: inset 0 0 25px $glow-color, inset 0 0 35px $glow-color;
}
}
}

.draggable-element {
border: dotted white 1px;
}
Loading

0 comments on commit b075967

Please sign in to comment.