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

@lumiscaphe/ng-viewer

v17.0.0

Published

Official Angular component for Lumiscaphe 3D Viewer

Downloads

123

Readme

ng-viewer

Official Angular component for Lumiscaphe 3D Viewer

Installation

$ npm i @lumiscaphe/ng-viewer

or

$ yarn add @lumiscaphe/ng-viewer

Usage

Import

import { NgViewerModule } from '@lumiscaphe/ng-viewer';

Basic

<NgViewer [server]="server" [scene]="scene" [view]="view"></NgViewer>
server = 'https://wr.lumiscaphe.com';

scene = [
  {
    database: 'ee294840-5689-49b0-9edb-527598602df0',
    configuration: 'Bin.Blue/Cabin.Yellow/Style.Design1/Wheels.Red'
  }
];

view = {
  mode: 'image',
  camera: 'EXTER/1'
};

Hotspot

Hotspots are interactive elements that can be selected to engage in additional content or media.
Hotspots are overlaid on top of the viewer to provide additional media for informational purposes.

<NgViewer ... [hotspots]="hotspots">
  <ng-template #hotspotTemplate let-hotspot let-index="index">
    <ng-container *ngIf="hotspot.visibility === 'Visible'">
      <button>{{ index + 1 }}</button>
    </ng-container>
  </ng-template>
</NgViewer>
hotspots = [{ x: 0, y: 0, z: 0 }];

Pick

Pick allow to retrieve information of a 3D point from a 2D point.

<NgViewer ...></NgViewer>

<button type="button" (click)="pick()">Pick</button>
import { NgViewerComponent } from '@lumiscaphe/ng-viewer';

...

@ViewChild(NgViewerComponent) viewer: NgViewerComponent;
@ViewChild(ngViewerComponent, { read: ElementRef }) viewerElement: ElementRef<HTMLDivElement>;

...

pick(): void {
  this.viewerElement.nativeElement.addEventListener('click', e => {
    const position = { x: e.clientX, y: e.clientY };
    this.viewer.pick(position).then(pickResult => console.log(pickResult))
  }, { once: true });
};

API

Properties

| Name | Type | Default | Description | | -------------- | ------------ | ------------------------------------------- | -------------------------------- | | server | string | undefined | WebRender URL to use. | | scene | Scene | undefined | Scene to render. | | view | View | undefined | View to render. | | api | 'v1'\|'v2' | 'v1' | API version to use. | | encoder | Encoder | { format: 'jpeg', quality: 80 } | Image encoder to use. | | parameters | Parameters | { antialiasing: false, superSampling: 2 } | Rendering parameters to use. | | hotspots | Vector3D[] | undefined | Hotspot array to display. | | vrcube | VRCube | undefined | VRCube point of view to display. | | vrobject | VRObject | undefined | VRObject position to display. |

Emitters

| Name | Parameters | Description | | ------------------------- | -------------------- | ------------------------------------------------------ | | onLoadStart | progress: number | Callback to invoke when load starts. | | onLoadProgress | progress: number | Callback to invoke when load makes progress. | | onLoadEnd | progress: number | Callback to invoke when load ends. | | onLoadError | Error | Callback to invoke when load failed. | | onInteraction | VRCube \| VRObject | Callback to invoke when interaction happened. | | onVrcubeInteraction | VRCube | Callback to invoke when VRCube interaction happened. | | onVrobjectInteraction | VRObject | Callback to invoke when VRObject interaction happened. |

Methods

| Name | Parameters | Description | Returns | | ------------ | --------------------------------- | ------------------------------------ | -------------------- | | pick | position: Position | Get the 3D point from a 2D position. | PickResult | | snapshot | type: string, quality: number | Get a snapshot of the viewer. | string - Image URL |

Templates

| Name | Parameters | Description | | ------------------- | ------------------------------------------------ | ------------------------ | | hotspotTemplate | context: { $implicit: Hotspot, index: number } | Custom hotspot template. |

Interfaces

Scene

| Name | Type | Description | | ----------------- | ---------- | -------------------------------------- | | database | string | Database id of the 3D model. | | configuration | string | Product configuration of the 3D model. | | animations | string[] | Animations of the 3D model |

View

| Name | Type | Description | | ---------- | ------------------------------- | ---------------------------------------- | | mode | 'image'\|'vrcube'\|'vrobject' | Mode of the view. | | camera | string | Camera or camera group name of the view. |

Encoder

| Name | Type | Description | | ----------- | -------- | --------------------------------- | | format | 'jpeg' | Format of the encoder. | | quality | number | Quality of the encoder (0 - 100). |

Parameters

| Name | Type | Description | | ----------------- | ------ | ---------------------------------------------- | | superSampling | number | Super sampling to use for antialiasing (1 -2). |

Hotspot

| Name | Type | Description | | ------------ | ----------- | --------------------------------------------------------------- | | id | string | Id of the hotspot (when hotspot is provided by the 3D model). | | name | string | Name of the hotspot (when hotspot is provided by the 3D model). | | position2D | Vector2D | 2D position of the hotspot in the viewer. | | position3D | Vector3D | 3D position of the hotspot. | | visibility | Visiblity | Visiblity of the hotspot. |

Visibility

| Name | Description | | -------------- | ---------------------------------------------- | | Visible | Hotspot found and visible. | | Occluded | Hotspot found but occluded by another surface. | | OutOfFrustum | Hotspot not found. |

PickResult

| Name | Type | Description | | ----------- | ---------- | --------------------------------------- | | product | string | Product id of the picked point. | | surface | Surface | Surface of the picked point. | | normal | Vector3D | Normal coordinates of the picked point. | | point | Vector3D | Point coordinates of the picked point. | | uvw | UVW | UV coordinates of the picked point. |

Surface

| Name | Type | Description | | -------- | ---------- | ------------------------ | | id | string | Id of the surface. | | name | string | Name of the surface. | | tags | string[] | Tag list of the surface. |

UVW

| Name | Type | Description | | ----- | -------- | ------------- | | u | number | U coordinate. | | v | number | V coordinate. | | w | number | W coordinate. |

Vector2D

| Name | Type | Description | | ----- | -------- | ------------- | | x | number | X coordinate. | | y | number | Y coordinate. |

Vector3D

| Name | Type | Description | | ----- | -------- | ------------- | | x | number | X coordinate. | | y | number | Y coordinate. | | z | number | Z coordinate. |

VRCube

| Name | Type | Description | | ---- | ------------- | ---------------------------------------------- | | pov | PointOfView | Point of view of the VRCube widget. | | fov | number | Field of view in degrees of the VRCube widget. |

VRObject

| Name | Type | Description | | ---------- | -------- | ---------------------------------- | | position | number | Image inde of the VRObject widget. |