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

react-viewer360

v0.1.8

Published

<p align="center" width="100%"> <img width="75%" src="https://github.com/ccau1/react-viewer360/blob/master/example/sample1.gif"> </p>

Downloads

11

Readme

React-Viewer360

This is a 360 viewer library inspired by google map's navigation. Using points for each 360 image, the 360 images are placed in a 3D world using XYZ coordinates and the POV travels to each position in transition.

Why

  • Transitions to other 360 images as though flying to it
  • Each 360 image can hold their own markers
  • Each marker can customize sprite, content (with html support) and line from marker to a position (can be used to illustrate pointing to an item)

Installation

npm install react-viewer360 # or yarn add react-viewer360

Usage

Display one 360 image

import Viewer360 from "react-viewer360";

export const App = () => {
  return (
    <Viewer360
      img="./360_1.jpg"
    />
  )
}

Display one 360 image with markers

import Viewer360 from "react-viewer360";
import "react-viewer360/dist/viewer360.css";

export const App = () => {
  return (
    <Viewer360
      img="./360_1.jpg"
      markers={[
        {
          point: [2, 0, 3],
          content: (
            <div>
              An apple product
              <a href="www.apple.com">Apple Store</a>
            </div>
          )
        }
      ]}
    />
  )
}

Display multiple 360 images with markers

import Viewer360 from "react-viewer360";
import "react-viewer360/dist/viewer360.css";

export const App = () => {
  return (
    <Viewer360
      positions={[
        {
          point: { x: 0, y: 0, z: 0 },
          img: "./360_1.jpg",
          label: "Bedroom",
          markers: [
            {
              point: [2, 0, 3],
              content: (
                <div>
                  An apple product
                  <a href="www.apple.com">Apple Store</a>
                </div>
              )
            }
          ]
        },
        {
          point: [1, 0, 0],
          img: './360_2.jpg',
          label: 'Living Room',
          sprite: './sprite_1.png',
        },
        {
          point: [3, 0, 3],
          img: './360_3.jpg',
          label: 'Kitchen',
        },
      ]}
    />
  )
}

Options

| Prop | Type | Default | Description | | ---------------------- | ------------------- | ------- | ------------------------------------------------------------------------------------ | | positions | Viewer360Position[] | [] | Positions of each 360, along with each 360's settings such as its markers and sprite | | img | string | | A 360 image. Use this if only displaying one image ever | | markers | Marker[] | [] | A list of markers for the singular img (only applies to img prop) | | dragSpeed | number | 1 | The speed when mouse drag screen (ev.movementX * dragSpeed) | | autoRotate | boolean | false | Flag for whether screen will auto rotate | | autoRotateSpeed | number | 1 | If autoRotate true, the speed it'll move per frame | | initialCameraRotation | View360Point | | The initial camera rotation (using XYZ) on first load | | pointMarkerSprite | string | | A marker image to indicate next travel point | | markerSprite | string | | A marker image indicating a marker position | | pointMarkerSpriteScale | number | 0.2 | Scale the point marker image | | markerSpriteScale | number | 0.15 | Scale the marker image | | styles | Viewer360Styles | {} | Styles for each part of the dom layer | | hideLabels | boolean | false | Hide all labels (both markers and points) | | enableZoom | boolean | true | Enable zoom in/out on scroll |

Ref Functions

zoomDelta(delta: number)

change zoom by delta

goToIndex: (positionIndex: number, duration?: number)

go to position by index

startDrawing()

start drawing loop

stopDrawing()

stop drawing loop

dragDelta(delta: Position2D, speed?: number)

drag the 3D world through 2D screen

Structures

Viewer360Position

point: View360Point;
img: string;
label?: string | React.ReactNode;
markers?: Marker[];
sprite?: string;
spriteScale?: number;

Marker

point: View360Point;
content: string | React.ReactNode;
lineTo?: View360Point;
sprite?: string;
spriteScale?: string;

View360Point

{ x: number; y: number; z: number } | [ number, number, number ]

Viewer360Styles

container?: React.CSSProperties;
pointMarkerLabel?: React.CSSProperties;
pointMarkerLabelHover?: React.CSSProperties;
pointMarkerLabelContent?: React.CSSProperties;
markerLabel?: React.CSSProperties;
markerLabelHover?: React.CSSProperties;
markerLabelContent?: React.CSSProperties;

Styling

Classes to override | ClassName | Position | | --------- | -------- | | .viewer_360_marker_label | Marker's label container| | .viewer_360_marker_label_content | Marker's label content | | .viewer_360_marker_label_hover | Marker's label hover area | | .viewer_360_point_marker_label | Position's label container | | .viewer_360_point_marker_label_content | Position's label content | | .viewer_360_point_marker_label_hover | Position's label hover area |

TODO


  • [x] Define sprite scales
  • [x] Add js styling
  • [ ] Define customized transitions