fix angle bug
parent
9e71adac79
commit
cfb80a46ba
|
@ -423,7 +423,7 @@ const _vec2 = new THREE.Vector2()
|
||||||
let arr, i, j, centerScalar, r_cross_s, center, tagRadius
|
let arr, i, j, centerScalar, r_cross_s, center, tagRadius
|
||||||
let dA, tagtoMidline, shift, tA1, tA2, a1, deltaAngle;
|
let dA, tagtoMidline, shift, tA1, tA2, a1, deltaAngle;
|
||||||
|
|
||||||
function updateAngle(linegeom, pointgeom, _l1, _l2, offset) {
|
function updateAngle(line, point, _l1, _l2, offset) {
|
||||||
/*
|
/*
|
||||||
l2:[x0,y0,z0,x1,y1,z1]
|
l2:[x0,y0,z0,x1,y1,z1]
|
||||||
/
|
/
|
||||||
|
@ -442,6 +442,9 @@ function updateAngle(linegeom, pointgeom, _l1, _l2, offset) {
|
||||||
]
|
]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const linegeom = line.geometry.attributes.position
|
||||||
|
const pointgeom = point.geometry.attributes.position
|
||||||
|
|
||||||
for (i = 0; i < 4;) {
|
for (i = 0; i < 4;) {
|
||||||
arr = i == 0 ? _l1 : _l2
|
arr = i == 0 ? _l1 : _l2
|
||||||
vecArr[i++].set(arr[0], arr[1])
|
vecArr[i++].set(arr[0], arr[1])
|
||||||
|
|
|
@ -5,8 +5,7 @@ import { onDimMoveEnd } from './drawDimension'
|
||||||
let ptLoc
|
let ptLoc
|
||||||
|
|
||||||
export function onHover(e) {
|
export function onHover(e) {
|
||||||
// if (( this.mode && this.mode!='dimension') || e.buttons) return
|
if (( this.mode && this.mode!='dimension') || e.buttons) return
|
||||||
if (e.buttons) return
|
|
||||||
|
|
||||||
raycaster.setFromCamera(
|
raycaster.setFromCamera(
|
||||||
new THREE.Vector2(
|
new THREE.Vector2(
|
||||||
|
@ -32,7 +31,6 @@ export function onHover(e) {
|
||||||
let idx = []
|
let idx = []
|
||||||
if (hoverPts.length) {
|
if (hoverPts.length) {
|
||||||
|
|
||||||
// console.log(hoverPts)
|
|
||||||
let minDist = Infinity;
|
let minDist = Infinity;
|
||||||
for (let i = 0; i < hoverPts.length; i++) {
|
for (let i = 0; i < hoverPts.length; i++) {
|
||||||
if (!hoverPts[i].distanceToRay) continue;
|
if (!hoverPts[i].distanceToRay) continue;
|
||||||
|
@ -49,10 +47,6 @@ export function onHover(e) {
|
||||||
|
|
||||||
if (!idx.length) {
|
if (!idx.length) {
|
||||||
idx.push(0)
|
idx.push(0)
|
||||||
// if (idx.length >=2) {
|
|
||||||
// idx.push(1)
|
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -91,7 +85,6 @@ export function onHover(e) {
|
||||||
|
|
||||||
this.hovered.push(obj)
|
this.hovered.push(obj)
|
||||||
}
|
}
|
||||||
console.log(this.hovered)
|
|
||||||
|
|
||||||
// console.log('render1')
|
// console.log('render1')
|
||||||
this.obj3d.dispatchEvent({ type: 'change' })
|
this.obj3d.dispatchEvent({ type: 'change' })
|
||||||
|
|
|
@ -6,10 +6,8 @@ import { useDispatch, useSelector } from 'react-redux'
|
||||||
|
|
||||||
export const DropDown = () => {
|
export const DropDown = () => {
|
||||||
const arr = [
|
const arr = [
|
||||||
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
|
['https://raw.githubusercontent.com/twpride/threeCAD/master/demo_parts/test2.json', 'test2'],
|
||||||
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
|
['https://raw.githubusercontent.com/twpride/threeCAD/master/demo_parts/headphone-stand.json', 'headphone-stand'],
|
||||||
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
|
|
||||||
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
|
Loading…
Reference in New Issue