npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@yomguithereal/sigma-experiments-selection-tool

v1.0.3

Published

A rectangle selection tool for sigma v2.

Downloads

7

Readme

Sigma Rectangle Selection Tool Plugin

A straightforward rectangle selection tool plugin for sigma.js v2.

selection

Installation

npm install @yomguithereal/sigma-experiments-selection-tool

Note that this plugin has been written to work with sigma 2.0.0-alpha36.

You should probably freeze strictly this dependency in your package.json by dropping ^ or ~ to avoid automatic upgrades that could break your setup:

{
  "dependencies": {
    "sigma": "2.0.0-alpha36"
  }
}

Usage

import enhanceWithSelectionTool from '@yomguithereal/sigma-experiments-selection-tool';

// Using the plugin to enhance your renderer
const cleanupSelectionTool = enhanceWithSelectionTool(renderer, {
  borderStyle: '1px dashed gray'
});

// The `cleanupSelectionTool` function returned by the plugin is only useful
// if you need to get rid of the plugin's features for any reason.
// Note that this cleanup function will automatically be called when renderer
// is killed using the #.kill method to prevent memory leaks.

// Now you can listen to the `selectNodes` event
renderer.on('selectNodes', ({nodes}) => {
  console.log('Here are the selected nodes', nodes);
});

Arguments

  • renderer WebGLRenderer: a sigma.js v2 webgl renderer instance.
  • settings ?object: optional settings:
    • borderStyle ?string [1px dashed gray]: selection rectangle's border style.
    • debug ?boolean [false]: whether to log debug information in the console.
    • zIndex ?string|number [1000]: use this if you need to tweak the selection rectangle zIndex because your sigma container has a custom one.

UX

You can start a rectangle selection by shift-clicking the stage then dragging your mouse. An event containing selected nodes will be fired as soon as you release the mouse.

Examples

There are two examples of rectangle selection tool for you to browse to help you integrate the plugin:

  1. A basic example
  2. Another one using a "real" graph

To run them you need to clone the repo then:

npm i
npm run dev # for the basic example
npm run arctic # for the arctic graph one

Then browse to http://localhost:3000.