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

@xuelangyun/3d-viewer

v1.2.1

Published

```tsx const viewer = new viewer(); ``` ### API <table border="1"> <tr> <th colspan="2">参数</th> <th>说明</th> <th>用法</th> </tr> <tr> <td colspan="2">Connect</td> <td>连接成功,服务端传来Connected的消息</td> <td> viewer.Con

Downloads

4

Readme

API

@xuelangyun/3d-viewer

viewer初始化

const viewer = new viewer();

API

Mouse / 鼠标操作

/**
  * @param {number} x - X坐标
  * @param {number} y - Y坐标
  * @param {MouseButtons} mouseButton - 鼠标按钮
  * @param {number} delta - 鼠标滚轮偏移值
*/
export declare enum MouseButtons {
  /**
    * 鼠标左键
  */
  Left = 0,
  /**
    * 鼠标右键
  */
  Right = 1,
  /**
  * 鼠标中键
  */
  Middle = 2
}

Assembly / 获取装配树

viewer.Assembly.Get((root:IAssemblyNode) => {
    //root:根节点
    console.log(root)
});

View / 获取视图

viewer.View.Get((data:{
        Views: string[];
        Size: string;
    }) => {
    //data:视图数据
    console.log(data)
});

viewer.View.Activate("前视图")

ActivedView / 激活视图

//设置缩放乘系数
Viewer.ActivedView.SetScaleRatio(1.1)
//设置缩放系数
Viewer.ActivedView.SetScale(10)
//获取缩放系数
Viewer.ActivedView.GetScale((data)=>{
    console.log(`当前缩放值为${data.Value}`)
})
//全局居中
Viewer.ActivedView.FitAll(0.1)
//居中指定对象
Viewer.ActivedView.FitCenter(["0-0-1"],0.1)

Exploding / 爆炸图

//开启三轴爆炸
Viewer.Exploding.SwicthAxis([true,true,true])
//设置爆炸进度
Viewer.Exploding.Value(0.6)

Selection / 选择

Measure / 测量

const firstIndex = 0; //第一个点的索引
const secondIndex = 1; //第二个点的索引
Viewer.Measure.PointToPoint(firstIndex,secondIndex,(data)=>{
  console.log(`点与点之间的距离为:${data.Value}`)
})
//恢复选择模式为Shape
Viewer.Selection.SetMode(ISelectionMode.Shape);

ClipPlane / 剖切视图

//显示剖切视图
Viewer.ClipPlane.Show();
//隐藏剖切试图
Viewer.ClipPlane.Hide();

📦 Install

npm install @xuelangyun/3d-viewer

🔨 Usage

import React, { useEffect, useRef, useState } from 'react';
import { INode, Viewer, ISelectionMode, IAssemblyNode } from '@xuelangyun/3d-viewer';

const App: React.FC = () => {
  const viewer = new Viewer();
  const width = 1024;
  const height = 720;
  viewer.Connect("ws://127.0.0.1:8081/",()=>{
      //连接成功,服务端传来Connected的消息
    });
  viewer.Open("D:/demo.qm",width,height,() => {
      //文件已打开
    }, (url) => {
      //服务端发来拉流地址
    let jsmpeg = new JSMpeg.Player(url, {
        canvas: canvas //需要绘制的画布
    });
  });
}