Ignore:
Timestamp:
07/15/08 12:55:33 (16 years ago)
Author:
ra33
Message:

Fixed some repaint issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Dot.java

    r121 r143  
    2727        private static final int _MINIMUM_DOT_SIZE = 6;
    2828
     29        private static final int MINIMUM_DOT_SIZE = 2;
     30
    2931        private int _pointType = Item.POINTTYPE_SQUARE;
    3032
    3133        private boolean _filled = true;
    32        
     34
    3335        public Dot(int id) {
    3436                super();
     
    7476                updatePolygon();
    7577        }
    76        
     78
    7779        @Override
    7880        public void setColor(Color c) {
     
    9092                        g.setColor(highlightColor);
    9193                        g.setStroke(HIGHLIGHT_STROKE);
    92                         //g.setStroke()
     94                        // g.setStroke()
    9395                        // Draw the highlighting rectangle surrounding the dot
    9496                        // this is drawn even if its part of a rectangle
     
    103105                                g.fillOval(rect.x, rect.y, rect.width, rect.height);
    104106                        }
    105                         //System.out.println(_mode.toString());
     107                        // System.out.println(_mode.toString());
    106108                }
    107109
     
    113115
    114116                int thick = (int) getThickness();
    115                 if (thick < 2)
    116                         thick = 2;
     117                if (thick < MINIMUM_DOT_SIZE)
     118                        thick = MINIMUM_DOT_SIZE;
    117119
    118120                int width = thick / 2;
     
    192194                // if the item being merged with is another Dot
    193195                if (merger instanceof Dot) {
    194                         if(merger.hasEnclosures() || hasEnclosures())
     196                        if (merger.hasEnclosures() || hasEnclosures())
    195197                                return merger;
    196                        
     198
    197199                        Item dot = (Item) merger;
    198200                        merger.setPosition(this.getPosition());
     
    262264                return "P " + getID();
    263265        }
    264        
     266
    265267        @Override
    266268        public void delete() {
     
    270272                        l.delete();
    271273        }
    272        
     274
    273275        @Override
    274276        public void anchor() {
    275277                Frame current = getParentOrCurrentFrame();
    276                 //This is to make lines anchored across frames be on one frame
    277                 for(Line l: getLines()) {
     278                // This is to make lines anchored across frames be on one frame
     279                for (Line l : getLines()) {
    278280                        Frame parent = l.getOppositeEnd(this).getParent();
    279281                        if (parent != null && parent != current) {
    280282                                this.setParent(parent);
    281                                 if(DisplayIO.getCurrentSide() == 0)
     283                                if (DisplayIO.getCurrentSide() == 0)
    282284                                        this.setX(this.getX() - DisplayIO.getMiddle());
    283285                                else
     
    286288                        break;
    287289                }
    288                
     290
    289291                super.anchor();
    290                
    291                 //TODO is the code below needed... what for?
     292
     293                // TODO is the code below needed... what for?
    292294                for (Line line : getLines()) {
    293295                        if (line.getID() < 0 && !current.getItems().contains(line)) {
     
    295297                                line.setHighlightColor();
    296298                                // Mike: Why was this line here?
    297                                 //anchor(line);
    298                         }
    299                 }
    300         }
    301        
     299                                // anchor(line);
     300                        }
     301                }
     302        }
     303
    302304        @Override
    303305        public void addLine(Line line) {
     
    307309                line.setLinePattern(getLinePattern());
    308310        }
    309        
     311
    310312        @Override
    311313        public void lineColorChanged(Color c) {
     
    314316                }
    315317        }
     318
     319        @Override
     320        public boolean dontSave() {
     321                if (getThickness() <= 1 && (getLines().size() == 0)
     322                                && getConstraints().size() == 0) {
     323                        return true;
     324                }
     325                return super.dontSave();
     326        }
    316327}
Note: See TracChangeset for help on using the changeset viewer.