Ignore:
Timestamp:
07/02/08 12:38:54 (16 years ago)
Author:
ra33
Message:

added functionality for dockable @v's

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/Vector.java

    r105 r115  
    44import java.awt.Point;
    55
    6 public class Vector {
    7         public Frame Frame;
     6import org.expeditee.items.Permission;
     7
     8public class Vector extends Overlay {
    89
    910        public Point Origin;
    10        
     11
    1112        public float Scale;
    1213
    1314        public Color Foreground;
     15
    1416        public Color Background;
    1517
    16         public Vector(Frame overlay, Point origin, Float scale, Color color, Color background) {
    17                 Frame = overlay;
     18        public Vector(Frame overlay, Permission permission, Point origin,
     19                        Float scale, Color color, Color background) {
     20                super(overlay, permission);
    1821                Origin = origin;
    1922                Scale = scale;
     
    2629                if (o == null || o.getClass() != Vector.class)
    2730                        return false;
     31                Vector v = (Vector) o;
    2832
    29                 return ((Vector) o).Frame == Frame;
     33                return v.Frame == Frame && Origin.equals(v.Origin)
     34                                && Scale == v.Scale && Foreground == v.Foreground
     35                                && Background == v.Background;
    3036        }
    3137
     
    3440                return 0;
    3541        }
     42
     43        /**
     44         * Converts the given x position to be relative to the overlay frame.
     45         *
     46         * @param x
     47         * @return
     48         */
     49        public float getX(int x) {
     50                return (x - Origin.x) / Scale;
     51        }
     52
     53        public float getY(int y) {
     54                return (y - Origin.y) / Scale;
     55        }
    3656}
Note: See TracChangeset for help on using the changeset viewer.