Options
All
  • Public
  • Public/Protected
  • All
Menu

AppState is not quite a system but an object representing the state of the Collboard app.

deprecated

This system will be split into two CollSpace and SelectionSystem and removed

collboard-system

Hierarchy

  • AbstractSystem
    • AppState

Index

Constructors

  • new AppState(systems: ISystemsExtended): AppState
  • Parameters

    • systems: ISystemsExtended

    Returns AppState

Properties

boardname: BehaviorSubject<string>

Just mirroring the Cornerstone commit with boardname

deprecated

Put to separate system instead

ready: Promise<void>

Promise which is resolved when the system is initialized and ready to use.

selected: BehaviorSubject<AbstractPlacedArt[]>

Selected arts

selection: BehaviorSubject<null | { point1: IVectorData; point2: IVectorData }>

Selection is just a temporary box created from mousedown until mouseup After the releasing of the mouse selection became selected

systems: ISystemsExtended
testSelected: any

Testing code to showcase when selected is changed

testSelection: any

Testing code to showcase when selection is changed

transform: BehaviorSubject<Transform>

This represents user-view on the current board, Every user can have different. For example every user can have different position on the board.

deprecated

Put to CollSpace system instead

Accessors

  • get isDestroyed(): boolean
  • Is this object destroyed?

    Returns boolean

  • get isReady(): boolean
  • Checks if the system is initialized and ready to use.

    Returns boolean

Methods

  • addSubdestroyable(...subdestroyable: ITeardownLogic[]): AppState
  • Binds new registration with itself. This registration/destroyable will be destroyed with this.

    Parameters

    • Rest ...subdestroyable: ITeardownLogic[]

    Returns AppState

  • cancelSelection(): void
  • Set selection to nothing selected

    idempotent

    If you call this function twice, nothing will happen

    Returns void

  • checkIsReady(): void
  • Checks if the system is initialized and ready to use. If not, throws an error. If it is, do nothing.

    Returns void

  • checkWhetherNotDestroyed(errorMessage?: string, runBeforeError?: () => void): void
  • Checks, whether the object is not destroyed

    Parameters

    • Optional errorMessage: string

      Message that will replace default one before error

    • Optional runBeforeError: () => void

      Callback runed before error is thrown; typically this can be some logging

        • (): void
        • Returns void

    Returns void

  • destroy(): Promise<void>
  • Returns Promise<void>

  • getCommonAttributesOfSelectedArts(): string[]
  • Get common attributes of all selected arts

    example

    If there is no selected art, returns []

    example

    If there is one selected art, returns its attributes

    example

    If there are two selected arts - Art A with attributes color and size - Art B with attributes foo and color It returns color

    Returns string[]

  • getSelectedBoundingBox(): undefined | { bottomRight: Vector; topLeft: Vector }
  • This bounding box is relative to screen

    Returns undefined | { bottomRight: Vector; topLeft: Vector }

  • getSelection(): null | square
  • Returns null | square

  • hasAnyOfSelectedArtsGivenAttribute(attributeName: string): boolean
  • Checks if there is any selected art which has given attribute

    Parameters

    • attributeName: string

    Returns boolean

  • init(): Promise<void>
  • Returns Promise<void>

  • isArtSelected(__namedParameters: IIsArtSelectedOptions): boolean
  • [🌌]

    Parameters

    • __namedParameters: IIsArtSelectedOptions

    Returns boolean

  • setSelection(__namedParameters: { selected?: AbstractPlacedArt[]; selection?: null | { point1: IVectorData; point2: IVectorData } }): void
  • Parameters

    • __namedParameters: { selected?: AbstractPlacedArt[]; selection?: null | { point1: IVectorData; point2: IVectorData } }
      • Optional selected?: AbstractPlacedArt[]
      • Optional selection?: null | { point1: IVectorData; point2: IVectorData }

    Returns void

  • useArtSelected(__namedParameters: IIsArtSelectedOptions): boolean
  • [🌌]

    Parameters

    • __namedParameters: IIsArtSelectedOptions

    Returns boolean

  • isDestroyable(obj: any): obj is IDestroyable
  • Chcek whether the given object is destroyable

    Parameters

    • obj: any

    Returns obj is IDestroyable