Socket
Socket
Sign inDemoInstall

urdf-loader

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urdf-loader - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

30

example/dragAndDrop.js

@@ -89,20 +89,32 @@ /* globals animToggle viewer setColor */

// removes '..' and '.' tokens and normalizes slashes
const cleanFilePath = path => {
return path
.replace(/\\/g, '/')
.split(/\//g)
.reduce((acc, el) => {
if (el === '..') acc.pop();
else if (el !== '.') acc.push(el);
return acc;
}, [])
.join('/');
};
// set the loader url modifier to check the list
// of files
const fileNames = Object.keys(files);
const fileNames = Object.keys(files).map(n => cleanFilePath(n));
viewer.loadingManager.setURLModifier(url => {
url = url.replace(viewer.package, '');
url = url.replace(/^[.\\/]*/, '');
// find the matching file given the requested url
const cleaned = cleanFilePath(url.replace(viewer.package, ''));
const fileName = fileNames
.filter(name => {
// TODO: this doesn't work correctly when there are
// `../` up directory tokens in the path. They should
// be resolved.
// check if the end of file and url are the same
const len = Math.min(name.length, url.length);
return url.substr(url.length - len) === name.substr(name.length - len);
const len = Math.min(name.length, cleaned.length);
return cleaned.substr(cleaned.length - len) === name.substr(name.length - len);

@@ -109,0 +121,0 @@ }).pop();

{
"name": "urdf-loader",
"version": "0.3.2",
"version": "0.3.3",
"description": "URDF Loader for THREE.js and webcomponent viewer",

@@ -5,0 +5,0 @@ "scripts": {

@@ -144,3 +144,2 @@ /* globals URDFViewer THREE */

const temp = new THREE.Vector3();
const temp2 = new THREE.Vector3();
const intersect1 = new THREE.Vector3();

@@ -167,4 +166,3 @@ const intersect2 = new THREE.Vector3();

temp.set(0, 0, 0).applyMatrix4(tg.matrixWorld);
temp2.copy(plane.normal).multiplyScalar(-plane.distanceToPoint(temp));
temp.add(temp2);
temp.addScaledVector(plane.normal, -plane.distanceToPoint(temp));

@@ -194,4 +192,3 @@ // Project out from the camera

temp.set(0, 0, 0).applyMatrix4(tg.matrixWorld);
temp2.copy(plane.normal).multiplyScalar(-plane.distanceToPoint(temp));
temp.add(temp2);
temp.addScaledVector(plane.normal, -plane.distanceToPoint(temp));

@@ -253,7 +250,7 @@ // project onto the plane of rotation

dragging = findNearestJoint(target.object);
clickPoint.copy(target.point);
this.dispatchEvent(new CustomEvent('manipulate-start', { bubbles: true, cancelable: true, detail: dragging.urdf.name }));
if (dragging) {
clickPoint.copy(target.point);
this.dispatchEvent(new CustomEvent('manipulate-start', { bubbles: true, cancelable: true, detail: dragging.urdf.name }));
this.controls.enabled = false;

@@ -378,2 +375,2 @@

}
};

@@ -133,2 +133,5 @@ /* globals THREE URDFLoader */

// redraw when something new has loaded
this.loadingManager.onLoad = () => this._dirty = true;
const _renderLoop = () => {

@@ -135,0 +138,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc