Changeset 121 for trunk/src/org/expeditee/items/ItemUtils.java
- Timestamp:
- 07/03/08 16:48:09 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/ItemUtils.java
r115 r121 2 2 3 3 import java.awt.Color; 4 import java.awt.Rectangle; 4 5 import java.awt.image.ImageObserver; 5 6 import java.io.File; … … 17 18 import org.expeditee.gui.DisplayIO; 18 19 import org.expeditee.gui.Frame; 20 import org.expeditee.gui.FreeItems; 19 21 import org.expeditee.gui.Vector; 20 22 import org.expeditee.items.Item.HighlightMode; 23 21 24 22 25 //Static methods that provide functions for the objects\ … … 847 850 } 848 851 852 /** 853 * Determines if an item is visible from a the current frame(s). 854 * If the item is free then it is considered visible. 855 * @param i The item to check 856 * @return True if visible/free from given frame. 857 */ 858 public static boolean isVisible(Item i) { 859 if (DisplayIO.isTwinFramesOn()) { 860 if (!isVisible(DisplayIO.getFrames()[0], i)) { 861 return isVisible(DisplayIO.getFrames()[1], i); 862 } else { 863 return true; 864 } 865 } else { 866 return isVisible(DisplayIO.getCurrentFrame(), i); 867 } 868 } 869 870 /** 871 * Determines if an item is visible from a given frame. 872 * If the item is free then it is considered visible. 873 * 874 * @param fromFrame The frame to check from. 875 * @param i The item to check 876 * @return True if visible/free from given frame. 877 */ 878 public static boolean isVisible(Frame fromFrame, Item i) { 879 if (fromFrame == null) return false; 880 881 Frame parent = i.getParent(); 882 883 if (parent == fromFrame) return true; 884 885 else if (parent == null) return FreeItems.getInstance().contains(i); 886 887 return fromFrame.getAllItems().contains(i) && i.isVisible(); 888 } 889 890 public static Rectangle expandRectangle(Rectangle r, int n) { 891 return new Rectangle(r.x - (n >> 1), r.y - (n >> 1), 892 r.width + n, r.height + n); 893 } 894 849 895 /* 850 896 * FrameMouseActions while (!copies.isEmpty()) { Iterator<Item> iterator =
Note:
See TracChangeset
for help on using the changeset viewer.