Ignore:
Timestamp:
05/08/08 14:30:09 (16 years ago)
Author:
ra33
Message:
 
File:
1 edited

Legend:

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

    r7 r21  
    33import java.awt.Graphics2D;
    44import java.awt.Polygon;
     5import java.awt.Rectangle;
    56import java.util.ArrayList;
    67import java.util.LinkedList;
    78import java.util.List;
     9
     10import org.expeditee.gui.Frame;
    811
    912/**
     
    1922        // Standard Item variables
    2023
     24        private static final int _MINIMUM_DOT_SIZE = 6;
     25
    2126        // contains all dots (including this one) that form an enclosure
    2227        // if this dot is part of an enclosing shape
     
    3237
    3338        private boolean _filled = true;
    34        
     39
    3540        protected boolean _filledHighlight = false;
    3641
     
    108113        @Override
    109114        public void paint(Graphics2D g) {
    110                 if (isHighlighted()) {
     115                if (isHighlighted() /* && !Frame.FreeItems.contains(this) */) {
    111116                        g.setColor(getHighlightColor());
    112117                        // Draw the highlighting rectangle surrounding the dot
    113118                        // this is drawn even if its part of a rectangle
    114                         if (_filledHighlight)
    115                                 g.fillPolygon(getPolygon());
    116                         else
    117                                 g.drawPolygon(getPolygon());
     119                        Rectangle rect = getPolygon().getBounds();
     120                        if (_mode == SelectedMode.Enclosed ||
     121                        // Make sure single dots are highlighted filled
     122                                        this.getConnected().size() <= 1)
     123                                g.fillRect(rect.x, rect.y, rect.width, rect.height);
     124                        else if (_mode == SelectedMode.Connected)
     125                                g.drawRect(rect.x, rect.y, rect.width, rect.height);
     126                        else if (_mode == SelectedMode.Normal) {
     127                                g.fillOval(rect.x, rect.y, rect.width, rect.height);
     128                        }
     129                        //System.out.println(_mode.toString());
    118130                }
    119131
     
    129141
    130142                int width = thick / 2;
    131 
    132                 // if(_thickness < 1)
    133                 /*
    134                  * if(_filled) g.fillRect(getX(), getY(), thick,thick); else
    135                  * g.drawRect(getX(), getY(), thick,thick); else
    136                  */
    137143
    138144                if (_pointType == Item.POINTTYPE_CIRCLE) {
     
    168174                int thick = (int) Math.ceil(getThickness());
    169175                // Sets a minimum size for the dot
    170                 thick = Math.max(thick, 10);
     176                thick = Math.max(thick, _MINIMUM_DOT_SIZE);
    171177
    172178                int x = getX() - thick / 2;
     
    205211
    206212        @Override
    207         public int showHighlight(boolean val) {
    208                 super.showHighlight(val);
     213        public int setSelectionColor() {
     214                super.setSelectionColor();
    209215
    210216                return Item.DEFAULT_CURSOR;
     
    353359                return "P " + getID();
    354360        }
    355        
     361
    356362        @Override
    357363        public void setFilledHighlight(boolean value) {
    358364                _filledHighlight = value;
    359365        }
    360        
     366
    361367        @Override
    362368        public void delete() {
    363369                super.delete();
    364                
    365                 for(Line l: this.getLines())
     370
     371                for (Line l : this.getLines())
    366372                        l.delete();
    367373        }
Note: See TracChangeset for help on using the changeset viewer.