function onViewportMouseClick()

in annotation_gui_gcp/js/CADView.js [348:398]


function onViewportMouseClick(event) {

    if (!event.ctrlKey && !event.altKey) {
        return
    }

    event.preventDefault();

    if (event.ctrlKey) {
        switch (event.button) {
            case 0: // left
                const pickposition = setPickPosition(event)
                _raycaster.setFromCamera(pickposition, camera);

                const intersections = _raycaster.intersectObject(_cad_model, true);
                const intersection = (intersections.length) > 0 ? intersections[0] : null;

                if (intersection !== null) {
                    const xyz = [intersection.point['x'], intersection.point['y'], intersection.point['z']];
                    add_or_update_point_observation(xyz);
                }
                break;
            case 1: // middle
                break;
            case 2: // right
                remove_point_observation();
                break;
        }
    }
    else { // Alt is pressed
        switch (event.button) {
            case 0: // left
                const pickposition = setPickPosition(event)
                _raycaster.setFromCamera(pickposition, camera);

                const intersections = _raycaster.intersectObject(_cad_model, true);
                const intersection = (intersections.length) > 0 ? intersections[0] : null;

                if (intersection !== null) {
                    point_camera_at_xyz(intersection.point);
                }
                break;
            case 1: // middle
                break;
            case 2: // right
                break;
        }

    }

}