Installation
npm install --save @types/cytoscape-canvas
Summary
This package contains type definitions for cytoscape-canvas (https://github.com/classcraft/cytoscape.js-canvas).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cytoscape-canvas.
index.d.ts
import cytoscape = require("cytoscape");
declare const cyCanvas: cytoscape.Ext;
export = cyCanvas;
export as namespace cyCanvas;
declare namespace cyCanvas {
interface Options {
/**
* The z-index of the canvas.
*/
zIndex?: number;
/**
* The pixel ratio of the canvas.
*/
pixelRatio?: number;
}
interface CanvasInstance {
/**
* Return the generated canvas.
*/
getCanvas: () => HTMLCanvasElement;
/**
* Set the context transform to match Cytoscape's zoom & pan.
* Further drawing will be on model position.
* @param ctx The canvas context.
*/
setTransform: (ctx: CanvasRenderingContext2D) => void;
/**
* Reset the context transform.
* Further drawing will be on rendered position.
* @param ctx The canvas context.
*/
resetTransform: (ctx: CanvasRenderingContext2D) => void;
/**
* Clear the entire canvas.
* @param ctx The canvas context.
*/
clear: (ctx: CanvasRenderingContext2D) => void;
}
}
declare global {
namespace cytoscape {
interface Core {
/*
* Initialize the canvas according to the given options.
*/
cyCanvas: (options?: cyCanvas.Options) => cyCanvas.CanvasInstance;
}
}
}
Additional Details
- Last updated: Mon, 06 Nov 2023 22:41:05 GMT
- Dependencies: @types/cytoscape
Credits
These definitions were written by Musa.