Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ChapterNode<SS>

ChapterNode is a component which renders the representation of a chapter as a box onto a canvas and provides callbacks for all interactions related to the node, such as clicking the chapter itself, the close symbol, the name label or the handles for adding new chapters.

param

The chapter node to be rendered

param

The [x, y] position the node should be rendered at

param

The size of the node as [w, h]

param

The path to the current node by navigating the tree.

param

Callback invoked when the node itself is clicked. Receives the access path.

param

Callback invoked when the chapters label is clicked. Receives the access path and the current name.

param

Callback invoked when one of the handles is clicked. Receives the access path and the position of the handle that was clicked.

param

Callback invoked when the x symbol of the chapter is clicked. Receives the access path.

Type parameters

  • SS

Hierarchy

Index

Constructors

constructor

  • Parameters

    Returns ChapterNode

Properties

context

context: any

props

props: Readonly<object> & Readonly<ChapterNodeProps>

refs

refs: object

Type declaration

  • [key: string]: ReactInstance

state

state: Readonly<ChapterNodeState>

Methods

Optional UNSAFE_componentWillMount

  • UNSAFE_componentWillMount(): void

Optional UNSAFE_componentWillReceiveProps

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

Optional UNSAFE_componentWillUpdate

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

Optional componentWillMount

  • componentWillMount(): void

Optional componentWillReceiveProps

  • componentWillReceiveProps(nextProps: Readonly<ChapterNodeProps>, nextContext: any): void

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

forceUpdate

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

    • Optional callBack: undefined | function

    Returns void

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

render

  • render(): Element
  • Renders the component.

    Returns Element

Private renderHandles

  • Renders the handles for adding new chapters on the left, right and bottom of the chapter, but only if the chapter is hovered. If the chapter has children, this function renders a connecting line to the child nodes. If the chapter has no children and is not hovered, it renders nothing.

    Returns Nullable<Element>

    The rendered handles if chapter is hovered and has children, nothing otherwise

setState

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

    • K: keyof ChapterNodeState

    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

Object literals

Private strokeColors

strokeColors: object

default

default: string = "#000000"

hover

hover: string = "#2B98F0"

Generated using TypeDoc