Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TimelineEditor<SS>

TimelineEditor is a Redux-connected component responsible for rendering and manipulating the timeline for a given chapter by dragging elements to timeline tracks or preview screens, thereby composing the presentation on an element-level. This works in idea like a traditional non-linear video editor. It receives all its props via the Redux state tree.

Type parameters

  • SS

Hierarchy

Index

Constructors

constructor

Properties

Private canvasWidth

canvasWidth: number = window.innerWidth - 40 - 300

context

context: any

props

props: Readonly<object> & Readonly<TimelineEditorProps>

refs

refs: object

Type declaration

  • [key: string]: ReactInstance

Private scrubberHeight

scrubberHeight: 15 = 15

Private stageWrapper

stageWrapper: Nullable<Stage>

state

state: Readonly<TimelineEditorState>

Private trackOffsets

trackOffsets: [number, number] = [150, 25]

Methods

Optional UNSAFE_componentWillMount

  • UNSAFE_componentWillMount(): void

Optional UNSAFE_componentWillReceiveProps

  • UNSAFE_componentWillReceiveProps(nextProps: Readonly<TimelineEditorProps>, nextContext: any): void

Optional UNSAFE_componentWillUpdate

Private assignAssetDuration

  • Assigns a new duration to a given asset, but only if the current duration of the asset is equal to zero. If the asset's duration is not zero, the asset is returned unchanged. This is acheived by opening a dialogue, prompting to select a duration for the asset. If the new value is invalid or the user cancels the prompt, the asset is returne unchanged.

    Parameters

    • asset: Asset

      The asset for which the duration shall be updated

    Returns Asset

    The updated asset

Optional componentDidCatch

  • componentDidCatch(error: Error, errorInfo: ErrorInfo): void
  • Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

    Parameters

    • error: Error
    • errorInfo: ErrorInfo

    Returns void

Optional componentDidMount

  • componentDidMount(): void
  • Called immediately after a compoment is mounted. Setting state here will trigger re-rendering.

    Returns void

Optional componentDidUpdate

  • Called immediately after updating occurs. Not called for the initial render.

    The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.

    Parameters

    Returns void

componentWillMount

  • componentWillMount(): void
  • Callback invoked when the component mounts for the first time. Checks whether there is a timeline associated to the given chapter and redirects back to the ProgramAuthor component if not.

    Returns void

Optional componentWillReceiveProps

Optional componentWillUnmount

  • componentWillUnmount(): void
  • Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.

    Returns void

Optional componentWillUpdate

Private elementClicked

  • elementClicked(timelineId: string, trackId: string, elementId: string, currentDuration: number): Promise<void>
  • Callback invoked when the user clicks an element on a timeline track. The callback receives timeline, track, element ID and current duration of the element. This function is intended for the user to update an element's duration. This is achieved by showing the user a prompt to type in a new duration. If the selected duration is invalid of if the user cancels the prompt, the function does nothing.

    Parameters

    • timelineId: string

      The ID of the timeline on which the removed element is located

    • trackId: string

      The ID of the track in which the removed element is located

    • elementId: string

      The ID of the removed element itself

    • currentDuration: number

    Returns Promise<void>

Private elementRemoved

  • elementRemoved(timelineId: string, trackId: string, elementId: string): Promise<void>
  • Callback invoked when the user triggers the event for removing a specific element on a timeline track. The callback receives timeline, track and element ID and updates the Redux tree accordingly.

    Parameters

    • timelineId: string

      The ID of the timeline on which the removed element is located

    • trackId: string

      The ID of the track in which the removed element is located

    • elementId: string

      The ID of the removed element itself

    Returns Promise<void>

forceUpdate

  • forceUpdate(callBack?: undefined | function): void
  • Parameters

    • Optional callBack: undefined | function

    Returns void

Private getChapterDuration

  • getChapterDuration(): number
  • Returns the duration of the current chapter, taking durations of descendant chapters into account.

    Returns number

    The duration of the current chapter

Optional getSnapshotBeforeUpdate

  • Runs before React applies the result of render to the document, and returns an object to be given to componentDidUpdate. Useful for saving things such as scroll position before render causes changes to it.

    Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated lifecycle events from running.

    Parameters

    Returns SS | null

Private getTimeline

  • Returns the timeline associated with the current chapter.

    Returns undefined | Timeline

    The timeline for the current chapter

Private getTrackLayout

  • getTrackLayout(): List<object>
  • Computes the global track layout as seen from the current chapter. This means that elements on timeline for the current chapter govern the duration if the timeline and elements located in ancestor chapters are trimmed to fit inside the timeline and rendered on locked tracks. Moreover, descendant tracks are merged and also rendered on locked tracks. I.e. only tracks which contain elements associated to the current chapter can be changed. The function returns a list with an entry for each region on all preview screens, containing region ID, color and a track object if there were any elements assigned to that track in some chapter in the current branch.

    Returns List<object>

    The global track layout as seen from the current chapter

Private onChapterClicked

  • onChapterClicked(accessPath: Array<number>): void
  • Callback invoked when the name of a chapter in the program structure sidebar is clicked. The callback receives the access path of the chapter that was clicked and navigates to the TimelineEditor for that chapter.

    Parameters

    • accessPath: Array<number>

    Returns void

Private onComponentDroppedOnScreen

  • onComponentDroppedOnScreen(componentId: string, regionId: string): Promise<void>
  • Callback invoked when an element is dropped into a preview screen region. The callback receives the component and region ID for the region the component was dropped into. Updates the data structures on the server as well as the Redux state.

    Parameters

    • componentId: string

      ID of component which was dropped

    • regionId: string

      ID of region component was dropped into

    Returns Promise<void>

Private onComponentDroppedOnTrack

  • onComponentDroppedOnTrack(e: DragEvent<HTMLDivElement>): Promise<void>
  • Callback invoked when an element is dropped onto a timeline track. The callback receives the original drag event and updates the data structures on the server as well as the Redux state.

    Parameters

    • e: DragEvent<HTMLDivElement>

    Returns Promise<void>

render

  • render(): null | Element
  • Renders the component.

    Returns null | Element

Private renderScreen

  • renderScreen(screenHeight: number): null | Element
  • Renders a preview screen components can be dropped into. The actual screen that is rendered depends on the currentScreen property found in the Redux state.

    Parameters

    • screenHeight: number

      Desired height of the screen to be rendered

    Returns null | Element

    JSX elements for placing and rendering the screen

setState

  • setState<K>(state: function | null | S | object, callback?: undefined | function): void
  • Type parameters

    • K: keyof TimelineEditorState

    Parameters

    • state: function | null | S | object
    • Optional callback: undefined | function

    Returns void

Optional shouldComponentUpdate

  • Called to determine whether the change in props and state should trigger a re-render.

    Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.

    If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.

    Parameters

    Returns boolean

Generated using TypeDoc