app/static/js/box.js
// highlights closest corner point that intersects with cursor
highlights closest corner point that intersects with cursor
highlights closest corner point that intersects with cursor
function highlightCorners() {
    var intersection = intersectWithCorner();
    if (intersection) {
            var box = intersection[0];
            var p = intersection[1];
            var closestIdx = closestPoint(p, box.geometry.vertices);
            if (hoverBox) {
                hoverBox.changePointColor(hoverIdx, hover_color.clone());
            }
            hoverBox = box;
            hoverIdx = closestIdx;
            hoverBox.changePointColor(hoverIdx, selected_color.clone());
    } else {
        if (hoverBox) {
            hoverBox.changePointColor(hoverIdx, hover_color.clone());
        }
        hoverBox = null;
    }
}
function highlightCorners ( ) { var intersection = intersectWithCorner ( ) ; if ( intersection ) { var box = intersection [ 0 ] ; var p = intersection [ 1 ] ; var closestIdx = closestPoint ( p , box . geometry . vertices ) ; if ( hoverBox ) { hoverBox . changePointColor ( hoverIdx , hover_color . clone ( ) ) ; } hoverBox = box ; hoverIdx = closestIdx ; hoverBox . changePointColor ( hoverIdx , selected_color . clone ( ) ) ; } else { if ( hoverBox ) { hoverBox . changePointColor ( hoverIdx , hover_color . clone ( ) ) ; } hoverBox = null ; } }
highlights closest corner point that intersects with cursor
highlights closest corner point that intersects with cursor
// get closest intersection with cursor // get closest point and its respective box // get index of closest point // if there was a previously hovered box, change its color back to red // hoverBox.changePointColor(hoverIdx, new THREE.Color(7, 0, 0)); // update hover box // hoverBox.changePointColor(hoverIdx, new THREE.Color(0, 0, 7)); // change color of previously hovered box back to red // hoverBox.changePointColor(hoverIdx, new THREE.Color(7, 0, 0)); // set hover box to null since there is no intersection