Example #1
0
        public void update()
        {
            if (dirty)
            {
                dirty = false;
                UpdateVisibleSelection();

                handledselectionchange = brushes.onselectionchanged(input, manager.ActiveMatrix, lasthit);

                if (handledselectionchange)
                {
                    needscleaning = true;
                }
            }

            if (!handledselectionchange && raycaster.HasHit)
            {
                handledselectionchange = brushes.onselectionchanged(input, manager.ActiveMatrix, lasthit);
                if (handledselectionchange)
                {
                    needscleaning = true;
                }
            }

            if (needscleaning)
            {
                if (input.mouseup(MouseButton.Left))
                {
                    // change this...  have the tool decide to clean or not
                    needscleaning = false;
                    manager.ActiveMatrix.Clean();
                }
            }
        }
Example #2
0
        public Selection(GLWindow window, BrushManager tools, Input input, QbManager manager, Floor floor, GUI gui)
            : base()
        {
            this.brushes = tools;
            this.input   = input;
            this.manager = manager;
            this.floor   = floor;
            this.gui     = gui;

            window.Resize += (e, a) =>
            {
                statusStrip = null;
            };

            color = new Colort(1, 0, 0);

            buffer = new float[16];


            input.AddHandler(new InputHandler()
            {
                mousedownhandler = (e) =>
                {
                    if (Singleton <GUI> .INSTANCE.OverWidget)
                    {
                        return;
                    }

                    if (e.Button == MouseButton.Left && !dirty && handledselectionchange && Singleton <Raycaster> .INSTANCE.HasHit)
                    {
                        handledselectionchange = brushes.onselectionchanged(input, manager.ActiveMatrix, lasthit, e);

                        if (handledselectionchange)
                        {
                            needscleaning = true;
                        }
                    }
                },
                mouseuphandler = (e) =>
                {
                    if (e.Button == MouseButton.Left && !dirty && handledselectionchange)
                    {
                        handledselectionchange = brushes.onselectionchanged(input, manager.ActiveMatrix, lasthit, e);

                        if (handledselectionchange)
                        {
                            needscleaning = true;
                        }
                    }
                }
            });
        }