Пример #1
0
        internal override bool Seize(Event currentEvent, ref Vector3 position, ref string message)
        {
            if (menu.Active)
            {
                menu.OnGui(currentEvent);
                DrawActiveAnimatedTexture(menu.Point2DPosition);

                var okMessage = menu.ActiveItem != null && menu.ActiveItem.Description != null
                    ? "Release Ctrl to " + menu.ActiveItem.Description
                    : "Hover over an option and release Ctrl.";

                //out params
                position = menu.Point3DPosition;
                message  = BGSceneViewOverlay.ToOk(okMessage) + "\r\n" + menu.Details;
                //============== Ok
                return(true);
            }

            if (!(currentEvent.type == EventType.Repaint && currentEvent.control || currentEvent.type == EventType.MouseMove && currentEvent.control))
            {
                return(false);
            }

            if (Process(currentEvent, overlay.Editor.Editor.Math, BGEditorUtility.GetSceneViewHeight(), ref position, ref message))
            {
                return(true);
            }

            pointIndicatorTransition = null;

            //============== No luck
            return(false);
        }
        private void UpdatePoints(Rect rect)
        {
            var sceneViewHeight = BGEditorUtility.GetSceneViewHeight();

            var math = editor.Math;

            curve.ForEach((point, index, count) =>
            {
                //add or remove from selection
                if (rect.Contains(BGEditorUtility.GetSceneViewPosition(math.GetPosition(index), sceneViewHeight)))
                {
                    selection.Add(point);
                }
                else
                {
                    selection.Remove(point);
                }
            });

            if (!selection.Changed)
            {
                return;
            }

            selection.Reset();
        }