Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Camera

Hierarchy

Index

Constructors

constructor

  • new Camera(root: any): Camera

Methods

addScreenShake

  • addScreenShake(amount: any): void
  • Parameters

    • amount: any

    Returns void

bindArrowKeys

  • bindArrowKeys(): void
  • Binds the arrow keys

    Returns void

canZoomIn

  • canZoomIn(): boolean
  • Returns if we can further zoom in

    Returns boolean

canZoomOut

  • canZoomOut(): boolean
  • Returns if we can further zoom out

    Returns boolean

cancelAllInteractions

  • cancelAllInteractions(): void
  • Cancels all interactions, that is user interaction and non user interaction

    Returns void

centerOnBase

  • centerOnBase(): void
  • Centers the view on the base

    Returns void

checkPreventDoubleMouse

  • checkPreventDoubleMouse(): boolean
  • Checks if the mouse event is too close after a touch event and thus should get ignored

    Returns boolean

clampToBounds

  • clampToBounds(): void
  • Clamps the camera viewport to the bounds

    Returns void

clampZoomLevel

  • clampZoomLevel(): void
  • Clamps the camera zoom level within the allowed range

    Returns void

cleanup

  • cleanup(): void
  • Cleans up all event listeners

    Returns void

clearAnimations

  • clearAnimations(): void
  • Clears all animations

    Returns void

combinedSingleTouchMoveHandler

  • combinedSingleTouchMoveHandler(x: any, y: any): boolean
  • Internal touch move handler

    Parameters

    • x: any
    • y: any

    Returns boolean

combinedSingleTouchStartHandler

  • combinedSingleTouchStartHandler(x: any, y: any): void
  • Internal touch start handler

    Parameters

    • x: any
    • y: any

    Returns void

combinedSingleTouchStopHandler

  • combinedSingleTouchStopHandler(x: any, y: any): void
  • Internal touch stop handler

    Parameters

    • x: any
    • y: any

    Returns void

deserialize

  • deserialize(data: any): any

drawOverlays

  • drawOverlays(context: any): void
  • Draws debug overlays

    Parameters

    • context: any

    Returns void

findInitialZoom

  • findInitialZoom(): number
  • Finds a good initial zoom level

    Returns number

getViewportBottom

  • getViewportBottom(): any
  • Returns effective world space viewport bottom

    Returns any

getViewportHeight

  • getViewportHeight(): number
  • Returns effective viewport height

    Returns number

getViewportLeft

  • getViewportLeft(): number
  • Returns effective world space viewport left

    Returns number

getViewportRight

  • getViewportRight(): any
  • Returns effective world space viewport right

    Returns any

getViewportTop

  • getViewportTop(): number
  • Returns effective world space viewport top

    Returns number

getViewportWidth

  • getViewportWidth(): number
  • Returns effective viewport width

    Returns number

getVisibleRect

  • Returns the visible world space rect

    Returns Rectangle

internalInitEvents

  • internalInitEvents(): void
  • Attaches all event listeners

    Returns void

internalUpdateCentering

  • internalUpdateCentering(now: any, dt: any): void
  • Updates the non user interaction centering

    Parameters

    • now: any

      Time now in seconds

    • dt: any

      Delta time

    Returns void

internalUpdateKeyboardForce

  • internalUpdateKeyboardForce(now: any, dt: any): void
  • Updates the keyboard forces

    Parameters

    • now: any
    • dt: any

      Delta time

    Returns void

internalUpdatePanning

  • internalUpdatePanning(now: any, dt: any): void
  • Internal pan handler

    Parameters

    • now: any

      Time now in seconds

    • dt: any

      Delta time

    Returns void

internalUpdateShake

  • internalUpdateShake(now: any, dt: any): void
  • Internal shake handler

    Parameters

    • now: any

      Time now in seconds

    • dt: any

      Delta time

    Returns void

internalUpdateZooming

  • internalUpdateZooming(now: any, dt: any): void
  • Updates the non user interaction zooming

    Parameters

    • now: any

      Time now in seconds

    • dt: any

      Delta time

    Returns void

isCurrentlyInteracting

  • isCurrentlyInteracting(): any
  • Returns if the user is currently interacting with the camera

    Returns any

    true if the user interacts

isCurrentlyMovingToDesiredCenter

  • isCurrentlyMovingToDesiredCenter(): boolean
  • Returns if this camera is currently moving by a non-user interaction

    Returns boolean

isWorldPointOnScreen

  • isWorldPointOnScreen(point: any): boolean
  • Returns if a point is on screen

    Parameters

    • point: any

    Returns boolean

    true if its on screen

onMouseDown

  • onMouseDown(event: any): boolean
  • Mousedown handler

    Parameters

    • event: any

    Returns boolean

onMouseMove

  • onMouseMove(event: any): boolean
  • Mousemove handler

    Parameters

    • event: any

    Returns boolean

onMouseUp

  • onMouseUp(event: any): boolean
  • Mouseup handler

    Parameters

    • event: any

    Returns boolean

onMouseWheel

  • onMouseWheel(event: any): boolean
  • Mousewheel event

    Parameters

    • event: any

    Returns boolean

onTouchEnd

  • onTouchEnd(event: any): boolean
  • Touch end and cancel handler

    Parameters

    • event: any

    Returns boolean

onTouchMove

  • onTouchMove(event: any): boolean
  • Touch move handler

    Parameters

    • event: any

    Returns boolean

onTouchStart

  • onTouchStart(event: any): boolean
  • Touch start handler

    Parameters

    • event: any

    Returns boolean

screenToWorld

  • screenToWorld(screen: any): any
  • Converts from screen to world space

    Parameters

    • screen: any

    Returns any

    world space

serialize

  • serialize(): object

setDesiredCenter

  • setDesiredCenter(center: any): void
  • Sets a point in world space to focus on

    Parameters

    • center: any

    Returns void

setPan

  • setPan(pan: any): void
  • Sets the camera pan, every frame the camera will move by this amount

    Parameters

    • pan: any

    Returns void

transform

  • transform(context: any): void
  • Prepares a context to transform it

    Parameters

    • context: any

    Returns void

update

  • update(dt: any): void
  • Updates the camera

    Parameters

    • dt: any

      Delta time in milliseconds

    Returns void

viewportWillChange

  • viewportWillChange(): any
  • Returns if in the next frame the viewport will change

    Returns any

    true if it willchange

worldToScreen

  • worldToScreen(world: any): any
  • Converts from world to screen space

    Parameters

    • world: any

    Returns any

    screen space

Static getCachedSchema

  • getCachedSchema(): any

Static getId

  • getId(): string

Static getSchema

  • getSchema(): object

Static verify

  • verify(data: any): string