app/static/js/main.js
// controller for resizing, rotating, translating, or hovering boxes and points
controller for resizing, rotating, translating, or hovering boxes and points
controller for resizing rotating translating or hovering boxes and points
function onDocumentMouseMove( event ) {
    event.preventDefault();
    if (isRecording) {
        if (mouseDown == true) {
            if (move2D) {
                var cursor = get3DCoord();
                if (isRotating) {
                    rotatingBox.rotate(cursor);
                } else if (isResizing) {
                    cursor.y -= 0.00001;
                    resizeBox.resize(cursor);
                } else if (isMoving) {
                    selectedBox.translate(cursor);
                    selectedBox.changeBoundingBoxColor(selected_color.clone());
                } else {
                    if (newBox != null && !newBox.added) {
                        scene.add(newBox.points);
                        scene.add(newBox.boxHelper);
                        newBox.added = true;
                    }
                    newBox.resize(cursor);
                }
            }
            else if (mode3D) {
                if (isReHeighting) {
                    var mouse = get3DIntersectPlane();
                    console.log("mouse",mouse);
                    console.log("mouse_move temp anchor",temp_anchor[0]);
                    reheightBox.reheight(mouse, temp_anchor);
                }
            }
        }
        if (move2D) {
            var cursor = getCurrentPosition();
             if (!controls.enabled) {
                updateHoverBoxes(cursor);
                highlightCorners();
            }
        }
        else if (mode3D) {
            var intersect = get3DIntersect();
            if (!controls.enabled) {
                if (intersect.intersect != null) {
                    if (hoverBox != null && hoverIdx != null) {
                        hoverBox.changePointColor(hoverIdx, new THREE.Color(0xff0000));
                    }
                    hoverBox = boundingBoxes[intersect.idx];
                    hoverIdx = intersect.intersect.index;
                    hoverBox.changePointColor(hoverIdx, new THREE.Color(0x00ff33));
                } else {
                    if (hoverBox) {
                        hoverBox.changePointColor(hoverIdx, new THREE.Color(0xff0000));
                    }
                    hoverBox = null;
                }
            }
        }
    }
}
function onDocumentMouseMove ( event ) { event . preventDefault ( ) ; if ( isRecording ) { if ( mouseDown == true ) { if ( move2D ) { var cursor = get3DCoord ( ) ; if ( isRotating ) { rotatingBox . rotate ( cursor ) ; } else if ( isResizing ) { cursor . y -= 0.00001 ; resizeBox . resize ( cursor ) ; } else if ( isMoving ) { selectedBox . translate ( cursor ) ; selectedBox . changeBoundingBoxColor ( selected_color . clone ( ) ) ; } else { if ( newBox != null && ! newBox . added ) { scene . add ( newBox . points ) ; scene . add ( newBox . boxHelper ) ; newBox . added = true ; } newBox . resize ( cursor ) ; } } else if ( mode3D ) { if ( isReHeighting ) { var mouse = get3DIntersectPlane ( ) ; console . log ( "mouse" , mouse ) ; console . log ( "mouse_move temp anchor" , temp_anchor [ 0 ] ) ; reheightBox . reheight ( mouse , temp_anchor ) ; } } } if ( move2D ) { var cursor = getCurrentPosition ( ) ; if ( ! controls . enabled ) { updateHoverBoxes ( cursor ) ; highlightCorners ( ) ; } } else if ( mode3D ) { var intersect = get3DIntersect ( ) ; if ( ! controls . enabled ) { if ( intersect . intersect != null ) { if ( hoverBox != null && hoverIdx != null ) { hoverBox . changePointColor ( hoverIdx , new THREE . Color ( 0xff0000 ) ) ; } hoverBox = boundingBoxes [ intersect . idx ] ; hoverIdx = intersect . intersect . index ; hoverBox . changePointColor ( hoverIdx , new THREE . Color ( 0x00ff33 ) ) ; } else { if ( hoverBox ) { hoverBox . changePointColor ( hoverIdx , new THREE . Color ( 0xff0000 ) ) ; } hoverBox = null ; } } } } }
controller for resizing, rotating, translating, or hovering boxes and points
controller for resizing rotating translating or hovering boxes and points
// cursor's y coordinate nudged to make bounding box matrix invertible // selectedBox.changeBoundingBoxColor(new THREE.Color( 0,0,7 )); // if we are initoally drawing a new bounding box, // we would like to add it to the scene // highlights all hover boxes that intersect with cursor // highlights closest corner point that intersects with cursor // console.log(intersect); // intersect.idx is box index // point index: // hoverBox.changePointColor(hoverIdx, new THREE.Color(7, 0, 0));