Ignore:
Timestamp:
08/25/08 15:19:25 (16 years ago)
Author:
ra33
Message:

Fixed some bugs...
AbstractCharts can not be copied, resized, etc

File:
1 edited

Legend:

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

    r188 r278  
    1111import org.expeditee.gui.DisplayIO;
    1212import org.expeditee.gui.Frame;
     13import org.expeditee.gui.FrameGraphics;
    1314import org.expeditee.gui.FrameKeyboardActions;
    1415
     
    6263        }
    6364
    64         /**
    65          * Sets the 'thickness' of this Dot, that is, how many pixels this Dot
    66          * should be.
    67          *
    68          * @param thick
    69          *            The number of pixels to use when displaying this Dot The Dot
    70          *            is displayed as a thick x thick square.
    71          */
    72         @Override
    73         public void setThickness(float thick) {         
    74                 super.setThickness(thick);
    75 
    76                 updatePolygon();
    77         }
    78 
    7965        @Override
    8066        public void setColor(Color c) {
     
    8470                for (Line line : getLines())
    8571                        line.setColor(c);
     72        }
     73
     74        @Override
     75        public void setAnchorBottom(Float anchor) {
     76                if(!isLineEnd()){
     77                        super.setAnchorBottom(anchor);
     78                        return;
     79                }
     80                invalidateFill();
     81                invalidateCommonTrait(ItemAppearence.PreMoved);
     82                int oldY = getY();
     83                if (anchor != null) {
     84                        float deltaY = FrameGraphics.getMaxFrameSize().height - anchor
     85                                        - getBoundsHeight() - oldY;
     86                        //Check for a more efficient way to do this!!
     87                        //Invalidate all the items
     88                        for (Item i : this.getAllConnected()) {
     89                                i.invalidateAll();
     90                        }
     91                        //Move the items
     92                        for (Item i : this.getAllConnected()) {
     93                                if (i.isLineEnd()){
     94                                        i.setAnchorBottom(null);
     95                                        i.setXY(i.getX(), i.getY() + deltaY);
     96                                        i.updatePolygon();
     97                                        i.invalidateAll();
     98                                }
     99                        }
     100                        //Invalidate them again!!
     101                        for (Item i : this.getAllConnected()) {
     102                                i.invalidateAll();
     103                        }
     104                }
     105                this._anchorBottom = anchor;
     106                invalidateCommonTrait(ItemAppearence.PostMoved);
     107                invalidateFill();
     108        }
     109       
     110        @Override
     111        public void setAnchorRight(Float anchor) {
     112                if(!isLineEnd()){
     113                        super.setAnchorRight(anchor);
     114                        return;
     115                }
     116                invalidateFill();
     117                invalidateCommonTrait(ItemAppearence.PreMoved);
     118                int oldX = getX();
     119                if (anchor != null) {
     120                        float deltaX = FrameGraphics.getMaxFrameSize().width - anchor
     121                                        - getBoundsWidth() - oldX;
     122                        //Check for a more efficient way to do this!!
     123                        //Invalidate all the items
     124                        for (Item i : this.getAllConnected()) {
     125                                i.invalidateAll();
     126                        }
     127                        //Move the items
     128                        for (Item i : this.getAllConnected()) {
     129                                if (i.isLineEnd()){
     130                                        i.setAnchorRight(null);
     131                                        i.setXY(i.getX() + deltaX, i.getY());
     132                                        i.updatePolygon();
     133                                        i.invalidateAll();
     134                                }
     135                        }
     136                        //Invalidate them again!!
     137                        for (Item i : this.getAllConnected()) {
     138                                i.invalidateAll();
     139                        }
     140                }
     141                this._anchorRight = anchor;
     142                invalidateCommonTrait(ItemAppearence.PostMoved);
     143                invalidateFill();
    86144        }
    87145
Note: See TracChangeset for help on using the changeset viewer.