Class CvsViewer

This control is used to scroll and zoom on an image.

When the mouse moves over the control scrollbars will appear (if needed) inside the bottom and right-hand-side edges of the view. When the mouse is near the centre a slider will appear which can be used to change the scale.

THis control also supports layers where multiple images can be layered to make the final visual.

Hierarchy

Properties

action: Function = ...

The event handler for this control. Although it is permitted to set this property directly it is recommended that the setAction(...) method is used to define the event handler actions.

Methods

  • Add a child to this control using its relative position [rx, ry]. If rx and ry are not provided then it uses the values set in the child.

    Returns

    this control

    Parameters

    • c: string | CvsBaseControl

      is the actual control or its name

    • Optional rx: number
    • Optional ry: number

    Returns any

  • Set or get the corner radii used for this control

    Returns

    an array with the 4 corner radii

    Parameters

    • c: number[]

      an array of 4 corner radii

    Returns number[] | CvsBaseControl

  • Calculates the absolute position on the canvas taking into account any ancestors

    Returns

    the actual position in the canvas

    Returns __Position

  • Make a layer invisible

    Returns

    this control

    Parameters

    • n: number

      the layer number ≥0

    Returns CvsViewer

  • Use enable() and disable() to enable and disable it.

    Returns

    true if the control is enabled else false

    Returns boolean

  • Returns

    true if this control is visible

    Since

    0.9.3

    Returns boolean

  • Sets the image(s) to be displayed in this viewer

    Returns

    this control

    Parameters

    • img: any

      an image or array of images

    Returns CvsViewer

  • Returns

    the unique identier for this control

    Returns string

  • Adds this control to another control which becomes its parent

    Returns

    this control

    Parameters

    • p: string | CvsBaseControl

      is the parental control or its name

    • Optional rx: number

      x position relative to parent

    • Optional ry: number

      y position relative to parent

    Returns CvsBaseControl

  • Sets or gets the scale and or scale limits

    If no parameters are passed the the current scale is returned. A single parameter sets the current scale and three parameter sets the current scale and the limits for the zoom slider.

    Returns

    this control or the current scale

    Parameters

    • v: number

      the scale to use

    Returns number | CvsViewer

  • Sets the existing scaler value (if there is no scaler it will be created) and limits. The initial value will be constrained to the limits.

    Returns

    this control

    Parameters

    • v: number

      the scale to use

    • l0: number

      the lowest scale allowed

    • l1: number

      the highest scale allowed

    Returns CvsViewer

  • This sets the event handler to be used when this control fires an event. The parameter can take three forms:

    1. Arrow function definition
    2. Anonymous function definition
    3. Named function declaration

    Returns

    this control

    Parameters

    • event_handler: Function

      the function to handle this controls event

    Returns CvsViewer

  • Make a layer visible

    Returns

    this control

    Parameters

    • n: number

      the layer number ≥0

    Returns CvsViewer

  • The current status is an object with 3 fields { cX, cY, scale } where -

    • cX, cY is the position in the image that correseponds to the view center and
    • scale is the current scale used to display the image.

    Returns

    the current status

    Returns { cX: number; cY: number; scale: number }

    • cX: number
    • cY: number
    • scale: number
  • Sets the size of the text to use in the tooltip

    Parameters

    • Optional tsize: number

      text size for this tooltip

    Returns CvsViewer

  • Create a tooltip for this control

    Returns

    this control

    Parameters

    • tiptext: string

      the text to appear in the tooltip

    • duration: number

      how long the tip remains visible (milliseconds)

    Returns CvsViewer

  • Sets the view of the image to be displayed. If you enter values outside the image or ar scale value outside scaler limts they will be constrained to legal action on the viewer to report back changes to the view centre and/or scale attributes.

    Parameters

    • wcx: number
    • wcy: number
    • Optional wscale: number

    Returns CvsViewer

Generated using TypeDoc