Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shopware-ag/dive

Package Overview
Dependencies
Maintainers
0
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopware-ag/dive - npm Package Compare versions

Comparing version 1.16.8 to 1.16.9

src/math/degToRad/__test__/degToRad.test.ts

10

build/dive.d.ts

@@ -394,2 +394,5 @@ import { ShadowMapType, ToneMapping, WebGLRenderer, Scene, Camera, PerspectiveCamera, Box3, Vector3Like, Texture, Object3D, Vector3, Color, Mesh, ColorRepresentation, Intersection, Vector2, Raycaster } from 'three';

SetToWorldOrigin(): void;
/**
* Can be called when the object is moved from a foreign object (gizmo, parent, etc.) to update the object's position.
*/
onMove(): void;

@@ -405,2 +408,3 @@ onSelect(): void;

constructor();
SetPosition(position: Vector3Like): void;
SetLinesVisibility(visible: boolean, object?: Object3D): void;

@@ -1010,2 +1014,6 @@ attach(object: DIVESceneObject): this;

declare function radToDeg(radians: number): number;
declare function degToRad(degrees: number): number;
declare const DIVEMath: {

@@ -1018,2 +1026,4 @@ ceilExp: typeof ceilExp;

signedAngleTo: typeof signedAngleTo;
radToDeg: typeof radToDeg;
degToRad: typeof degToRad;
};

@@ -1020,0 +1030,0 @@

2

package.json
{
"name": "@shopware-ag/dive",
"version": "1.16.8",
"version": "1.16.9",
"description": "Shopware Spatial Framework",

@@ -5,0 +5,0 @@ "type": "module",

@@ -0,2 +1,4 @@

import { type Vector3Like } from 'three';
import { DIVECommunication } from '../../com/Communication';
import { type DIVENode } from '../../node/Node';
import { DIVEGroup } from '../Group';

@@ -110,2 +112,97 @@

});
it('should call onMove on members with isDIVENode', () => {
// Create mock members
const diveNode1: DIVENode = {
isDIVENode: true,
onMove: jest.fn(),
} as unknown as DIVENode;
const diveNode2: DIVENode = {
isDIVENode: true,
onMove: jest.fn(),
} as unknown as DIVENode;
const member1: DIVENode = {
// Define other properties/methods if necessary
} as unknown as DIVENode;
const member2: DIVENode = {
// Define other properties/methods if necessary
} as unknown as DIVENode;
// Assign the _members array (assuming it's protected or public for testing)
// If _members is private, you might need to use a different approach or modify the class for testability
(group as any)._members = [
diveNode1,
member1,
diveNode2,
member2,
];
const position: Vector3Like = { x: 4, y: 5, z: 6 };
group.SetPosition(position);
// Check that onMove was called on diveNode1 and diveNode2
expect(diveNode1.onMove).toHaveBeenCalled();
expect(diveNode2.onMove).toHaveBeenCalled();
// Ensure onMove was not called on other members
// Since member1 and member2 don't have onMove, there's nothing to assert here
// If members have onMove, you should mock and verify they are not called
});
it('should not call onMove on members without isDIVENode', () => {
// Create mock members without isDIVENode
const member1: DIVENode = {
// Define other properties/methods if necessary
} as unknown as DIVENode;
const member2: DIVENode = {
// Define other properties/methods if necessary
} as unknown as DIVENode;
// Assign the _members array
(group as any)._members = [
member1,
member2,
];
const position: Vector3Like = { x: 7, y: 8, z: 9 };
group.SetPosition(position);
// Since members do not have onMove, there's nothing to assert
// If members have onMove as optional, you can spy on them to ensure they're not called
});
it('should handle an empty _members array without errors', () => {
// Assign an empty _members array
(group as any)._members = [];
const position: Vector3Like = { x: 10, y: 11, z: 12 };
expect(() => group.SetPosition(position)).not.toThrow();
});
it('should handle _members with mixed types correctly', () => {
// Create mixed members
const diveNode: DIVENode = {
isDIVENode: true,
onMove: jest.fn(),
} as unknown as DIVENode;
const member: DIVENode = {
// Define other properties/methods if necessary
} as unknown as DIVENode;
(group as any)._members = [
diveNode,
member,
];
const position: Vector3Like = { x: 13, y: 14, z: 15 };
group.SetPosition(position);
// Ensure onMove is called only on diveNode
expect(diveNode.onMove).toHaveBeenCalled();
});
});

@@ -1,2 +0,8 @@

import { BufferGeometry, Line, LineDashedMaterial, Vector3 } from 'three';
import {
BufferGeometry,
Line,
LineDashedMaterial,
Vector3,
Vector3Like,
} from 'three';
import { DIVENode } from '../node/Node';

@@ -23,2 +29,11 @@ import { type Object3D } from 'three';

public SetPosition(position: Vector3Like): void {
super.SetPosition(position);
this._members.forEach((member) => {
if ('isDIVENode' in member) {
(member as DIVENode).onMove();
}
});
}
public SetLinesVisibility(visible: boolean, object?: Object3D): void {

@@ -25,0 +40,0 @@ if (!object) {

@@ -7,2 +7,4 @@ import ceilExp from './ceil/ceilExp.ts';

import truncateExp from './truncate/truncateExp.ts';
import radToDeg from './radToDeg/radToDeg.ts';
import degToRad from './degToRad/degToRad.ts';

@@ -16,2 +18,4 @@ export const DIVEMath: {

signedAngleTo: typeof signedAngleTo;
radToDeg: typeof radToDeg;
degToRad: typeof degToRad;
} = {

@@ -24,2 +28,4 @@ ceilExp,

signedAngleTo,
radToDeg,
degToRad,
};

@@ -70,2 +70,5 @@ import { Box3, Object3D, Vector3, type Vector3Like } from 'three';

/**
* Can be called when the object is moved from a foreign object (gizmo, parent, etc.) to update the object's position.
*/
public onMove(): void {

@@ -72,0 +75,0 @@ DIVECommunication.get(this.userData.id)?.PerformAction(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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