Logo Search packages:      
Sourcecode: javamorph version File versions  Download package

void javamorph::CPolygonDecorator::mouseClicked ( MouseEvent  e  )  [inline]

Due to Java API. Perform polygon point operation depending on edit state.

Definition at line 403 of file CPolygonDecorator.java.

References javamorph::CFrame::getParent(), index, parent, polygon, and pos.

                                          {
        if(MouseEvent.BUTTON1 == e.getButton()){
            switch(CConfig.edit_state){
                /* Add one point. */
                case CConfig.EDIT_POLYGON_ADD:
                    int i = (index + 1) % polygon.size();
                    polygon.insertElementAt(new Point(pos.x, pos.y), i);
                    break;
                /* Delete one point if there are enough remaining points. */
                case CConfig.EDIT_POLYGON_SUB:
                    if(polygon.size() > 3){
                        polygon.remove(index);
                    }
                    break;
            }
        }
        parent.getParent().repaint();
    }


Generated by  Doxygen 1.6.0   Back to index