Options
All
  • Public
  • Public/Protected
  • All
Menu

Implements a Slider2DModel's player and controller views and the functions needed for user interaction.

Hierarchy

Index

Constructors

constructor

Properties

Private active

active: boolean

Indicator whether the marker is currently dragged or not.

Private boxId

boxId: string

Unique Id for the div that wraps the canvas. Is as big as the canvas.

Private canvasId

canvasId: string

Unique Id for the canvas.

Private height

height: number

Height of the drawing canvas in px.

Private imgId

imgId: string

Unique Id for the image that is shown in the canvas.

Protected inputCallback

inputCallback: (s: ControllerInputType | PlayerInputType) => void = ...

This function is called whenever a user interacts with the module.

Type declaration

Private markerId

markerId: string

Unique Id for the draggable marker.

Private markerSize

markerSize: number

Size/Radius of the draggable marker inside the canvas/box.

Private markerboundsId

markerboundsId: string

Unique Id for the div that holds the canvas (this is markerSize/2 bigger than the canvas, so the marker can be dragged to the most outer edge of the canvas div).

model

A Module View always holds a Module Model that has all the informations and settings.

Private newPosition

newPosition: Coordinate

The position of the newest drag update.

Private oldPosition

oldPosition: Coordinate

The position of the last drag update.

Private rangedPosition

rangedPosition: Coordinate

The normalized coordinate.

Protected renderCallback

renderCallback: () => void = ...

This function is called when the model changes it's view has to be rerendered.

Type declaration

    • (): void
    • This function is called when the model changes it's view has to be rerendered.

      Returns void

Private widgetId

widgetId: string

Unique Id for the most outer div wrapper.

Private width

width: number

Width of the drawing canvas in px.

Private xrangeMax

xrangeMax: number

The maximum x-value the marker can have (used to calculate rangedPosition).

Private xrangeMin

xrangeMin: number

The minimum x-value the marker can have (used to calculate rangedPosition).

Private yrangeMax

yrangeMax: number

The maximum y-value the marker can have (used to calculate rangedPosition).

Private yrangeMin

yrangeMin: number

The minimum y-value the marker can have (used to calculate rangedPosition).

Accessors

midiDevices

  • set midiDevices(deviceList: string[]): void
  • Update the list of Midi output devices.

    Parameters

    • deviceList: string[]

    Returns void

Methods

backgroundImgPathInputChange

  • backgroundImgPathInputChange(e: Event): void
  • Sends the changed background image path to the server.

    Parameters

    • e: Event

      A text input element.

    Returns void

Private calculatePosition

  • calculatePosition(): void
  • Given the width and height of the canvas together with the marker size, calculate the current position of the marker (as relative value between x/yrangeMin and x/yrangeMax) and store it in rangedPosition.

    Returns void

composeControllerSettingsView

  • composeControllerSettingsView(): TemplateResult<ResultType>
  • Composes the controller view parts that are specific to this model. Has to be implemented by the child class that inherits from this class.

    Returns TemplateResult<ResultType>

composeNameInput

  • composeNameInput(): TemplateResult<ResultType>
  • Composes an input field where the name of the module can be set.

    Returns TemplateResult<ResultType>

    A Template Result without an outer div.

composePlayerTypeSelection

  • composePlayerTypeSelection(): TemplateResult<ResultType>
  • Composes a dropdown select element that let's the controller choose for which type of players this model is visible.

    Returns TemplateResult<ResultType>

    A Template Result without an outer div.

composePlayerView

  • composePlayerView(): TemplateResult<ResultType>
  • Composes the player view parts that are specific to this model. Has to be implemented by the child class that inherits from this class.

    Returns TemplateResult<ResultType>

Private displayPosition

  • displayPosition(): void
  • Display the new ranged position of the marker

    Returns void

Private drag

  • drag(e: MouseEvent | TouchEvent): void
  • Triggered for every registered mouse/touch movement, when the marker is currently being dragged.

    Parameters

    • e: MouseEvent | TouchEvent

    Returns void

Private dragEnd

  • dragEnd(e: MouseEvent | TouchEvent): void
  • Triggered whenever a touch/mouse drag ends.

    Parameters

    • e: MouseEvent | TouchEvent

    Returns void

Private dragStart

  • dragStart(e: MouseEvent | TouchEvent): void
  • Triggered when clicked inside the box/canvas. Prepares the drag movement.

    Parameters

    • e: MouseEvent | TouchEvent

    Returns void

getControllerView

  • Composes the general controller view of every model, regardless of the specific model type.

    Parameters

    Returns TemplateResult<ResultType>

    The controller view as Template Result.

Private getMarker

  • Get the marker position.

    Returns Coordinate

    Absolute position of the marker (absolute on-screen value in px).

getPlayerView

  • Composes the general player view of every model, regardless of the specific model type.

    Parameters

    • playerRole: PlayerRoleFlag

      The Role of the player that loadsand looks at this module.

    Returns TemplateResult<ResultType>

    The player view as Template Result. Might be empty if the player roles don't match.

Private initWidget

  • initWidget(): void
  • Set all sizes, position the marker and load the widget's background image.

    Returns void

labelBottomLeftInputChange

  • labelBottomLeftInputChange(e: Event): void
  • Sends the changed text of the slider bottom left label to the server.

    Parameters

    • e: Event

      A text input element.

    Returns void

labelBottomRightInputChange

  • labelBottomRightInputChange(e: Event): void
  • Sends the changed text of the slider bottom right label to the server.

    Parameters

    • e: Event

      A text input element.

    Returns void

labelTopLeftInputChange

  • labelTopLeftInputChange(e: Event): void
  • Sends the changed text of the slider top left label to the server.

    Parameters

    • e: Event

      A text input element.

    Returns void

labelTopRightInputChange

  • labelTopRightInputChange(e: Event): void
  • Sends the changed text of the slider top right label to the server.

    Parameters

    • e: Event

      A text input element.

    Returns void

Private ranged2relative

  • Normalize the ranged coordinates.

    Parameters

    • coord: Coordinate

      Ranged coordinate with x in [xrangeMin, xrangeMax] and y in [yrangeMin, yrangeMax].

    Returns Coordinate

    A Coordinate with x in [0,1] and y in [0,1].

Private sendCoord

  • Send the coordinates to the server.

    Parameters

    Returns void

Private setMarker

  • setMarker(x: number, y: number): void
  • Set the marker to a position.

    Parameters

    • x: number

      Absolute x value of the new position (on-screen value in px).

    • y: number

      Absolute y value of the new position (on-screen value in px).

    Returns void

Private setMarkerRanged

  • setMarkerRanged(x: number, y: number): void
  • Move the marker to a specific location within the ranged coordinates.

    Parameters

    • x: number

      Has to be within [this.xrangeMin, this.xrangeMax]

    • y: number

      Has to be within [this.yrangeMin, this.yrangeMax]

    Returns void

Private setTranslate

  • setTranslate(xPos: number, yPos: number, el: HTMLDivElement): void
  • General function to translate an HTML Element.

    Parameters

    • xPos: number

      Absolute x value of the new position (on-screen value in px).

    • yPos: number

      Absolute y value of the new position (on-screen value in px).

    • el: HTMLDivElement

      The element tha will be moved.

    Returns void

Generated using TypeDoc