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

openseadragonselection-uptodate

v1.0.1

Published

An OpenSeadragon plugin to allow selecting part of the zoomable image and getting the corresponding coordinates.

Downloads

41

Readme

OpenSeadragonSelection

An OpenSeadragon plugin that provides functionality for selecting a rectangular part of an image.

Demo

https://picturae.github.io/openseadragonselection/

Usage

Include dist/openseadragonselection.js after OpenSeadragon in your html. Then after you create a viewer:

var selection = viewer.selection(options);

Then you can alter the selection state with any of these:

selection.enable();
selection.disable();
selection.toggleState();

Options

viewer.selection({
    element:                 null, // html element to use for overlay
    showSelectionControl:    true, // show button to toggle selection mode
    toggleButton:            null, // dom element to use as toggle button
    showConfirmDenyButtons:  true,
    styleConfirmDenyButtons: true,
    returnPixelCoordinates:  true,
    keyboardShortcut:        'c', // key to toggle selection mode
    rect:                    null, // initial selection as an OpenSeadragon.SelectionRect object
    allowRotation:           true, // turn selection rotation on or off as needed
    startRotated:            false, // alternative method for drawing the selection; useful for rotated crops
    startRotatedHeight:      0.1, // only used if startRotated=true; value is relative to image height
    restrictToImage:         false, // true = do not allow any part of the selection to be outside the image
    onSelection:             function(rect) {}, // callback
    prefixUrl:               null, // overwrites OpenSeadragon's option
    navImages:               { // overwrites OpenSeadragon's options
        selection: {
            REST:   'selection_rest.png',
            GROUP:  'selection_grouphover.png',
            HOVER:  'selection_hover.png',
            DOWN:   'selection_pressed.png'
        },
        selectionConfirm: {
            REST:   'selection_confirm_rest.png',
            GROUP:  'selection_confirm_grouphover.png',
            HOVER:  'selection_confirm_hover.png',
            DOWN:   'selection_confirm_pressed.png'
        },
        selectionCancel: {
            REST:   'selection_cancel_rest.png',
            GROUP:  'selection_cancel_grouphover.png',
            HOVER:  'selection_cancel_hover.png',
            DOWN:   'selection_cancel_pressed.png'
        },
    },
    borderStyle: { // overwriteable style defaults
        width:      '1px',
        color:      '#fff'
    },
    handleStyle: {
        top:        '50%',
        left:       '50%',
        width:      '6px',
        height:     '6px',
        margin:     '-4px 0 0 -4px',
        background: '#000',
        border:     '1px solid #ccc'
    },
    cornersStyle: {
        width:      '6px',
        height:     '6px',
        background: '#000',
        border:     '1px solid #ccc'
    }
});

To do

- fix behavior when the viewer itself is rotated
- test/fix with multiple images at once

Fixes

- Now selection can be draw over existing selections, make selection in selection.
To achieve that before you were forced to make a selection outside any other selection and move it over.