Fix three.js element selecting

This commit is contained in:
JannisX11 2025-03-05 17:23:09 +01:00
parent 7fbd13c6db
commit 3865b1389f
2 changed files with 5 additions and 6 deletions

View File

@ -114,8 +114,8 @@ export const Canvas = {
// Main Blockbench 3D scene
scene,
// Pivot marker
pivot_marker: rot_origin,
gizmos: [rot_origin],
pivot_marker: new THREE.Object3D(),
gizmos: [],
ground_animation: false,
outlineMaterial: new THREE.LineBasicMaterial({
linewidth: 2,
@ -1409,11 +1409,12 @@ export const Canvas = {
return visible_box;
}
}
var buildGrid = Canvas.buildGrid;
Canvas.gizmos.push(Canvas.pivot_marker);
Object.assign(window, {
getRescalingFactor,
Reusable,
SolidMaterialShaders,
Canvas,
buildGrid: Canvas.buildGrid
});

View File

@ -12,7 +12,6 @@ var framespersecond = 0;
var display_mode = false;
const canvas_scenes = {};
export const three_grid = new THREE.Object3D();
export const rot_origin = new THREE.Object3D();
export const gizmo_colors = {
r: new THREE.Color(),
g: new THREE.Color(),
@ -399,7 +398,7 @@ export class Preview {
}
})
}
let intersects = this.raycaster.intersectObjects( objects );
let intersects = this.raycaster.intersectObjects(objects, false);
if (intersects.length == 0) return false;
let depth_offset = Preview.selected.calculateControlScale(intersects[0].point);
@ -2488,7 +2487,6 @@ Object.assign(window, {
display_area,
display_base,
three_grid,
rot_origin,
gizmo_colors,
DefaultCameraPresets,
Preview,