test
parent
bdf1871b44
commit
79ccc4f83c
|
@ -39,7 +39,7 @@ var TrackballControls = function ( object, domElement ) {
|
|||
|
||||
this.keys = [ 65 /*A*/, 83 /*S*/, 68 /*D*/ ];
|
||||
|
||||
this.mouseButtons = { LEFT: null, MIDDLE: MOUSE.ROTATE, RIGHT: MOUSE.PAN };
|
||||
this.mouseButtons = { LEFT: null, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.ROTATE };
|
||||
|
||||
// internals
|
||||
|
||||
|
@ -506,7 +506,11 @@ var TrackballControls = function ( object, domElement ) {
|
|||
break;
|
||||
|
||||
case 2:
|
||||
_state = scope.mouseButtons.RIGHT;
|
||||
if (event.ctrlKey) {
|
||||
_state = scope.mouseButtons.MIDDLE;
|
||||
} else {
|
||||
_state = scope.mouseButtons.RIGHT;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
18
src/Scene.js
18
src/Scene.js
|
@ -215,7 +215,7 @@ export class Scene {
|
|||
}
|
||||
|
||||
|
||||
subtract(m1, m2, op) {
|
||||
boolOp(m1, m2, op) {
|
||||
let bspA = CSG.fromMesh(m1)
|
||||
let bspB = CSG.fromMesh(m2)
|
||||
m1.visible = false
|
||||
|
@ -223,7 +223,6 @@ export class Scene {
|
|||
m1.traverse(e => e.layers.disable(1))
|
||||
m2.traverse(e => e.layers.disable(1))
|
||||
|
||||
// // Subtract one bsp from the other via .subtract... other supported modes are .union and .intersect
|
||||
|
||||
let bspResult, opChar;
|
||||
switch (op) {
|
||||
|
@ -243,24 +242,18 @@ export class Scene {
|
|||
break;
|
||||
}
|
||||
|
||||
// //Get the resulting mesh from the result bsp, and assign meshA.material to the resulting mesh
|
||||
|
||||
let mesh = CSG.toMesh(bspResult, m1.matrix, m1.material)
|
||||
mesh.userData.type = 'mesh'
|
||||
|
||||
mesh.name = `(${m1.name}${opChar}${m2.name})`
|
||||
mesh.layers.enable(1)
|
||||
|
||||
|
||||
|
||||
const vertices = new THREE.Points(mesh.geometry, new THREE.PointsMaterial({ size: 0 }));
|
||||
vertices.userData.type = 'point'
|
||||
vertices.layers.enable(1)
|
||||
|
||||
// mesh.add(line)
|
||||
mesh.add(vertices)
|
||||
|
||||
|
||||
sc.obj3d.add(mesh)
|
||||
|
||||
this.store.dispatch({
|
||||
|
@ -313,19 +306,10 @@ function render() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.stats.end();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async function addSketch() {
|
||||
|
||||
let sketch;
|
||||
|
|
|
@ -114,6 +114,7 @@ export function onHover(e) {
|
|||
|
||||
let draggedLabel;
|
||||
export function onPick(e) {
|
||||
console.log(e)
|
||||
if (this.mode || e.buttons != 1) return
|
||||
|
||||
if (this.hovered.length) {
|
||||
|
@ -151,9 +152,13 @@ export function onPick(e) {
|
|||
obj
|
||||
)
|
||||
this.setHover(obj, 1)
|
||||
|
||||
} else {
|
||||
|
||||
this.setHover(this.selected[idx], 0)
|
||||
|
||||
this.selected.splice(idx, 1)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,6 +209,13 @@ export function onPick(e) {
|
|||
if (obj.userData.type == 'selpoint') {
|
||||
obj.visible = false
|
||||
}
|
||||
|
||||
// dont think this would have been possible without redux
|
||||
if (obj.userData.type == 'sketch' && !sc.store.getState().treeEntries.visible[obj.name]) {
|
||||
obj.visible = false
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
this.obj3d.dispatchEvent({ type: 'change' })
|
||||
this.selected = []
|
||||
|
|
|
@ -19,7 +19,7 @@ export const NavBar = () => {
|
|||
const boolOp = (code) => {
|
||||
if (sc.selected.length != 2 || !sc.selected.every(e => e.userData.type == 'mesh')) return
|
||||
const [m1, m2] = sc.selected
|
||||
const mesh = sc.subtract(m1, m2, code)
|
||||
const mesh = sc.boolOp(m1, m2, code)
|
||||
dispatch({ type: 'rx-boolean', mesh, deps: [m1.name, m2.name] })
|
||||
sc.render()
|
||||
forceUpdate()
|
||||
|
|
|
@ -29,12 +29,10 @@ const TreeEntry = ({ entId }) => {
|
|||
const treeEntries = useSelector(state => state.treeEntries.byId)
|
||||
const dispatch = useDispatch()
|
||||
|
||||
|
||||
const visible = useSelector(state => state.treeEntries.visible[entId])
|
||||
|
||||
let obj3d, sketch;
|
||||
|
||||
|
||||
if (treeEntries[entId].obj3d) {
|
||||
obj3d = treeEntries[entId].obj3d
|
||||
sketch = treeEntries[entId]
|
||||
|
@ -44,10 +42,9 @@ const TreeEntry = ({ entId }) => {
|
|||
let Icon = treeIcons[obj3d.userData.type]
|
||||
|
||||
const [_, forceUpdate] = useReducer(x => x + 1, 0);
|
||||
|
||||
const [mouseOn, setMouseOn] = useState(false)
|
||||
|
||||
return <div className='btn select-none flex justify-start w-full h-7 items-center text-sm'
|
||||
|
||||
onDoubleClick={() => {
|
||||
if (obj3d.userData.type == 'sketch') {
|
||||
sc.activeSketch && sc.activeSketch.deactivate()
|
||||
|
@ -60,35 +57,43 @@ const TreeEntry = ({ entId }) => {
|
|||
}}
|
||||
|
||||
onPointerEnter={() => {
|
||||
if (mouseOn) return
|
||||
setMouseOn(true)
|
||||
|
||||
if (obj3d.userData.type == 'sketch') {
|
||||
obj3d.visible = true
|
||||
}
|
||||
|
||||
sc.setHover(obj3d, 1)
|
||||
sc.render()
|
||||
}}
|
||||
onPointerLeave={() => {
|
||||
// if (visible & obj3d.userData.type == 'sketch') return
|
||||
if (sc.selected.includes(obj3d) || sc.activeSketch && sc.activeSketch.name == obj3d.name) return
|
||||
if (!mouseOn) return
|
||||
setMouseOn(false)
|
||||
|
||||
if (obj3d.userData.type == 'sketch'
|
||||
&& !sc.selected.includes(obj3d)
|
||||
&& !visible
|
||||
) {
|
||||
obj3d.visible = false
|
||||
}
|
||||
|
||||
if (sc.selected.includes(obj3d)) return
|
||||
|
||||
sc.setHover(obj3d, 0)
|
||||
|
||||
sc.render()
|
||||
}}
|
||||
onClick={() => {
|
||||
// if (obj3d.userData.type == 'mesh') {
|
||||
// console.log(obj3d, sc.selected)
|
||||
const idx = sc.selected.indexOf(obj3d)
|
||||
|
||||
if (idx == -1) {
|
||||
sc.selected.push(
|
||||
obj3d
|
||||
)
|
||||
sc.selected.push(obj3d)
|
||||
sc.setHover(obj3d, 1)
|
||||
} else {
|
||||
sc.setHover(sc.selected[idx], 0)
|
||||
sc.selected.splice(idx, 1)
|
||||
}
|
||||
|
||||
// sc.selected.push(
|
||||
// obj3d
|
||||
// )
|
||||
|
||||
// }
|
||||
sc.render()
|
||||
}}
|
||||
>
|
||||
|
|
27
todo.txt
27
todo.txt
|
@ -23,6 +23,8 @@ horizontal // done
|
|||
constraint angle // done
|
||||
|
||||
button panel cleanup // done
|
||||
3 pt arc // done
|
||||
tangent // done to the best of my ability
|
||||
|
||||
|
||||
-unable to delete arc
|
||||
|
@ -30,6 +32,8 @@ hover not clearing sometimes
|
|||
dim tags are not clearing
|
||||
should unselect after boolean
|
||||
|
||||
|
||||
|
||||
auto update extrude
|
||||
extrude dialogue
|
||||
loopfind especially arc
|
||||
|
@ -37,13 +41,28 @@ file save, stl export
|
|||
|
||||
|
||||
|
||||
|
||||
better default ent names
|
||||
|
||||
|
||||
reattach sketch
|
||||
3 pt arc // done
|
||||
|
||||
auto snap
|
||||
constraint labels,tangent, equal
|
||||
constraint labels,equal
|
||||
parallel
|
||||
tree ent renaming
|
||||
tree ent renaming
|
||||
|
||||
|
||||
|
||||
|
||||
set pieces
|
||||
|
||||
hover state for sketch
|
||||
await selection
|
||||
3 point arc implementation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue