interface CoreViewportManipulation {
    autolock(): boolean;
    autolock(bool?: boolean): this;
    autoungrabify(): boolean;
    autoungrabify(bool?: boolean): this;
    autounselectify(): boolean;
    autounselectify(bool?: boolean): this;
    boxSelectionEnabled(): boolean;
    boxSelectionEnabled(bool?: boolean): this;
    center(eles?: CollectionArgument): this;
    centre(eles?: CollectionArgument): this;
    container(): null | HTMLElement;
    extent(): {
        h: number;
        w: number;
        x1: number;
        x2: number;
        y1: number;
        y2: number;
    };
    fit(eles?: CollectionArgument, padding?: number): this;
    forceRender(): this;
    height(): number;
    invalidateDimensions(): this;
    maxZoom(): number;
    maxZoom(zoom: number): this;
    minZoom(): number;
    minZoom(zoom: number): this;
    pan(): Position;
    pan(renderedPosition?: Position): this;
    panBy(renderedPosition: Position): this;
    panningEnabled(): boolean;
    panningEnabled(bool?: boolean): this;
    reset(): this;
    resize(): this;
    selectionType(): SelectionType;
    selectionType(type: SelectionType): this;
    userPanningEnabled(): boolean;
    userPanningEnabled(bool?: boolean): this;
    userZoomingEnabled(): boolean;
    userZoomingEnabled(bool?: boolean): this;
    viewport(options: {
        pan: Position;
        zoom: number;
    }): this;
    width(): number;
    zoom(): number;
    zoom(level?: ZoomOptions): this;
    zoomingEnabled(bool?: boolean): this;
}

Hierarchy (view full)

Methods

  • Get the extent of the viewport, a bounding box in model coordinates that lets you know what model positions are visible in the viewport. http://js.cytoscape.org/#cy.extent

    Returns {
        h: number;
        w: number;
        x1: number;
        x2: number;
        y1: number;
        y2: number;
    }

    • h: number
    • w: number
    • x1: number
    • x2: number
    • y1: number
    • y2: number
  • Force the renderer to recalculate the viewport bounds.

    If your code resizes the graph's dimensions or position (i.e. by changing the style of the HTML DOM element that holds the graph), you will want to call cy.resize() to have the graph resize and redraw itself.

    Cytoscape.js can not automatically monitor the bounding box of the viewport, as querying the DOM for those dimensions can be expensive. Although cy.resize() is automatically called for you on the window's resize event, there is no resize or style event for arbitrary DOM elements. http://js.cytoscape.org/#cy.resize

    Returns this