
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
cytoscape-canvas
Advanced tools
An extension to create a canvas over or under a Cytoscape graph. Useful for customizing nodes/edges, drawing backgrounds, etc.
var cytoscape = require('cytoscape');
var cyCanvas = require('cytoscape-canvas');
cyCanvas(cytoscape); // Register extension
var cy = cytoscape({/* ... */});
var layer = cy.cyCanvas();
var canvas = layer.getCanvas();
var ctx = canvas.getContext('2d');
cy.on("render cyCanvas.resize", function(evt) {
layer.resetTransform(ctx);
layer.clear(ctx);
// Draw fixed elements
ctx.fillRect(0, 0, 100, 100); // Top left corner
layer.setTransform(ctx);
// Draw model elements
cy.nodes().forEach(function(node) {
var pos = node.position();
ctx.fillRect(pos.x, pos.y, 100, 100); // At node position
});
});
Download the library:
npm install cytoscape-canvas
,bower install cytoscape-canvas
, orrequire()
the library as appropriate for your project:
CommonJS:
var cytoscape = require('cytoscape');
var cyCanvas = require('cytoscape-canvas');
cyCanvas(cytoscape); // Register extension
AMD:
require(['cytoscape', 'cytoscape-canvas'], function(cytoscape, cyCanvas) {
cyCanvas(cytoscape); // Register extension
});
Plain HTML/JS has the extension registered for you automatically, because no require()
is needed.
var cy = cytoscape({/* ... */});
var layer = cy.cyCanvas({
zIndex: 1,
pixelRatio: "auto",
});
layer.getCanvas()
layer.setTransform(ctx)
Set the context transform to match Cystoscape's zoom & pan. Further drawing will be on model position.
layer.resetTransform(ctx)
Reset the context transform. Further drawing will be on rendered position.
layer.clear(ctx)
Clear the entire canvas.
cyCanvas.resize
: When the extension's canvas is resized
FAQs
A Cytoscape extension to enable drawing over and under a graph
The npm package cytoscape-canvas receives a total of 2,952 weekly downloads. As such, cytoscape-canvas popularity was classified as popular.
We found that cytoscape-canvas demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.