@Override
    public void mousePressed(MouseEvent e) {
        switch (global) {
            case EditMode:
                if (e.getButton() == MouseEvent.BUTTON1) {
                    switch (mode) {
                        case EditPoly:
                            //System.out.println("ASDASD");
                            if (selected != null) {
                                boolean near = false;
                                //double closest = 20000;
                                for (Point p : selected.points) {
                                    //if(Point.dist(new Point(e.getX(), e.getY()), p) < closest) {
                                    //    closest = Point.dist(new Point(e.getX(), e.getY()), p);
                                    //}
                                    if (Point.dist(new Point(e.getX(), e.getY()), p) < 10) {
                                        grabbed = p;
                                        selected.edit();
                                        selected.generatePoly();
                                        near = true;

                                    }
                                }

                                if (!near) {
                                    mode = Mode.Limbo;
                                    manager.deselect();
                                    manager.unhighlight();
                                }
                            }
                            break;

                        default:


                            break;
                    }
                }
                break;
        }
        //this.repaint();
    }