Skip to content

Commit a0e9678

Browse files
committed
fix error when raycasting against Line with buffer without geometry
1 parent 0b6f3b9 commit a0e9678

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/handle/src/handles/axis.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ import { handleXRayMaterialProperties } from './material.js'
44

55
const quaternionHelper = new Quaternion()
66

7+
const geometry = new BufferGeometry()
8+
geometry.setAttribute('position', new Float32BufferAttribute([-1e3, 0, 0, 1e3, 0, 0], 3))
9+
710
export class HandlesAxisHighlight extends LineSegments<BufferGeometry, LineBasicMaterial> {
811
constructor(
912
private readonly context: HandlesContext,
1013
private readonly rotationOffset: Euler,
1114
) {
12-
super()
15+
super(geometry)
1316
this.renderOrder = Infinity
1417
}
1518

@@ -24,9 +27,6 @@ export class HandlesAxisHighlight extends LineSegments<BufferGeometry, LineBasic
2427
}
2528

2629
bind(tag: string) {
27-
this.geometry = new BufferGeometry()
28-
this.geometry.setAttribute('position', new Float32BufferAttribute([-1e3, 0, 0, 1e3, 0, 0], 3))
29-
3030
this.material = new LineBasicMaterial({
3131
...handleXRayMaterialProperties,
3232
color: this.material.color ?? 'white',
@@ -50,7 +50,6 @@ export class HandlesAxisHighlight extends LineSegments<BufferGeometry, LineBasic
5050
}
5151
})
5252
return () => {
53-
this.geometry.dispose()
5453
this.material.dispose()
5554
unsubscribeHover()
5655
unsubscribeApply()

0 commit comments

Comments
 (0)