private static void HandleScrollWheel(SceneView view, bool zoomTowardsCenter)
        {
            if (Tools.s_LockedViewTool == ViewTool.FPS)
            {
                float scrollWheelDelta = Event.current.delta.y * s_FPSScrollWheelMultiplier;
                view.cameraSettings.speedNormalized -= scrollWheelDelta;
                float  cameraSettingsSpeed     = view.cameraSettings.speed;
                string cameraSpeedDisplayValue = cameraSettingsSpeed.ToString(
                    cameraSettingsSpeed < 0.0001f  ? "F6" :
                    cameraSettingsSpeed < 0.001f  ? "F5" :
                    cameraSettingsSpeed < 0.01f  ? "F4" :
                    cameraSettingsSpeed < 0.1f  ? "F3" :
                    cameraSettingsSpeed < 10f ? "F2" :
                    "F0");

                if (cameraSettingsSpeed < 0.1f)
                {
                    cameraSpeedDisplayValue = cameraSpeedDisplayValue.Trim(k_TrimChars);
                }

                GUIContent cameraSpeedContent = EditorGUIUtility.TempContent(string.Format("{0}{1}",
                                                                                           cameraSpeedDisplayValue,
                                                                                           view.cameraSettings.accelerationEnabled ? "x" : ""));

                view.ShowNotification(cameraSpeedContent, .5f);
            }
            else
            {
                float zoomDelta = Event.current.delta.y;
                float targetSize;

                if (!view.orthographic)
                {
                    float       relativeDelta  = Mathf.Abs(view.size) * zoomDelta * .015f;
                    const float k_MinZoomDelta = .0001f;
                    if (relativeDelta > 0 && relativeDelta < k_MinZoomDelta)
                    {
                        relativeDelta = k_MinZoomDelta;
                    }
                    else if (relativeDelta < 0 && relativeDelta > -k_MinZoomDelta)
                    {
                        relativeDelta = -k_MinZoomDelta;
                    }

                    targetSize = view.size + relativeDelta;
                }
                else
                {
                    targetSize = Mathf.Abs(view.size) * (zoomDelta * .015f + 1.0f);
                }

                var initialDistance = view.cameraDistance;

                if (!(float.IsNaN(targetSize) || float.IsInfinity(targetSize)))
                {
                    targetSize = Mathf.Min(SceneView.k_MaxSceneViewSize, targetSize);
                    view.size  = targetSize;
                }

                if (!zoomTowardsCenter && Mathf.Abs(view.cameraDistance) < 1.0e7f)
                {
                    var percentage = 1f - (view.cameraDistance / initialDistance);

                    var mouseRay    = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
                    var mousePivot  = mouseRay.origin + mouseRay.direction * initialDistance;
                    var pivotVector = mousePivot - view.pivot;

                    view.pivot += pivotVector * percentage;
                }
            }

            Event.current.Use();
        }
    static void OnScene(SceneView sceneView)
    {
        if (snazzy == null || snazzyGrid == null) {InitReferences();}
        key = Event.current;

        sceneCamera = Camera.current;
        //		if (sceneCamera != null)
        //			Handles.Label (sceneCamera.transform.position+(sceneCamera.transform.forward*1),new GUIContent(sceneCamera.transform.rotation.eulerAngles.ToString()));

        Key(key,true);

        controlID = GUIUtility.hotControl;

        // Debug.Log (controlID);

        if (snazzy.lookAtSelect) {
            if (Selection.activeTransform != null) {
                // Debug.Log ("dfd");
                if (controlID == 0) sceneView.pivot = Selection.activeTransform.position;
                if (key.type == EventType.MouseDown) {
                    if (Mathf.Abs (sceneCamera.transform.localEulerAngles.z) > 175 && Mathf.Abs (sceneCamera.transform.localEulerAngles.z) < 185)
                        rotationOld = new Vector2(-sceneCamera.transform.localEulerAngles.x-sceneCamera.transform.localEulerAngles.z,sceneCamera.transform.localEulerAngles.y+sceneCamera.transform.localEulerAngles.z);
                    else
                        rotationOld = new Vector2(sceneCamera.transform.localEulerAngles.x,sceneCamera.transform.localEulerAngles.y);
                }
                else if (key.button == 1) {
                    sceneCamera.transform.localEulerAngles = new Vector3(DeltaAngle(sceneCamera.transform.localEulerAngles.x),DeltaAngle (sceneCamera.transform.localEulerAngles.y),DeltaAngle (sceneCamera.transform.localEulerAngles.z));
                    rotationOld += new Vector2(key.delta.y/10,key.delta.x/10);
                    Quaternion rotation = Quaternion.Euler(rotationOld.x,rotationOld.y,0.0f);
                    Vector3 position = rotation * new Vector3(0,0,-2) + Selection.activeTransform.position;

                    sceneCamera.transform.rotation = rotation;
                    sceneCamera.transform.position = position;
                    // sceneView.Repaint ();
                }
            }
            if (key.button == 2) {
                snazzy.lookAtSelect = false;
                SnazzyWindowRepaint();
            }
        }

        // Display Scene Notification
        if (notify.Length > 0) {
            sceneView.ShowNotification(new GUIContent(notify));
            notify = "";
        }

        if (Selection.activeTransform != null) {
            snazzyGrid.transform.position = Selection.activeTransform.position;//gridOffset;
            if (Selection.activeTransform != snazzy.oldTransform) {
                snazzy.oldPosition = Selection.activeTransform.position;
            }
        }

        if (snazzy.lockChild) {
            if (Selection.activeTransform != snazzy.oldTransform) ParentChildren();
        }

        if (snazzy.showGrid) {
            if (!snazzy.gridIsEnabled) ShowGrid();
        }
        else {
            if (snazzy.gridIsEnabled) HideGrid();
        }
        if (Selection.transforms.Length == 0) {
            if (snazzy.gridIsEnabled) HideGrid();
        }

        if (snazzyGrid != null)	{
            if (snazzy.mov2) snazzyGridRenderer.sharedMaterial.SetFloat("_Scale", snazzy.gridIncrement2*snazzy.gridSize);
                else snazzyGridRenderer.sharedMaterial.SetFloat("_Scale", snazzy.gridIncrement*snazzy.gridSize);

            snazzyGrid.transform.localScale = new Vector3(snazzy.objectScale*snazzy.moveAmount,snazzy.objectScale*snazzy.moveAmount,snazzy.objectScale*snazzy.moveAmount);
            snazzyGridRenderer.sharedMaterial.SetFloat("_SnapAreaSize", snazzy.objectScale/(snazzy.objectScale*snazzy.snapAreaSize));
            snazzyGridRenderer.sharedMaterial.SetFloat("_ObjectScale", snazzy.objectScale*snazzy.moveAmount);
            snazzyGridRenderer.sharedMaterial.SetFloat("_GridSteps", snazzy.gridSize);
            Vector3 gridOffset2 = -(gridOffset/snazzy.gridSize)+new Vector3(snazzy.snapOffset,snazzy.snapOffset,snazzy.snapOffset);
            snazzyGridRenderer.sharedMaterial.SetVector("_SnapOffset",gridOffset2);
            snazzyGridRenderer.sharedMaterial.SetVector("_GridOffset",gridOffset2);

            if (Camera.current != null) {
                // Vector3 cameraForward = Camera.current.transform.forward;
                //snazzyGridRenderer.sharedMaterial.SetFloat("_X", cameraForward.x);
                //snazzyGridRenderer.sharedMaterial.SetFloat("_Y", cameraForward.y);
                //snazzyGridRenderer.sharedMaterial.SetFloat("_Z", cameraForward.z);
                snazzyGridRenderer.sharedMaterial.SetFloat("_Fresnel", snazzy.viewDependency);
            }
        }
    }