Changeset 812
- Timestamp:
- 02/03/14 13:46:41 (10 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Misc.java
r805 r812 1227 1227 } 1228 1228 else { 1229 int new_x = i.getX(); 1230 int new_y = i.getY(); 1231 1232 if (!i.isAnchoredX()) { 1233 new_x += x; 1234 } 1235 1236 if (!i.isAnchoredY()) { 1237 new_y += y; 1238 } 1239 1240 1241 1242 if ((new_x != x) || (new_y != y)) { 1229 int new_x = i.getX(); 1230 int new_y = i.getY(); 1231 1232 if (!i.isAnchoredX()) { 1233 new_x += x; 1234 } 1235 1236 if (!i.isAnchoredY()) { 1237 new_y += y; 1238 } 1243 1239 1244 1240 if(i instanceof XRayable) { 1245 1246 i.setPosition(new_x,new_y); 1241 i.setPosition(new_x,new_y); 1247 1242 } 1248 1249 1243 else { 1250 1244 i.setXY(new_x,new_y); 1251 1245 } 1252 }1253 1246 } 1254 1247 // update the polygon, otherwise stuff moves but leaves it's outline behind … … 1258 1251 for (InteractiveWidget iw : frame.getInteractiveWidgets()) { 1259 1252 1260 int new_x = iw.getX(); 1261 int new_y = iw.getY(); 1262 1263 if (!iw.isAnchoredX()) { 1264 new_x += x; 1265 } 1266 1267 if (!iw.isAnchoredY()) { 1268 new_y += y; 1269 } 1270 1271 1272 if ((new_x != x) || (new_y != y)) { 1273 1253 int new_x = iw.getX(); 1254 int new_y = iw.getY(); 1255 1256 if (!iw.isAnchoredX()) { 1257 new_x += x; 1258 } 1259 1260 if (!iw.isAnchoredY()) { 1261 new_y += y; 1262 } 1263 1274 1264 iw.setPosition(new_x,new_y); 1275 }1265 1276 1266 } 1277 1267 -
trunk/src/org/expeditee/items/Dot.java
r720 r812 61 61 62 62 @Override 63 public void setAnchorLeft(Float anchor) { 64 if (!isLineEnd()) { 65 super.setAnchorLeft(anchor); 66 return; 67 } 68 69 invalidateFill(); 70 invalidateCommonTrait(ItemAppearence.PreMoved); 71 72 this._anchorLeft = anchor; 73 this._anchorRight = null; 74 75 int oldX = getX(); 76 if (anchor != null) { 77 float deltaX = anchor - oldX; 78 anchorConnected(AnchorEdgeType.Left, deltaX); 79 } 80 81 invalidateCommonTrait(ItemAppearence.PostMoved); 82 invalidateFill(); 83 } 84 85 @Override 86 public void setAnchorRight(Float anchor) { 87 if (!isLineEnd()) { 88 super.setAnchorRight(anchor); 89 return; 90 } 91 invalidateFill(); 92 invalidateCommonTrait(ItemAppearence.PreMoved); 93 94 this._anchorRight = anchor; 95 this._anchorLeft = null; 96 97 int oldX = getX(); 98 if (anchor != null) { 99 float deltaX = FrameGraphics.getMaxFrameSize().width - anchor 100 - getBoundsWidth() - oldX; 101 102 anchorConnected(AnchorEdgeType.Right, deltaX); 103 } 104 105 invalidateCommonTrait(ItemAppearence.PostMoved); 106 invalidateFill(); 107 } 108 109 @Override 63 110 public void setAnchorTop(Float anchor) { 64 111 if (!isLineEnd()) { … … 68 115 invalidateFill(); 69 116 invalidateCommonTrait(ItemAppearence.PreMoved); 117 118 this._anchorTop = anchor; 119 this._anchorBottom = null; 120 70 121 int oldY = getY(); 71 122 if (anchor != null) { … … 73 124 anchorConnected(AnchorEdgeType.Top, deltaY); 74 125 } 75 this._anchorTop = anchor; 76 this._anchorBottom = null; 126 77 127 invalidateCommonTrait(ItemAppearence.PostMoved); 78 128 invalidateFill(); … … 87 137 invalidateFill(); 88 138 invalidateCommonTrait(ItemAppearence.PreMoved); 139 140 this._anchorBottom = anchor; 141 this._anchorTop = null; 142 89 143 int oldY = getY(); 90 144 if (anchor != null) { … … 93 147 anchorConnected(AnchorEdgeType.Bottom, deltaY); 94 148 } 95 this._anchorBottom = anchor; 96 this._anchorTop = null; 149 97 150 invalidateCommonTrait(ItemAppearence.PostMoved); 98 151 invalidateFill(); … … 100 153 101 154 102 @Override103 public void setAnchorLeft(Float anchor) {104 if (!isLineEnd()) {105 super.setAnchorLeft(anchor);106 return;107 }108 invalidateFill();109 invalidateCommonTrait(ItemAppearence.PreMoved);110 int oldX = getX();111 if (anchor != null) {112 float deltaX = anchor - oldX;113 114 anchorConnected(AnchorEdgeType.Left, deltaX);115 }116 this._anchorLeft = anchor;117 this._anchorRight = null;118 119 invalidateCommonTrait(ItemAppearence.PostMoved);120 invalidateFill();121 }122 123 @Override124 public void setAnchorRight(Float anchor) {125 if (!isLineEnd()) {126 super.setAnchorRight(anchor);127 return;128 }129 invalidateFill();130 invalidateCommonTrait(ItemAppearence.PreMoved);131 int oldX = getX();132 if (anchor != null) {133 float deltaX = FrameGraphics.getMaxFrameSize().width - anchor134 - getBoundsWidth() - oldX;135 136 anchorConnected(AnchorEdgeType.Right, deltaX);137 }138 this._anchorRight = anchor;139 this._anchorLeft = null;140 invalidateCommonTrait(ItemAppearence.PostMoved);141 invalidateFill();142 }143 155 144 156 @Override -
trunk/src/org/expeditee/items/Item.java
r805 r812 16 16 import java.awt.geom.Rectangle2D; 17 17 import java.util.ArrayList; 18 import java.util.Arrays;19 18 import java.util.Collection; 20 19 import java.util.ConcurrentModificationException; … … 1326 1325 1327 1326 /** 1328 * Removes the given Constraint from the list of constraints sthat this Dot1327 * Removes the given Constraint from the list of constraints that this Dot 1329 1328 * is a part of. 1330 1329 * … … 1824 1823 } 1825 1824 1825 1826 1827 1828 1829 protected void anchorConstraints() 1830 { 1831 // update the position of any dots that are constrained by this one 1832 for (Constraint c : _constraints) { 1833 Item other = c.getOppositeEnd(this); 1834 1835 // only set position if the other dot is still fixed to the 1836 // frame 1837 if (/* this.isFloating() && */!other.isFloating()) { 1838 if (c.getType() == Constraint.HORIZONTAL) { 1839 if (isAnchoredY()) { 1840 // Make the 'other' item have the same anchor top/bottom values as this 1841 other._anchorTop = _anchorTop; 1842 other._anchorBottom = _anchorBottom; 1843 } 1844 } else if (c.getType() == Constraint.VERTICAL) { 1845 if (isAnchoredX()) { 1846 // Make the 'other' item have the same anchor left/right values as this 1847 other._anchorLeft = _anchorLeft; 1848 other._anchorRight = _anchorRight; 1849 } 1850 } else if (c.isDiagonal()) { 1851 1852 System.err.println("Warning: anchorConstraints() not implement for Diagonal setting"); 1853 } 1854 } 1855 } 1856 } 1857 1826 1858 /** 1827 1859 * Sets the position of this item on the screen … … 2293 2325 public boolean isLineEnd() { 2294 2326 // TODO this will need to be redone when enclosure class is added... 2295 // At the moment enclosures are only circles...we don t want circle2296 // cent ers to be lineEnds2327 // At the moment enclosures are only circles...we don't want circle 2328 // centres to be lineEnds 2297 2329 return _lines.size() > 0; 2298 2330 } … … 2699 2731 * 2700 2732 * @return the collection of items that are linked to this item as source. 2701 * Guar enteed not to be null.2733 * Guaranteed not to be null. 2702 2734 */ 2703 2735 public Collection<? extends XRayable> getEnclosures() { … … 2845 2877 this._anchorRight = null; 2846 2878 if (anchor != null) { 2879 anchorConstraints(); 2847 2880 setX(anchor); 2848 2881 } … … 2852 2885 this._anchorRight = anchor; 2853 2886 this._anchorLeft = null; 2854 if (anchor != null) 2887 if (anchor != null) { 2888 anchorConstraints(); 2855 2889 setX(FrameGraphics.getMaxFrameSize().width - anchor 2856 2890 - getBoundsWidth()); 2891 } 2857 2892 } 2858 2893 … … 2860 2895 this._anchorTop = anchor; 2861 2896 this._anchorBottom = null; 2862 if (anchor != null) 2897 if (anchor != null) { 2898 anchorConstraints(); 2863 2899 setY(anchor); 2900 } 2864 2901 } 2865 2902 … … 2868 2905 this._anchorBottom = anchor; 2869 2906 this._anchorTop = null; 2870 if (anchor != null) 2907 if (anchor != null) { 2908 anchorConstraints(); 2871 2909 setY(FrameGraphics.getMaxFrameSize().height - anchor); 2910 } 2872 2911 } 2873 2912 … … 2955 2994 } 2956 2995 2957 protected void anchorConnected Refactored(AnchorEdgeType anchorEdgeType, Float delta) {2996 protected void anchorConnectedOLD(AnchorEdgeType anchorEdgeType, Float delta) { 2958 2997 // Check for a more efficient way to do this!! 2959 2998 // Invalidate all the items … … 3001 3040 3002 3041 protected void anchorConnected(AnchorEdgeType anchorEdgeType, Float delta) { 3042 3003 3043 // Check for a more efficient way to do this!! 3004 3044 // Invalidate all the items … … 3052 3092 } 3053 3093 3094 anchorConstraints(); 3095 3054 3096 // Invalidate them again!! 3055 3097 for (Item i : this.getAllConnected()) { -
trunk/src/org/expeditee/items/Text.java
r777 r812 2466 2466 invalidateFill(); 2467 2467 invalidateCommonTrait(ItemAppearence.PreMoved); 2468 2469 this._anchorLeft = anchor; 2470 this._anchorRight = null; 2471 2468 2472 int oldX = getX(); 2469 2473 if (anchor != null) { … … 2471 2475 anchorConnected(AnchorEdgeType.Left, deltaX); 2472 2476 } 2473 this._anchorLeft = anchor; 2474 this._anchorRight = null; 2477 2475 2478 invalidateCommonTrait(ItemAppearence.PostMoved); 2476 2479 invalidateFill(); … … 2490 2493 invalidateFill(); 2491 2494 invalidateCommonTrait(ItemAppearence.PreMoved); 2495 2496 this._anchorRight = anchor; 2497 this._anchorLeft = null; 2498 2492 2499 int oldX = getX(); 2493 2500 if (anchor != null) { … … 2496 2503 anchorConnected(AnchorEdgeType.Right, deltaX); 2497 2504 } 2498 this._anchorRight = anchor; 2499 this._anchorLeft = null; 2505 2500 2506 invalidateCommonTrait(ItemAppearence.PostMoved); 2501 2507 invalidateFill(); … … 2515 2521 invalidateFill(); 2516 2522 invalidateCommonTrait(ItemAppearence.PreMoved); 2523 2524 this._anchorTop = anchor; 2525 this._anchorBottom = null; 2526 2517 2527 int oldY = getY(); 2518 2528 if (anchor != null) { … … 2520 2530 anchorConnected(AnchorEdgeType.Top, deltaY); 2521 2531 } 2522 this._anchorTop = anchor; 2523 this._anchorBottom = null; 2532 2524 2533 invalidateCommonTrait(ItemAppearence.PostMoved); 2525 2534 invalidateFill(); … … 2534 2543 invalidateFill(); 2535 2544 invalidateCommonTrait(ItemAppearence.PreMoved); 2545 2546 this._anchorBottom = anchor; 2547 this._anchorTop = null; 2548 2536 2549 int oldY = getY(); 2537 2550 if (anchor != null) { … … 2541 2554 anchorConnected(AnchorEdgeType.Bottom, deltaY); 2542 2555 } 2543 this._anchorBottom = anchor; 2544 this._anchorTop = null; 2556 2545 2557 invalidateCommonTrait(ItemAppearence.PostMoved); 2546 2558 invalidateFill();
Note:
See TracChangeset
for help on using the changeset viewer.