fix angle bug

master
howard 2021-04-21 04:46:55 -07:00
parent 9e71adac79
commit cfb80a46ba
3 changed files with 7 additions and 13 deletions

View File

@ -423,7 +423,7 @@ const _vec2 = new THREE.Vector2()
let arr, i, j, centerScalar, r_cross_s, center, tagRadius
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]
/
@ -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;) {
arr = i == 0 ? _l1 : _l2
vecArr[i++].set(arr[0], arr[1])

View File

@ -5,8 +5,7 @@ import { onDimMoveEnd } from './drawDimension'
let ptLoc
export function onHover(e) {
// if (( this.mode && this.mode!='dimension') || e.buttons) return
if (e.buttons) return
if (( this.mode && this.mode!='dimension') || e.buttons) return
raycaster.setFromCamera(
new THREE.Vector2(
@ -32,7 +31,6 @@ export function onHover(e) {
let idx = []
if (hoverPts.length) {
// console.log(hoverPts)
let minDist = Infinity;
for (let i = 0; i < hoverPts.length; i++) {
if (!hoverPts[i].distanceToRay) continue;
@ -49,10 +47,6 @@ export function onHover(e) {
if (!idx.length) {
idx.push(0)
// if (idx.length >=2) {
// idx.push(1)
// }
}
}
@ -91,7 +85,6 @@ export function onHover(e) {
this.hovered.push(obj)
}
console.log(this.hovered)
// console.log('render1')
this.obj3d.dispatchEvent({ type: 'change' })

View File

@ -6,10 +6,8 @@ import { useDispatch, useSelector } from 'react-redux'
export const DropDown = () => {
const arr = [
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_parts/test2.json', 'test2'],
['https://raw.githubusercontent.com/twpride/threeCAD/master/example_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/test2.json', 'test2'],
['https://raw.githubusercontent.com/twpride/threeCAD/master/demo_parts/headphone-stand.json', 'headphone-stand'],
]
const dispatch = useDispatch()