<commit_before>/**
 * @class Mouse control to orbit a scene's {@link SceneJS.Lookat}.
 * <p>Searches the given scene depth-first for a {@link SceneJS.Lookat} and inserts one at the root if not found.</p>
 * <p>Converts mouse events on the scene's canvas into orbit and zoom updates.</p>
 * @param {SceneJS.Scene} scene Scene graph to control
 * @param {*} options Control options
 * @constructor
 */
SceneJS.OrbitControls = function (scene, options) {

    options = options || {};

    var yaw = options.yaw || 0;
    var pitch = options.pitch || 0;
    var zoom = options.zoom || 10;
    var zoomSensitivity = options.zoomSensitivity || 1.0;

    var lastX;
    var lastY;
    var dragging = false;

    var lookatNode;

//    // Find lookat node
//    scene.eachNode(
//        function () {
//            if (this.get("type") == "lookAt") {
//                lookatNode = this;
//                return true;
//            }
//        }, {
//            depthFirst:true
//        });
//
//    // Insert lookat node if not found
//    if (!lookatNode) {
        lookatNode = scene.insertNode({
            type:"lookAt"
        });
    //}

    var eye = options.eye || { x:0, y:0, z:0 };
    var look = options.look || { x:0, y:0, z:0};

    lookatNode.set({
        eye:{ x:eye.x, y:eye.y, z:-zoom },
        look:{ x:look.x, y:look.y, z:look.z },
        up:{ x:0, y:1, z:0 }
    });

    update();

    var canvas = scene.getCanvas();

    canvas.addEventListener('mousedown', mouseDown, true);
    canvas.addEventListener('mousemove', mouseMove, true);
    canvas.addEventListener('mouseup', mouseUp, true);
    canvas.addEventListener('touchstart', touchStart, true);
    canvas.addEventListener('touchmove', touchMove, true);
    canvas.addEventListener('touchend', touchEnd, true);
    canvas.addEventListener('mousewheel', mouseWheel, true);
    canvas.addEventListener('DOMMouseScroll', mouseWheel, true);
<commit_msg>Camera orbit tweak<commit_after>/**
 * @class Mouse control to orbit a scene's {@link SceneJS.Lookat}.
 * <p>Searches the given scene depth-first for a {@link SceneJS.Lookat} and inserts one at the root if not found.</p>
 * <p>Converts mouse events on the scene's canvas into orbit and zoom updates.</p>
 * @param {SceneJS.Scene} scene Scene graph to control
 * @param {*} options Control options
 * @constructor
 */
SceneJS.OrbitControls = function (scene, options) {

    options = options || {};

    var yaw = options.yaw || 0;
    var pitch = options.pitch || 0;
    var zoom = options.zoom || 10;
    var zoomSensitivity = options.zoomSensitivity || 1.0;

    var lastX;
    var lastY;
    var dragging = false;

    var lookatNode;

    // Find lookat node
    scene.eachNode(
        function () {
            if (this.get("type") == "lookAt") {
                lookatNode = this;
                return true;
            }
        }, {
            depthFirst:true
        });

    // Insert lookat node if not found
    if (!lookatNode) {
        lookatNode = scene.insertNode({
            type:"lookAt"
        });
    }

    var eye = options.eye || { x:0, y:0, z:0 };
    var look = options.look || { x:0, y:0, z:0};

    lookatNode.set({
        eye:{ x:eye.x, y:eye.y, z:-zoom },
        look:{ x:look.x, y:look.y, z:look.z },
        up:{ x:0, y:1, z:0 }
    });

    update();

    var canvas = scene.getCanvas();

    canvas.addEventListener('mousedown', mouseDown, true);
    canvas.addEventListener('mousemove', mouseMove, true);
    canvas.addEventListener('mouseup', mouseUp, true);
    canvas.addEventListener('touchstart', touchStart, true);
    canvas.addEventListener('touchmove', touchMove, true);
    canvas.addEventListener('touchend', touchEnd, true);
    canvas.addEventListener('mousewheel', mouseWheel, true);
    canvas.addEventListener('DOMMouseScroll', mouseWheel, true);

{'fraction_non_alphanumeric': 0.1463922896587653, 'fraction_numerical': 0.007814535035165408, 'mean_word_length': 2.5522664199814984, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '647907', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1156, 'n_words': 322}