| .. | .. |
|---|
| 139 | 139 | Point prev = new Point(0, 0); |
|---|
| 140 | 140 | Point curr = new Point(0, 0); |
|---|
| 141 | 141 | Rectangle dummy = new Rectangle(); |
|---|
| 142 | | - calcHotSpot(sample, info, prev, dummy); |
|---|
| 142 | + calcHotSpot(sample, //info, |
|---|
| 143 | + prev, dummy); |
|---|
| 143 | 144 | sample = ((Sphere)ctrlPnts.get(i)).getCenter(); |
|---|
| 144 | | - calcHotSpot(sample, info, curr, dummy); |
|---|
| 145 | + calcHotSpot(sample, //info, |
|---|
| 146 | + curr, dummy); |
|---|
| 145 | 147 | info.g.drawLine(prev.x, prev.y, curr.x, curr.y); |
|---|
| 146 | 148 | prev.x = curr.x; |
|---|
| 147 | 149 | prev.y = curr.y; |
|---|
| 148 | 150 | } |
|---|
| 149 | 151 | } |
|---|
| 150 | 152 | |
|---|
| 151 | | - void drawEditHandles(ClickInfo info, int level) |
|---|
| 153 | + void drawEditHandles(//ClickInfo info, |
|---|
| 154 | + int level) |
|---|
| 152 | 155 | { |
|---|
| 153 | | - info.g.setColor(Color.red); |
|---|
| 156 | + clickInfo.g.setColor(Color.red); |
|---|
| 154 | 157 | int count = ctrlPnts.size(); |
|---|
| 155 | 158 | for (int i=0; i < count; i++) |
|---|
| 156 | 159 | { |
|---|
| 157 | 160 | cVector p = ((Sphere)ctrlPnts.elementAt(i)).getCenter(); |
|---|
| 158 | | - Rectangle spot = calcHotSpot(p, info); |
|---|
| 159 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 161 | + Rectangle spot = calcHotSpot(p); //, info); |
|---|
| 162 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 160 | 163 | } |
|---|
| 161 | 164 | |
|---|
| 162 | 165 | } |
|---|
| 163 | 166 | |
|---|
| 164 | | - boolean doEditClick(ClickInfo info, int level) |
|---|
| 167 | + boolean doEditClick(//ClickInfo info, |
|---|
| 168 | + int level) |
|---|
| 165 | 169 | { |
|---|
| 166 | | - startX = info.x; |
|---|
| 167 | | - startY = info.y; |
|---|
| 170 | + startX = clickInfo.x; |
|---|
| 171 | + startY = clickInfo.y; |
|---|
| 168 | 172 | int nPoints = ctrlPnts.size(); |
|---|
| 169 | 173 | hitSomething = false; |
|---|
| 170 | 174 | for (int i=0; i < nPoints; i++) |
|---|
| 171 | 175 | { |
|---|
| 172 | 176 | cVector p = ((Sphere)ctrlPnts.elementAt(i)).getCenter(); |
|---|
| 173 | | - Rectangle r = calcHotSpot(p, info); |
|---|
| 174 | | - if (r.contains(info.x, info.y)) |
|---|
| 177 | + Rectangle r = calcHotSpot(p); //, clickInfo); |
|---|
| 178 | + if (r.contains(clickInfo.x, clickInfo.y)) |
|---|
| 175 | 179 | { |
|---|
| 176 | 180 | hitSomething = true; |
|---|
| 177 | 181 | hitIndex = i; |
|---|
| .. | .. |
|---|
| 117 | 117 | Point prev = new Point(0, 0); |
|---|
| 118 | 118 | Point curr = new Point(0, 0); |
|---|
| 119 | 119 | Rectangle dummy = new Rectangle(); |
|---|
| 120 | | - calcHotSpot(sample, info, prev, dummy); |
|---|
| 120 | + calcHotSpot(sample, //info, |
|---|
| 121 | + prev, dummy); |
|---|
| 121 | 122 | sample = ((Sphere)ctrlPnts.get(i)).getCenter(); |
|---|
| 122 | | - calcHotSpot(sample, info, curr, dummy); |
|---|
| 123 | + calcHotSpot(sample, //info, |
|---|
| 124 | + curr, dummy); |
|---|
| 123 | 125 | info.g.drawLine(prev.x, prev.y, curr.x, curr.y); |
|---|
| 124 | 126 | prev.x = curr.x; |
|---|
| 125 | 127 | prev.y = curr.y; |
|---|
| 126 | 128 | } |
|---|
| 127 | 129 | } |
|---|
| 128 | 130 | |
|---|
| 129 | | - void drawEditHandles(ClickInfo info, int level) |
|---|
| 131 | + void drawEditHandles(//ClickInfo info, |
|---|
| 132 | + int level) |
|---|
| 130 | 133 | { |
|---|
| 131 | | - info.g.setColor(Color.red); |
|---|
| 134 | + clickInfo.g.setColor(Color.red); |
|---|
| 132 | 135 | int count = ctrlPnts.size(); |
|---|
| 133 | 136 | for (int i=0; i < count; i++) |
|---|
| 134 | 137 | { |
|---|
| 135 | 138 | cVector p = ((Sphere)ctrlPnts.elementAt(i)).getCenter(); |
|---|
| 136 | | - Rectangle spot = calcHotSpot(p, info); |
|---|
| 137 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 139 | + Rectangle spot = calcHotSpot(p); //, info); |
|---|
| 140 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 138 | 141 | } |
|---|
| 139 | 142 | |
|---|
| 140 | 143 | } |
|---|
| 141 | 144 | |
|---|
| 142 | | - boolean doEditClick(ClickInfo info, int level) |
|---|
| 145 | + boolean doEditClick(//ClickInfo info, |
|---|
| 146 | + int level) |
|---|
| 143 | 147 | { |
|---|
| 144 | | - startX = info.x; |
|---|
| 145 | | - startY = info.y; |
|---|
| 148 | + startX = clickInfo.x; |
|---|
| 149 | + startY = clickInfo.y; |
|---|
| 146 | 150 | int nPoints = ctrlPnts.size(); |
|---|
| 147 | 151 | hitSomething = false; |
|---|
| 148 | 152 | for (int i=0; i < nPoints; i++) |
|---|
| 149 | 153 | { |
|---|
| 150 | 154 | cVector p = ((Sphere)ctrlPnts.elementAt(i)).getCenter(); |
|---|
| 151 | | - Rectangle r = calcHotSpot(p, info); |
|---|
| 152 | | - if (r.contains(info.x, info.y)) |
|---|
| 155 | + Rectangle r = calcHotSpot(p); //, info); |
|---|
| 156 | + if (r.contains(clickInfo.x, clickInfo.y)) |
|---|
| 153 | 157 | { |
|---|
| 154 | 158 | hitSomething = true; |
|---|
| 155 | 159 | hitIndex = i; |
|---|
| .. | .. |
|---|
| 14255 | 14255 | drag = false; |
|---|
| 14256 | 14256 | //System.out.println("Mouse DOWN"); |
|---|
| 14257 | 14257 | editObj = false; |
|---|
| 14258 | | - ClickInfo info = new ClickInfo(); |
|---|
| 14259 | | - info.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom)); |
|---|
| 14260 | | - info.pane = this; |
|---|
| 14261 | | - info.camera = renderCamera; |
|---|
| 14262 | | - info.x = x; |
|---|
| 14263 | | - info.y = y; |
|---|
| 14264 | | - info.modifiers = modifiersex; |
|---|
| 14265 | | - editObj = object.doEditClick(info, 0); |
|---|
| 14258 | + //ClickInfo info = new ClickInfo(); |
|---|
| 14259 | + object.clickInfo.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom)); |
|---|
| 14260 | + object.clickInfo.pane = this; |
|---|
| 14261 | + object.clickInfo.camera = renderCamera; |
|---|
| 14262 | + object.clickInfo.x = x; |
|---|
| 14263 | + object.clickInfo.y = y; |
|---|
| 14264 | + object.clickInfo.modifiers = modifiersex; |
|---|
| 14265 | + editObj = object.doEditClick(//info, |
|---|
| 14266 | + 0); |
|---|
| 14266 | 14267 | if (!editObj) |
|---|
| 14267 | 14268 | { |
|---|
| 14268 | 14269 | hasMarquee = true; |
|---|
| .. | .. |
|---|
| 14662 | 14663 | if (editObj) |
|---|
| 14663 | 14664 | { |
|---|
| 14664 | 14665 | drag = true; |
|---|
| 14665 | | - ClickInfo info = new ClickInfo(); |
|---|
| 14666 | | - info.bounds.setBounds(0, 0, |
|---|
| 14666 | + //ClickInfo info = new ClickInfo(); |
|---|
| 14667 | + object.clickInfo.bounds.setBounds(0, 0, |
|---|
| 14667 | 14668 | (int) (getBounds().width * zoom), (int) (getBounds().height * zoom)); |
|---|
| 14668 | | - info.pane = this; |
|---|
| 14669 | | - info.camera = renderCamera; |
|---|
| 14670 | | - info.x = x; |
|---|
| 14671 | | - info.y = y; |
|---|
| 14672 | | - object.GetWindow().copy |
|---|
| 14673 | | - .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
|---|
| 14669 | + object.clickInfo.pane = this; |
|---|
| 14670 | + object.clickInfo.camera = renderCamera; |
|---|
| 14671 | + object.clickInfo.x = x; |
|---|
| 14672 | + object.clickInfo.y = y; |
|---|
| 14673 | + object //.GetWindow().copy |
|---|
| 14674 | + .doEditDrag(//info, |
|---|
| 14675 | + (modifiers & MouseEvent.BUTTON3_MASK) != 0); |
|---|
| 14674 | 14676 | } else |
|---|
| 14675 | 14677 | { |
|---|
| 14676 | 14678 | if (x < startX) |
|---|
| .. | .. |
|---|
| 14819 | 14821 | } |
|---|
| 14820 | 14822 | } |
|---|
| 14821 | 14823 | |
|---|
| 14824 | +// ClickInfo clickInfo = new ClickInfo(); |
|---|
| 14825 | + |
|---|
| 14822 | 14826 | public void mouseMoved(MouseEvent e) |
|---|
| 14823 | 14827 | { |
|---|
| 14824 | 14828 | //System.out.println("mouseMoved: " + e); |
|---|
| 14825 | 14829 | if (isRenderer) |
|---|
| 14826 | 14830 | return; |
|---|
| 14827 | 14831 | |
|---|
| 14828 | | - ClickInfo ci = new ClickInfo(); |
|---|
| 14829 | | - ci.x = e.getX(); |
|---|
| 14830 | | - ci.y = e.getY(); |
|---|
| 14831 | | - ci.modifiers = e.getModifiersEx(); |
|---|
| 14832 | | - ci.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom)); |
|---|
| 14833 | | - ci.pane = this; |
|---|
| 14834 | | - ci.camera = renderCamera; |
|---|
| 14832 | + // Mouse cursor feedback |
|---|
| 14833 | + object.clickInfo.x = e.getX(); |
|---|
| 14834 | + object.clickInfo.y = e.getY(); |
|---|
| 14835 | + object.clickInfo.modifiers = e.getModifiersEx(); |
|---|
| 14836 | + object.clickInfo.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom)); |
|---|
| 14837 | + object.clickInfo.pane = this; |
|---|
| 14838 | + object.clickInfo.camera = renderCamera; |
|---|
| 14835 | 14839 | if (!isRenderer) |
|---|
| 14836 | 14840 | { |
|---|
| 14837 | 14841 | //ObjEditor editWindow = object.editWindow; |
|---|
| 14838 | 14842 | //Object3D copy = editWindow.copy; |
|---|
| 14839 | | - if (object.doEditClick(ci, 0)) |
|---|
| 14843 | + if (object.doEditClick(//clickInfo, |
|---|
| 14844 | + 0)) |
|---|
| 14840 | 14845 | { |
|---|
| 14841 | 14846 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
|---|
| 14842 | 14847 | } else |
|---|
| .. | .. |
|---|
| 15862 | 15867 | |
|---|
| 15863 | 15868 | int width = getBounds().width; |
|---|
| 15864 | 15869 | int height = getBounds().height; |
|---|
| 15865 | | - ClickInfo info = new ClickInfo(); |
|---|
| 15866 | | - info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
|---|
| 15867 | 15870 | //Image img = CreateImage(width, height); |
|---|
| 15868 | 15871 | //System.out.println("width = " + width + "; height = " + height + "\n"); |
|---|
| 15869 | 15872 | |
|---|
| .. | .. |
|---|
| 15940 | 15943 | } |
|---|
| 15941 | 15944 | if (object != null && !hasMarquee) |
|---|
| 15942 | 15945 | { |
|---|
| 15946 | + if (object.clickInfo == null) |
|---|
| 15947 | + object.clickInfo = new ClickInfo(); |
|---|
| 15948 | + ClickInfo info = object.clickInfo; |
|---|
| 15949 | + //ClickInfo info = new ClickInfo(); |
|---|
| 15950 | + info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom)); |
|---|
| 15951 | + |
|---|
| 15943 | 15952 | if (isRenderer) |
|---|
| 15944 | 15953 | { |
|---|
| 15945 | | - info.flags++; |
|---|
| 15954 | + object.clickInfo.flags++; |
|---|
| 15946 | 15955 | double frameAspect = (double) width / (double) height; |
|---|
| 15947 | 15956 | if (frameAspect > renderCamera.aspect) |
|---|
| 15948 | 15957 | { |
|---|
| 15949 | 15958 | int desired = (int) ((double) height * renderCamera.aspect); |
|---|
| 15950 | | - info.bounds.width -= width - desired; |
|---|
| 15951 | | - info.bounds.x += (width - desired) / 2; |
|---|
| 15959 | + object.clickInfo.bounds.width -= width - desired; |
|---|
| 15960 | + object.clickInfo.bounds.x += (width - desired) / 2; |
|---|
| 15952 | 15961 | } else |
|---|
| 15953 | 15962 | { |
|---|
| 15954 | 15963 | int desired = (int) ((double) width / renderCamera.aspect); |
|---|
| 15955 | | - info.bounds.height -= height - desired; |
|---|
| 15956 | | - info.bounds.y += (height - desired) / 2; |
|---|
| 15964 | + object.clickInfo.bounds.height -= height - desired; |
|---|
| 15965 | + object.clickInfo.bounds.y += (height - desired) / 2; |
|---|
| 15957 | 15966 | } |
|---|
| 15958 | 15967 | } |
|---|
| 15959 | 15968 | |
|---|
| 15960 | | - info.g = gr; |
|---|
| 15961 | | - info.camera = renderCamera; |
|---|
| 15969 | + object.clickInfo.g = gr; |
|---|
| 15970 | + object.clickInfo.camera = renderCamera; |
|---|
| 15962 | 15971 | /* |
|---|
| 15963 | 15972 | // Memory intensive (brep.verticescopy) |
|---|
| 15964 | 15973 | if (!(object instanceof Composite)) |
|---|
| 15965 | 15974 | object.draw(info, 0, false); // SLOW : |
|---|
| 15966 | 15975 | */ |
|---|
| 15967 | | - if (!isRenderer) |
|---|
| 15976 | + if (!isRenderer) // && drag) |
|---|
| 15968 | 15977 | { |
|---|
| 15969 | 15978 | Grafreed.Assert(object != null); |
|---|
| 15970 | 15979 | Grafreed.Assert(object.selection != null); |
|---|
| .. | .. |
|---|
| 15972 | 15981 | { |
|---|
| 15973 | 15982 | int hitSomething = object.selection.get(0).hitSomething; |
|---|
| 15974 | 15983 | |
|---|
| 15975 | | - info.DX = 0; |
|---|
| 15976 | | - info.DY = 0; |
|---|
| 15977 | | - info.W = 1; |
|---|
| 15984 | + object.clickInfo.DX = 0; |
|---|
| 15985 | + object.clickInfo.DY = 0; |
|---|
| 15986 | + object.clickInfo.W = 1; |
|---|
| 15978 | 15987 | if (hitSomething == Object3D.hitCenter) |
|---|
| 15979 | 15988 | { |
|---|
| 15980 | 15989 | info.DX = X; |
|---|
| .. | .. |
|---|
| 15986 | 15995 | info.DY -= info.bounds.height/2; |
|---|
| 15987 | 15996 | } |
|---|
| 15988 | 15997 | |
|---|
| 15989 | | - object.drawEditHandles(info, 0); |
|---|
| 15998 | + object.drawEditHandles(//info, |
|---|
| 15999 | + 0); |
|---|
| 15990 | 16000 | |
|---|
| 15991 | 16001 | if (drag && (X != 0 || Y != 0)) |
|---|
| 15992 | 16002 | { |
|---|
| .. | .. |
|---|
| 15999 | 16009 | gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
|---|
| 16000 | 16010 | break; |
|---|
| 16001 | 16011 | case Object3D.hitScale: gr.setColor(Color.cyan); |
|---|
| 16002 | | - gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
|---|
| 16012 | + gr.drawLine(X, Y, 0, 0); |
|---|
| 16003 | 16013 | break; |
|---|
| 16004 | 16014 | } |
|---|
| 16005 | 16015 | |
|---|
| .. | .. |
|---|
| 12 | 12 | ClickInfo() |
|---|
| 13 | 13 | { |
|---|
| 14 | 14 | bounds = new Rectangle(); |
|---|
| 15 | + System.out.println("CLICKINFO"); |
|---|
| 15 | 16 | } |
|---|
| 16 | 17 | |
|---|
| 17 | 18 | static final int kCamera = 1; |
|---|
| .. | .. |
|---|
| 28 | 29 | Graphics g; |
|---|
| 29 | 30 | int DX, DY; |
|---|
| 30 | 31 | float W = 1; |
|---|
| 32 | + |
|---|
| 33 | + double scale; // Distance from clicked point to origin |
|---|
| 31 | 34 | |
|---|
| 32 | 35 | static double matbuffer[][] = new double[4][4]; |
|---|
| 33 | 36 | } |
|---|
| .. | .. |
|---|
| 790 | 790 | |
|---|
| 791 | 791 | void draw(ClickInfo info, int level, boolean select) |
|---|
| 792 | 792 | { |
|---|
| 793 | + new Exception().printStackTrace(); |
|---|
| 794 | + |
|---|
| 793 | 795 | ClickInfo newInfo = new ClickInfo(); |
|---|
| 794 | 796 | newInfo.flags = info.flags; |
|---|
| 795 | 797 | newInfo.bounds = info.bounds; |
|---|
| .. | .. |
|---|
| 2 | 2 | |
|---|
| 3 | 3 | class Cone extends Biparam implements java.io.Serializable |
|---|
| 4 | 4 | { |
|---|
| 5 | | - //static final long serialVersionUID = -679715043452968126L; |
|---|
| 5 | + static final long serialVersionUID = -2558098774090336324L; // -679715043452968126L; |
|---|
| 6 | 6 | |
|---|
| 7 | 7 | Cone() |
|---|
| 8 | 8 | { |
|---|
| .. | .. |
|---|
| 263 | 263 | editWindow = objectUI.GetEditor(); |
|---|
| 264 | 264 | } |
|---|
| 265 | 265 | |
|---|
| 266 | | - void drawEditHandles(ClickInfo info, int level) |
|---|
| 266 | + void drawEditHandles(//ClickInfo info, |
|---|
| 267 | + int level) |
|---|
| 267 | 268 | { |
|---|
| 268 | | - super.drawEditHandles(info, level); |
|---|
| 269 | + super.drawEditHandles(//info, |
|---|
| 270 | + level); |
|---|
| 269 | 271 | if (level == 1) |
|---|
| 270 | 272 | { |
|---|
| 271 | 273 | return; |
|---|
| .. | .. |
|---|
| 273 | 275 | { |
|---|
| 274 | 276 | cVector temp = new cVector(); |
|---|
| 275 | 277 | LA.xformPos(base, toParent, temp); |
|---|
| 276 | | - Rectangle baseSpot = calcHotSpot(temp, info); |
|---|
| 278 | + Rectangle baseSpot = calcHotSpot(temp); //, info); |
|---|
| 277 | 279 | LA.xformPos(apex, toParent, temp); |
|---|
| 278 | | - Rectangle apexSpot = calcHotSpot(temp, info); |
|---|
| 279 | | - info.g.setColor(Color.green); |
|---|
| 280 | | - info.g.fillRect(baseSpot.x, baseSpot.y, baseSpot.width, baseSpot.height); |
|---|
| 281 | | - info.g.fillRect(apexSpot.x, apexSpot.y, apexSpot.width, apexSpot.height); |
|---|
| 280 | + Rectangle apexSpot = calcHotSpot(temp); //, info); |
|---|
| 281 | + clickInfo.g.setColor(Color.green); |
|---|
| 282 | + clickInfo.g.fillRect(baseSpot.x, baseSpot.y, baseSpot.width, baseSpot.height); |
|---|
| 283 | + clickInfo.g.fillRect(apexSpot.x, apexSpot.y, apexSpot.width, apexSpot.height); |
|---|
| 282 | 284 | return; |
|---|
| 283 | 285 | } |
|---|
| 284 | 286 | } |
|---|
| 285 | 287 | |
|---|
| 286 | | - boolean doEditClick(ClickInfo info, int level) |
|---|
| 288 | + boolean doEditClick(//ClickInfo info, |
|---|
| 289 | + int level) |
|---|
| 287 | 290 | { |
|---|
| 288 | 291 | //if (level == 0) |
|---|
| 289 | 292 | //return false; |
|---|
| 290 | 293 | hitSomething = 0; |
|---|
| 291 | | - if (super.doEditClick(info, level)) |
|---|
| 294 | + if (super.doEditClick(//info, |
|---|
| 295 | + level)) |
|---|
| 292 | 296 | { |
|---|
| 293 | 297 | hitSomething = 1; |
|---|
| 294 | 298 | return true; |
|---|
| 295 | 299 | } |
|---|
| 296 | 300 | cVector temp = new cVector(); |
|---|
| 297 | 301 | LA.xformPos(base, toParent, temp); |
|---|
| 298 | | - Rectangle baseSpot = calcHotSpot(temp, info); |
|---|
| 302 | + Rectangle baseSpot = calcHotSpot(temp); //, info); |
|---|
| 299 | 303 | LA.xformPos(apex, toParent, temp); |
|---|
| 300 | | - Rectangle apexSpot = calcHotSpot(temp, info); |
|---|
| 301 | | - if (baseSpot.contains(info.x, info.y)) |
|---|
| 304 | + Rectangle apexSpot = calcHotSpot(temp); //, info); |
|---|
| 305 | + if (baseSpot.contains(clickInfo.x, clickInfo.y)) |
|---|
| 302 | 306 | { |
|---|
| 303 | 307 | hitSomething = 2; |
|---|
| 304 | 308 | startRad = baseRadius; |
|---|
| 305 | 309 | } else |
|---|
| 306 | | - if (apexSpot.contains(info.x, info.y)) |
|---|
| 310 | + if (apexSpot.contains(clickInfo.x, clickInfo.y)) |
|---|
| 307 | 311 | { |
|---|
| 308 | 312 | hitSomething = 3; |
|---|
| 309 | 313 | startRad = apexRadius; |
|---|
| .. | .. |
|---|
| 311 | 315 | { |
|---|
| 312 | 316 | return false; |
|---|
| 313 | 317 | } |
|---|
| 314 | | - startX = info.x; |
|---|
| 318 | + startX = clickInfo.x; |
|---|
| 315 | 319 | return true; |
|---|
| 316 | 320 | } |
|---|
| 317 | 321 | |
|---|
| 318 | | - void doEditDrag(ClickInfo info, boolean opposite) |
|---|
| 322 | + void doEditDrag(//ClickInfo info, |
|---|
| 323 | + boolean opposite) |
|---|
| 319 | 324 | { |
|---|
| 320 | 325 | if (hitSomething == 0) |
|---|
| 321 | 326 | return; |
|---|
| 322 | 327 | if (hitSomething == 1) |
|---|
| 323 | 328 | { |
|---|
| 324 | | - super.doEditDrag(info, opposite); |
|---|
| 329 | + super.doEditDrag(//info, |
|---|
| 330 | + opposite); |
|---|
| 325 | 331 | return; |
|---|
| 326 | 332 | } |
|---|
| 327 | | - double deltaR = info.x - startX; |
|---|
| 333 | + double deltaR = clickInfo.x - startX; |
|---|
| 328 | 334 | double newRad = startRad + deltaR; |
|---|
| 329 | 335 | if (newRad < 0) |
|---|
| 330 | 336 | newRad = 0; |
|---|
| .. | .. |
|---|
| 333 | 339 | else |
|---|
| 334 | 340 | apexRadius = newRad; |
|---|
| 335 | 341 | recalculate(); |
|---|
| 336 | | - info.pane.repaint(); |
|---|
| 342 | + clickInfo.pane.repaint(); |
|---|
| 337 | 343 | } |
|---|
| 338 | 344 | |
|---|
| 339 | 345 | cVector base; |
|---|
| .. | .. |
|---|
| 2567 | 2567 | private static final int editSelf = 1; |
|---|
| 2568 | 2568 | private static final int editChild = 2; |
|---|
| 2569 | 2569 | |
|---|
| 2570 | | - void drawEditHandles(ClickInfo info, int level) |
|---|
| 2570 | + void drawEditHandles(//ClickInfo info, |
|---|
| 2571 | + int level) |
|---|
| 2571 | 2572 | { |
|---|
| 2572 | 2573 | if (level == 0) |
|---|
| 2573 | 2574 | { |
|---|
| .. | .. |
|---|
| 2575 | 2576 | return; |
|---|
| 2576 | 2577 | |
|---|
| 2577 | 2578 | Object3D selectee; |
|---|
| 2578 | | - for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(info, level + 1)) |
|---|
| 2579 | + for (java.util.Enumeration e = selection.elements(); e.hasMoreElements(); selectee.drawEditHandles(//info, |
|---|
| 2580 | + level + 1)) |
|---|
| 2579 | 2581 | { |
|---|
| 2580 | 2582 | selectee = (Object3D) e.nextElement(); |
|---|
| 2581 | 2583 | } |
|---|
| .. | .. |
|---|
| 2583 | 2585 | } else |
|---|
| 2584 | 2586 | { |
|---|
| 2585 | 2587 | //super. |
|---|
| 2586 | | - drawEditHandles0(info, level + 1); |
|---|
| 2588 | + drawEditHandles0(//info, |
|---|
| 2589 | + level + 1); |
|---|
| 2587 | 2590 | } |
|---|
| 2588 | 2591 | } |
|---|
| 2589 | 2592 | |
|---|
| 2590 | | - boolean doEditClick(ClickInfo info, int level) |
|---|
| 2593 | + boolean doEditClick(//ClickInfo info, |
|---|
| 2594 | + int level) |
|---|
| 2591 | 2595 | { |
|---|
| 2592 | 2596 | doSomething = 0; |
|---|
| 2593 | 2597 | if (level == 0) |
|---|
| 2594 | 2598 | { |
|---|
| 2595 | | - return doParentClick(info); |
|---|
| 2599 | + return doParentClick(); //info); |
|---|
| 2596 | 2600 | } |
|---|
| 2597 | 2601 | if (//super. |
|---|
| 2598 | | - doEditClick0(info, level)) |
|---|
| 2602 | + doEditClick0(//info, |
|---|
| 2603 | + level)) |
|---|
| 2599 | 2604 | { |
|---|
| 2600 | 2605 | doSomething = 1; |
|---|
| 2601 | 2606 | return true; |
|---|
| .. | .. |
|---|
| 2605 | 2610 | } |
|---|
| 2606 | 2611 | } |
|---|
| 2607 | 2612 | |
|---|
| 2608 | | - boolean doParentClick(ClickInfo info) |
|---|
| 2613 | + boolean doParentClick() //ClickInfo info) |
|---|
| 2609 | 2614 | { |
|---|
| 2610 | 2615 | if (selection == null) |
|---|
| 2611 | 2616 | { |
|---|
| .. | .. |
|---|
| 2618 | 2623 | for (java.util.Enumeration e = selection.elements(); e.hasMoreElements();) |
|---|
| 2619 | 2624 | { |
|---|
| 2620 | 2625 | Object3D selectee = (Object3D) e.nextElement(); |
|---|
| 2621 | | - if (selectee.doEditClick(info, 1)) |
|---|
| 2626 | + if (selectee.doEditClick(//info, |
|---|
| 2627 | + 1)) |
|---|
| 2622 | 2628 | { |
|---|
| 2623 | 2629 | childToDrag = selectee; |
|---|
| 2624 | 2630 | doSomething = 2; |
|---|
| .. | .. |
|---|
| 2630 | 2636 | return retval; |
|---|
| 2631 | 2637 | } |
|---|
| 2632 | 2638 | |
|---|
| 2633 | | - void doEditDrag(ClickInfo info, boolean opposite) |
|---|
| 2639 | + void doEditDrag(//ClickInfo clickInfo, |
|---|
| 2640 | + boolean opposite) |
|---|
| 2634 | 2641 | { |
|---|
| 2635 | 2642 | switch (doSomething) |
|---|
| 2636 | 2643 | { |
|---|
| 2637 | 2644 | case 1: // '\001' |
|---|
| 2638 | 2645 | //super. |
|---|
| 2639 | | - doEditDrag0(info, opposite); |
|---|
| 2646 | + doEditDrag0(//clickInfo, |
|---|
| 2647 | + opposite); |
|---|
| 2640 | 2648 | break; |
|---|
| 2641 | 2649 | |
|---|
| 2642 | 2650 | case 2: // '\002' |
|---|
| .. | .. |
|---|
| 2649 | 2657 | { |
|---|
| 2650 | 2658 | //sel.hitSomething = childToDrag.hitSomething; |
|---|
| 2651 | 2659 | //childToDrag.doEditDrag(info); |
|---|
| 2652 | | - sel.doEditDrag(info, opposite); |
|---|
| 2660 | + sel.doEditDrag(//clickInfo, |
|---|
| 2661 | + opposite); |
|---|
| 2653 | 2662 | } else |
|---|
| 2654 | 2663 | { |
|---|
| 2655 | 2664 | //super. |
|---|
| 2656 | | - doEditDrag0(info, opposite); |
|---|
| 2665 | + doEditDrag0(//clickInfo, |
|---|
| 2666 | + opposite); |
|---|
| 2657 | 2667 | } |
|---|
| 2658 | 2668 | } |
|---|
| 2659 | 2669 | break; |
|---|
| .. | .. |
|---|
| 2671 | 2681 | { |
|---|
| 2672 | 2682 | deselectAll(); |
|---|
| 2673 | 2683 | } |
|---|
| 2684 | + |
|---|
| 2685 | + new Exception().printStackTrace(); |
|---|
| 2686 | + |
|---|
| 2674 | 2687 | ClickInfo newInfo = new ClickInfo(); |
|---|
| 2675 | 2688 | newInfo.flags = info.flags; |
|---|
| 2676 | 2689 | newInfo.bounds = info.bounds; |
|---|
| .. | .. |
|---|
| 7298 | 7311 | } |
|---|
| 7299 | 7312 | } |
|---|
| 7300 | 7313 | |
|---|
| 7301 | | - protected void calcHotSpot(cVector in, ClickInfo info, Point outPt, Rectangle outRec) |
|---|
| 7314 | + static ClickInfo clickInfo = new ClickInfo(); |
|---|
| 7315 | + |
|---|
| 7316 | + protected void calcHotSpot(cVector in, //ClickInfo clickInfo, |
|---|
| 7317 | + Point outPt, Rectangle outRec) |
|---|
| 7302 | 7318 | { |
|---|
| 7303 | | - int hc = info.bounds.x + info.bounds.width / 2; |
|---|
| 7304 | | - int vc = info.bounds.y + info.bounds.height / 2; |
|---|
| 7305 | | - double[][] toscreen = info.toScreen; |
|---|
| 7319 | + int hc = clickInfo.bounds.x + clickInfo.bounds.width / 2; |
|---|
| 7320 | + int vc = clickInfo.bounds.y + clickInfo.bounds.height / 2; |
|---|
| 7321 | + double[][] toscreen = clickInfo.toScreen; |
|---|
| 7306 | 7322 | if (toscreen == null) |
|---|
| 7307 | 7323 | { |
|---|
| 7308 | | - toscreen = new Camera(info.camera.viewCode).toScreen; |
|---|
| 7324 | + toscreen = new Camera(clickInfo.camera.viewCode).toScreen; |
|---|
| 7309 | 7325 | } |
|---|
| 7310 | 7326 | cVector vec = in; |
|---|
| 7311 | 7327 | LA.xformPos(in, toscreen, in); |
|---|
| 7312 | 7328 | //System.out.println("Distance = " + info.camera.Distance()); |
|---|
| 7313 | | - vec.x *= 100 * info.camera.SCALE / info.camera.Distance(); |
|---|
| 7314 | | - vec.y *= 100 * info.camera.SCALE / info.camera.Distance(); |
|---|
| 7329 | + vec.x *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
|---|
| 7330 | + vec.y *= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
|---|
| 7315 | 7331 | outPt.x = hc + (int) vec.x; |
|---|
| 7316 | 7332 | outPt.y = vc - (int) vec.y; |
|---|
| 7317 | 7333 | outRec.x = outPt.x - 3; |
|---|
| .. | .. |
|---|
| 7319 | 7335 | outRec.width = outRec.height = 6; |
|---|
| 7320 | 7336 | } |
|---|
| 7321 | 7337 | |
|---|
| 7322 | | - protected Rectangle calcHotSpot(cVector in, ClickInfo info) |
|---|
| 7338 | + protected Rectangle calcHotSpot(cVector in//, ClickInfo clickInfo |
|---|
| 7339 | + ) |
|---|
| 7323 | 7340 | { |
|---|
| 7324 | 7341 | Point pt = new Point(0, 0); |
|---|
| 7325 | 7342 | Rectangle rec = new Rectangle(); |
|---|
| 7326 | | - calcHotSpot(in, info, pt, rec); |
|---|
| 7343 | + calcHotSpot(in, //clickInfo, |
|---|
| 7344 | + pt, rec); |
|---|
| 7327 | 7345 | return rec; |
|---|
| 7328 | 7346 | } |
|---|
| 7329 | 7347 | |
|---|
| 7330 | | - void drawEditHandles0(ClickInfo info, int level) |
|---|
| 7348 | + void drawEditHandles0(//ClickInfo clickInfo, |
|---|
| 7349 | + int level) |
|---|
| 7331 | 7350 | { |
|---|
| 7332 | 7351 | if (level == 0) |
|---|
| 7333 | 7352 | { |
|---|
| .. | .. |
|---|
| 7336 | 7355 | { |
|---|
| 7337 | 7356 | cVector origin = new cVector(); |
|---|
| 7338 | 7357 | //LA.xformPos(origin, toParent, origin); |
|---|
| 7339 | | - Rectangle spot = calcHotSpot(origin, info); |
|---|
| 7358 | + if (this.clickInfo == null) |
|---|
| 7359 | + this.clickInfo = new ClickInfo(); |
|---|
| 7360 | + |
|---|
| 7361 | + Rectangle spot = calcHotSpot(origin); //, clickInfo); |
|---|
| 7340 | 7362 | Rectangle boundary = new Rectangle(); |
|---|
| 7341 | 7363 | boundary.x = spot.x - 30; |
|---|
| 7342 | 7364 | boundary.y = spot.y - 30; |
|---|
| 7343 | 7365 | boundary.width = spot.width + 60; |
|---|
| 7344 | 7366 | boundary.height = spot.height + 60; |
|---|
| 7345 | | - info.g.setColor(Color.red); |
|---|
| 7367 | + clickInfo.g.setColor(Color.red); |
|---|
| 7346 | 7368 | int spotw = spot.x + spot.width; |
|---|
| 7347 | 7369 | int spoth = spot.y + spot.height; |
|---|
| 7348 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 7370 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 7349 | 7371 | // if (CameraPane.Xmin > spot.x) |
|---|
| 7350 | 7372 | // { |
|---|
| 7351 | 7373 | // CameraPane.Xmin = spot.x; |
|---|
| .. | .. |
|---|
| 7365 | 7387 | spot.translate(32, 32); |
|---|
| 7366 | 7388 | spotw = spot.x + spot.width; |
|---|
| 7367 | 7389 | spoth = spot.y + spot.height; |
|---|
| 7368 | | - info.g.setColor(Color.cyan); |
|---|
| 7369 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 7390 | + clickInfo.g.setColor(Color.cyan); |
|---|
| 7391 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 7370 | 7392 | // if (CameraPane.Xmin > spot.x) |
|---|
| 7371 | 7393 | // { |
|---|
| 7372 | 7394 | // CameraPane.Xmin = spot.x; |
|---|
| .. | .. |
|---|
| 7386 | 7408 | // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
|---|
| 7387 | 7409 | //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
|---|
| 7388 | 7410 | spot.translate(0, -32); |
|---|
| 7389 | | - info.g.setColor(Color.yellow); |
|---|
| 7390 | | - info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 7391 | | - info.g.setColor(Color.green); |
|---|
| 7411 | + clickInfo.g.setColor(Color.yellow); |
|---|
| 7412 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 7413 | + clickInfo.g.setColor(Color.green); |
|---|
| 7392 | 7414 | // if (CameraPane.Xmin > spot.x) |
|---|
| 7393 | 7415 | // { |
|---|
| 7394 | 7416 | // CameraPane.Xmin = spot.x; |
|---|
| .. | .. |
|---|
| 7405 | 7427 | // { |
|---|
| 7406 | 7428 | // CameraPane.Ymax = spoth; |
|---|
| 7407 | 7429 | // } |
|---|
| 7408 | | - info.g.drawArc(boundary.x + info.DX, boundary.y + info.DY, |
|---|
| 7409 | | - (int)(boundary.width * info.W), (int)(boundary.height * info.W), 0, 360); |
|---|
| 7430 | + clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
|---|
| 7431 | + (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
|---|
| 7410 | 7432 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
|---|
| 7411 | 7433 | // if (CameraPane.Xmin > boundary.x) |
|---|
| 7412 | 7434 | // { |
|---|
| .. | .. |
|---|
| 7428 | 7450 | } |
|---|
| 7429 | 7451 | } |
|---|
| 7430 | 7452 | |
|---|
| 7431 | | - boolean doEditClick0(ClickInfo info, int level) |
|---|
| 7453 | + boolean doEditClick0(//ClickInfo clickInfo, |
|---|
| 7454 | + int level) |
|---|
| 7432 | 7455 | { |
|---|
| 7433 | 7456 | if (level == 0) |
|---|
| 7434 | 7457 | { |
|---|
| .. | .. |
|---|
| 7437 | 7460 | |
|---|
| 7438 | 7461 | boolean retval = false; |
|---|
| 7439 | 7462 | |
|---|
| 7440 | | - startX = info.x; |
|---|
| 7441 | | - startY = info.y; |
|---|
| 7463 | + startX = clickInfo.x; |
|---|
| 7464 | + startY = clickInfo.y; |
|---|
| 7442 | 7465 | |
|---|
| 7443 | 7466 | hitSomething = -1; |
|---|
| 7444 | 7467 | cVector origin = new cVector(); |
|---|
| .. | .. |
|---|
| 7448 | 7471 | { |
|---|
| 7449 | 7472 | centerPt = new Point(0, 0); |
|---|
| 7450 | 7473 | } |
|---|
| 7451 | | - calcHotSpot(origin, info, centerPt, spot); |
|---|
| 7452 | | - if (spot.contains(info.x, info.y)) |
|---|
| 7474 | + calcHotSpot(origin, //info, |
|---|
| 7475 | + centerPt, spot); |
|---|
| 7476 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
|---|
| 7453 | 7477 | { |
|---|
| 7454 | 7478 | hitSomething = hitCenter; |
|---|
| 7455 | 7479 | retval = true; |
|---|
| 7456 | 7480 | } |
|---|
| 7457 | 7481 | spot.translate(32, 0); |
|---|
| 7458 | | - if (spot.contains(info.x, info.y)) |
|---|
| 7482 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
|---|
| 7459 | 7483 | { |
|---|
| 7460 | 7484 | hitSomething = hitRotate; |
|---|
| 7461 | 7485 | retval = true; |
|---|
| 7462 | 7486 | } |
|---|
| 7463 | 7487 | spot.translate(0, 32); |
|---|
| 7464 | | - if (spot.contains(info.x, info.y)) |
|---|
| 7488 | + if (spot.contains(clickInfo.x, clickInfo.y)) |
|---|
| 7465 | 7489 | { |
|---|
| 7466 | 7490 | hitSomething = hitScale; |
|---|
| 7491 | + |
|---|
| 7492 | + double scale = 0.005f * clickInfo.camera.Distance(); |
|---|
| 7493 | + double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
|---|
| 7494 | + double sign = 1; |
|---|
| 7495 | + if (hScale < 0) |
|---|
| 7496 | + { |
|---|
| 7497 | + sign = -1; |
|---|
| 7498 | + } |
|---|
| 7499 | + hScale = sign*Math.pow(sign*hScale, scale * 50); |
|---|
| 7500 | + if (hScale < 0.01) |
|---|
| 7501 | + { |
|---|
| 7502 | + //hScale = 0.01; |
|---|
| 7503 | + } |
|---|
| 7504 | + |
|---|
| 7505 | + double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
|---|
| 7506 | + sign = 1; |
|---|
| 7507 | + if (vScale < 0) |
|---|
| 7508 | + { |
|---|
| 7509 | + sign = -1; |
|---|
| 7510 | + } |
|---|
| 7511 | + vScale = sign*Math.pow(sign*vScale, scale * 50); |
|---|
| 7512 | + if (vScale < 0.01) |
|---|
| 7513 | + { |
|---|
| 7514 | + //vScale = 0.01; |
|---|
| 7515 | + } |
|---|
| 7516 | + |
|---|
| 7517 | + clickInfo.scale = Math.sqrt(hScale*hScale + vScale*vScale); |
|---|
| 7518 | + |
|---|
| 7467 | 7519 | retval = true; |
|---|
| 7468 | 7520 | } |
|---|
| 7469 | 7521 | |
|---|
| .. | .. |
|---|
| 7473 | 7525 | } |
|---|
| 7474 | 7526 | |
|---|
| 7475 | 7527 | //System.out.println("info.modifiers = " + info.modifiers); |
|---|
| 7476 | | - modified = (info.modifiers & CameraPane.SHIFT) != 0; // Was META |
|---|
| 7528 | + modified = (clickInfo.modifiers & CameraPane.SHIFT) != 0; // Was META |
|---|
| 7477 | 7529 | //System.out.println("modified = " + modified); |
|---|
| 7478 | 7530 | //new Exception().printStackTrace(); |
|---|
| 7479 | 7531 | //viewCode = info.pane.renderCamera.viewCode; |
|---|
| .. | .. |
|---|
| 7501 | 7553 | return true; |
|---|
| 7502 | 7554 | } |
|---|
| 7503 | 7555 | |
|---|
| 7504 | | - void doEditDrag0(ClickInfo info, boolean opposite) |
|---|
| 7556 | + void doEditDrag0(//ClickInfo info, |
|---|
| 7557 | + boolean opposite) |
|---|
| 7505 | 7558 | { |
|---|
| 7506 | 7559 | if (hitSomething == 0) |
|---|
| 7507 | 7560 | { |
|---|
| .. | .. |
|---|
| 7515 | 7568 | |
|---|
| 7516 | 7569 | //System.out.println("hitSomething = " + hitSomething); |
|---|
| 7517 | 7570 | |
|---|
| 7518 | | - double scale = 0.005f * info.camera.Distance(); |
|---|
| 7571 | + double scale = 0.005f * clickInfo.camera.Distance(); |
|---|
| 7519 | 7572 | |
|---|
| 7520 | 7573 | cVector xlate = new cVector(); |
|---|
| 7521 | 7574 | //cVector xlate2 = new cVector(); |
|---|
| .. | .. |
|---|
| 7549 | 7602 | toParent[3][i] = xlate.get(i); |
|---|
| 7550 | 7603 | LA.matInvert(toParent, fromParent); |
|---|
| 7551 | 7604 | */ |
|---|
| 7552 | | - cVector delta = LA.newVector(0, 0, startY - info.y); |
|---|
| 7553 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
|---|
| 7605 | + cVector delta = LA.newVector(0, 0, startY - clickInfo.y); |
|---|
| 7606 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
|---|
| 7554 | 7607 | |
|---|
| 7555 | 7608 | LA.matCopy(startMat, toParent); |
|---|
| 7556 | 7609 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
|---|
| .. | .. |
|---|
| 7559 | 7612 | } else |
|---|
| 7560 | 7613 | { |
|---|
| 7561 | 7614 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
|---|
| 7562 | | - cVector up = new cVector(info.camera.up); |
|---|
| 7615 | + cVector up = new cVector(clickInfo.camera.up); |
|---|
| 7563 | 7616 | cVector away = new cVector(); |
|---|
| 7564 | 7617 | //cVector right2 = new cVector(); |
|---|
| 7565 | 7618 | //LA.vecCross(up, cVector.Z, right); |
|---|
| .. | .. |
|---|
| 7576 | 7629 | LA.xformDir(up, ClickInfo.matbuffer, up); |
|---|
| 7577 | 7630 | // if (!CameraPane.LOCALTRANSFORM) |
|---|
| 7578 | 7631 | LA.xformDir(up, Globals.theRenderer.RenderCamera().toScreen, up); |
|---|
| 7579 | | - LA.xformDir(info.camera.away, ClickInfo.matbuffer, away); |
|---|
| 7632 | + LA.xformDir(clickInfo.camera.away, ClickInfo.matbuffer, away); |
|---|
| 7580 | 7633 | // if (!CameraPane.LOCALTRANSFORM) |
|---|
| 7581 | 7634 | LA.xformDir(away, Globals.theRenderer.RenderCamera().toScreen, away); |
|---|
| 7582 | 7635 | //LA.vecCross(up, cVector.Z, right2); |
|---|
| 7583 | 7636 | |
|---|
| 7584 | | - cVector delta = LA.newVector(info.x - startX, startY - info.y, 0); |
|---|
| 7637 | + cVector delta = LA.newVector(clickInfo.x - startX, startY - clickInfo.y, 0); |
|---|
| 7585 | 7638 | |
|---|
| 7586 | 7639 | //System.out.println("DELTA0 = " + delta); |
|---|
| 7587 | 7640 | //System.out.println("AWAY = " + info.camera.away); |
|---|
| 7588 | 7641 | //System.out.println("UP = " + info.camera.up); |
|---|
| 7589 | 7642 | if (away.z > 0) |
|---|
| 7590 | 7643 | { |
|---|
| 7591 | | - if (info.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
|---|
| 7644 | + if (clickInfo.camera.up.x == 0) // LA.vecDot(right, right2)<0) |
|---|
| 7592 | 7645 | { |
|---|
| 7593 | 7646 | delta.x = -delta.x; |
|---|
| 7594 | 7647 | } else |
|---|
| .. | .. |
|---|
| 7603 | 7656 | //System.out.println("DELTA1 = " + delta); |
|---|
| 7604 | 7657 | LA.xformDir(delta, ClickInfo.matbuffer, delta); |
|---|
| 7605 | 7658 | //System.out.println("DELTA2 = " + delta); |
|---|
| 7606 | | - LA.xformDir(delta, new Camera(info.camera.viewCode).fromScreen, delta); |
|---|
| 7659 | + LA.xformDir(delta, new Camera(clickInfo.camera.viewCode).fromScreen, delta); |
|---|
| 7607 | 7660 | LA.matCopy(startMat, toParent); |
|---|
| 7608 | 7661 | //System.out.println("DELTA3 = " + delta); |
|---|
| 7609 | 7662 | LA.matTranslate(toParent, delta.x * scale, delta.y * scale, delta.z * scale); |
|---|
| .. | .. |
|---|
| 7613 | 7666 | break; |
|---|
| 7614 | 7667 | |
|---|
| 7615 | 7668 | case hitRotate: // rotate |
|---|
| 7616 | | - int dx = info.x - centerPt.x; |
|---|
| 7617 | | - int dy = -(info.y - centerPt.y); |
|---|
| 7669 | + int dx = clickInfo.x - centerPt.x; |
|---|
| 7670 | + int dy = -(clickInfo.y - centerPt.y); |
|---|
| 7618 | 7671 | double angle = (double) Math.atan2(dx, dy); |
|---|
| 7619 | 7672 | angle = -(1.570796 - angle); |
|---|
| 7620 | 7673 | |
|---|
| .. | .. |
|---|
| 7637 | 7690 | } |
|---|
| 7638 | 7691 | /**/ |
|---|
| 7639 | 7692 | |
|---|
| 7640 | | - switch (info.pane.RenderCamera().viewCode) |
|---|
| 7693 | + switch (clickInfo.pane.RenderCamera().viewCode) |
|---|
| 7641 | 7694 | { |
|---|
| 7642 | 7695 | case 1: // '\001' |
|---|
| 7643 | 7696 | LA.matZRotate(toParent, angle); |
|---|
| .. | .. |
|---|
| 7664 | 7717 | break; |
|---|
| 7665 | 7718 | |
|---|
| 7666 | 7719 | case hitScale: // scale |
|---|
| 7667 | | - double hScale = (double) (info.x - centerPt.x) / 32; |
|---|
| 7720 | + double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
|---|
| 7668 | 7721 | double sign = 1; |
|---|
| 7669 | 7722 | if (hScale < 0) |
|---|
| 7670 | 7723 | { |
|---|
| .. | .. |
|---|
| 7676 | 7729 | //hScale = 0.01; |
|---|
| 7677 | 7730 | } |
|---|
| 7678 | 7731 | |
|---|
| 7679 | | - double vScale = (double) (info.y - centerPt.y) / 32; |
|---|
| 7732 | + double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
|---|
| 7680 | 7733 | sign = 1; |
|---|
| 7681 | 7734 | if (vScale < 0) |
|---|
| 7682 | 7735 | { |
|---|
| .. | .. |
|---|
| 7687 | 7740 | { |
|---|
| 7688 | 7741 | //vScale = 0.01; |
|---|
| 7689 | 7742 | } |
|---|
| 7743 | + |
|---|
| 7690 | 7744 | LA.matCopy(startMat, toParent); |
|---|
| 7691 | 7745 | /**/ |
|---|
| 7692 | 7746 | for (int i = 0; i < 3; i++) |
|---|
| .. | .. |
|---|
| 7696 | 7750 | } |
|---|
| 7697 | 7751 | /**/ |
|---|
| 7698 | 7752 | |
|---|
| 7699 | | - double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / Math.sqrt(2); |
|---|
| 7753 | + double totalScale = Math.sqrt(hScale*hScale + vScale*vScale) / clickInfo.scale; |
|---|
| 7700 | 7754 | |
|---|
| 7701 | 7755 | if (totalScale < 0.01) |
|---|
| 7702 | 7756 | { |
|---|
| 7703 | 7757 | totalScale = 0.01; |
|---|
| 7704 | 7758 | } |
|---|
| 7705 | 7759 | |
|---|
| 7706 | | - switch (info.pane.RenderCamera().viewCode) |
|---|
| 7760 | + switch (clickInfo.pane.RenderCamera().viewCode) |
|---|
| 7707 | 7761 | { |
|---|
| 7708 | 7762 | case 3: // '\001' |
|---|
| 7709 | 7763 | if (modified || opposite) |
|---|
| .. | .. |
|---|
| 7770 | 7824 | } // NEW ... |
|---|
| 7771 | 7825 | |
|---|
| 7772 | 7826 | |
|---|
| 7773 | | - info.pane.repaint(); |
|---|
| 7827 | + clickInfo.pane.repaint(); |
|---|
| 7774 | 7828 | } |
|---|
| 7775 | 7829 | |
|---|
| 7776 | 7830 | boolean overflow = false; |
|---|
| .. | .. |
|---|
| 157 | 157 | Point prev = new Point(0, 0); |
|---|
| 158 | 158 | Point curr = new Point(0, 0); |
|---|
| 159 | 159 | Rectangle dummy = new Rectangle(); |
|---|
| 160 | | - calcHotSpot(sample, info, prev, dummy); |
|---|
| 160 | + calcHotSpot(sample, //info, |
|---|
| 161 | + prev, dummy); |
|---|
| 161 | 162 | for (double t = 0.1; t < 1.01; t += 0.1) |
|---|
| 162 | 163 | { |
|---|
| 163 | 164 | solve(t, a, b, c, d, sample); |
|---|
| 164 | | - calcHotSpot(sample, info, curr, dummy); |
|---|
| 165 | + calcHotSpot(sample, //info, |
|---|
| 166 | + curr, dummy); |
|---|
| 165 | 167 | info.g.drawLine(prev.x, prev.y, curr.x, curr.y); |
|---|
| 166 | 168 | info.g.drawLine(prev.x, prev.y + 1, curr.x, curr.y + 1); |
|---|
| 167 | 169 | info.g.drawLine(prev.x + 1, prev.y, curr.x + 1, curr.y); |
|---|
| .. | .. |
|---|
| 181 | 183 | for (int i=0; i < count; i++) |
|---|
| 182 | 184 | { |
|---|
| 183 | 185 | cVector p = (cVector)ctrlPnts.elementAt(i); |
|---|
| 184 | | - Rectangle spot = calcHotSpot(p, info); |
|---|
| 186 | + Rectangle spot = calcHotSpot(p); //, info); |
|---|
| 185 | 187 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
|---|
| 186 | 188 | } |
|---|
| 187 | 189 | |
|---|
| .. | .. |
|---|
| 197 | 199 | for (int i=0; i < nPoints; i++) |
|---|
| 198 | 200 | { |
|---|
| 199 | 201 | cVector p = (cVector)ctrlPnts.elementAt(i); |
|---|
| 200 | | - Rectangle r = calcHotSpot(p, info); |
|---|
| 202 | + Rectangle r = calcHotSpot(p); //, info); |
|---|
| 201 | 203 | if (r.contains(info.x, info.y)) |
|---|
| 202 | 204 | { |
|---|
| 203 | 205 | hitSomething = true; |
|---|
| .. | .. |
|---|
| 235 | 237 | for (double t = 0; t < 1.001; t += 0.01) |
|---|
| 236 | 238 | { |
|---|
| 237 | 239 | solve(t, a, b, c, d, sample); |
|---|
| 238 | | - calcHotSpot(sample, info, pnt, rect); |
|---|
| 240 | + calcHotSpot(sample, //info, |
|---|
| 241 | + pnt, rect); |
|---|
| 239 | 242 | if (!rect.contains(info.x, info.y)) |
|---|
| 240 | 243 | continue; |
|---|
| 241 | 244 | hitSomething = true; |
|---|
| .. | .. |
|---|
| 2 | 2 | |
|---|
| 3 | 3 | class Torus extends Biparam implements java.io.Serializable |
|---|
| 4 | 4 | { |
|---|
| 5 | | - //static final long serialVersionUID = -7637054329820073252L; |
|---|
| 5 | + static final long serialVersionUID = -7637054329820073252L; // Old |
|---|
| 6 | 6 | |
|---|
| 7 | 7 | Torus() |
|---|
| 8 | 8 | { |
|---|
| .. | .. |
|---|
| 64 | 64 | v = 0; |
|---|
| 65 | 65 | |
|---|
| 66 | 66 | double uAng = u * 2 * Math.PI; |
|---|
| 67 | | - double vAng = v * 2 * Math.PI; |
|---|
| 67 | + double vAng = -v * 2 * Math.PI; |
|---|
| 68 | 68 | double cosua = Math.cos(uAng); |
|---|
| 69 | 69 | double sinua = Math.sin(uAng); |
|---|
| 70 | 70 | double cosva = Math.cos(vAng); |
|---|
| .. | .. |
|---|
| 118 | 118 | return rad2 <= minor * minor; |
|---|
| 119 | 119 | } |
|---|
| 120 | 120 | |
|---|
| 121 | | - void drawEditHandles(ClickInfo info, int level) |
|---|
| 121 | + void drawEditHandles(//ClickInfo info, |
|---|
| 122 | + int level) |
|---|
| 122 | 123 | { |
|---|
| 123 | 124 | if (level == 0) |
|---|
| 124 | 125 | { |
|---|
| 125 | 126 | return; |
|---|
| 126 | 127 | } else |
|---|
| 127 | 128 | { |
|---|
| 128 | | - super.drawEditHandles(info, level); |
|---|
| 129 | + super.drawEditHandles(//info, |
|---|
| 130 | + level); |
|---|
| 129 | 131 | cVector temp = LA.newVector(0, 0, minor); |
|---|
| 130 | 132 | LA.xformPos(temp, toParent, temp); |
|---|
| 131 | | - Rectangle majorSpot = calcHotSpot(temp, info); |
|---|
| 133 | + Rectangle majorSpot = calcHotSpot(temp); //, info); |
|---|
| 132 | 134 | majorSpot.translate(4, 4); |
|---|
| 133 | 135 | temp.x = major; |
|---|
| 134 | 136 | temp.y = temp.z = 0; |
|---|
| 135 | 137 | LA.xformPos(temp, toParent, temp); |
|---|
| 136 | | - Rectangle minorSpot = calcHotSpot(temp, info); |
|---|
| 138 | + Rectangle minorSpot = calcHotSpot(temp); //, info); |
|---|
| 137 | 139 | minorSpot.translate(4, 4); |
|---|
| 138 | | - info.g.setColor(Color.green); |
|---|
| 139 | | - info.g.fillRect(majorSpot.x, majorSpot.y, majorSpot.width, majorSpot.height); |
|---|
| 140 | | - info.g.fillRect(minorSpot.x, minorSpot.y, minorSpot.width, minorSpot.height); |
|---|
| 140 | + clickInfo.g.setColor(Color.green); |
|---|
| 141 | + clickInfo.g.fillRect(majorSpot.x, majorSpot.y, majorSpot.width, majorSpot.height); |
|---|
| 142 | + clickInfo.g.fillRect(minorSpot.x, minorSpot.y, minorSpot.width, minorSpot.height); |
|---|
| 141 | 143 | return; |
|---|
| 142 | 144 | } |
|---|
| 143 | 145 | } |
|---|
| 144 | 146 | |
|---|
| 145 | | - boolean doEditClick(ClickInfo info, int level) |
|---|
| 147 | + boolean doEditClick(//ClickInfo info, |
|---|
| 148 | + int level) |
|---|
| 146 | 149 | { |
|---|
| 147 | 150 | if (level == 0) |
|---|
| 148 | 151 | return false; |
|---|
| 149 | 152 | hitSomething = 0; |
|---|
| 150 | | - if (super.doEditClick(info, level)) |
|---|
| 153 | + if (super.doEditClick(//info, |
|---|
| 154 | + level)) |
|---|
| 151 | 155 | { |
|---|
| 152 | 156 | hitSomething = 1; |
|---|
| 153 | 157 | return true; |
|---|
| 154 | 158 | } |
|---|
| 155 | 159 | cVector temp = LA.newVector(0, 0, minor); |
|---|
| 156 | 160 | LA.xformPos(temp, toParent, temp); |
|---|
| 157 | | - Rectangle majorSpot = calcHotSpot(temp, info); |
|---|
| 161 | + Rectangle majorSpot = calcHotSpot(temp); //, info); |
|---|
| 158 | 162 | majorSpot.translate(4, 4); |
|---|
| 159 | 163 | temp.x = major; |
|---|
| 160 | 164 | temp.y = temp.z = 0; |
|---|
| 161 | 165 | LA.xformPos(temp, toParent, temp); |
|---|
| 162 | | - Rectangle minorSpot = calcHotSpot(temp, info); |
|---|
| 166 | + Rectangle minorSpot = calcHotSpot(temp); //, info); |
|---|
| 163 | 167 | minorSpot.translate(4, 4); |
|---|
| 164 | | - if (majorSpot.contains(info.x, info.y)) |
|---|
| 168 | + if (majorSpot.contains(clickInfo.x, clickInfo.y)) |
|---|
| 165 | 169 | { |
|---|
| 166 | 170 | hitSomething = 2; |
|---|
| 167 | 171 | startRad = major; |
|---|
| 168 | 172 | } else |
|---|
| 169 | | - if (minorSpot.contains(info.x, info.y)) |
|---|
| 173 | + if (minorSpot.contains(clickInfo.x, clickInfo.y)) |
|---|
| 170 | 174 | { |
|---|
| 171 | 175 | hitSomething = 3; |
|---|
| 172 | 176 | startRad = minor; |
|---|
| .. | .. |
|---|
| 174 | 178 | { |
|---|
| 175 | 179 | return false; |
|---|
| 176 | 180 | } |
|---|
| 177 | | - startX = info.x; |
|---|
| 181 | + startX = clickInfo.x; |
|---|
| 178 | 182 | return true; |
|---|
| 179 | 183 | } |
|---|
| 180 | 184 | |
|---|
| 181 | | - void doEditDrag(ClickInfo info, boolean opposite) |
|---|
| 185 | + void doEditDrag(//ClickInfo info, |
|---|
| 186 | + boolean opposite) |
|---|
| 182 | 187 | { |
|---|
| 183 | 188 | if (hitSomething == 0) |
|---|
| 184 | 189 | return; |
|---|
| 185 | 190 | if (hitSomething == 1) |
|---|
| 186 | 191 | { |
|---|
| 187 | | - super.doEditDrag(info, opposite); |
|---|
| 192 | + super.doEditDrag(//info, |
|---|
| 193 | + opposite); |
|---|
| 188 | 194 | return; |
|---|
| 189 | 195 | } |
|---|
| 190 | | - double deltaR = info.x - startX; |
|---|
| 196 | + double deltaR = clickInfo.x - startX; |
|---|
| 191 | 197 | //cVector delta = LA.newVector(info.x - startX, 0, 0); |
|---|
| 192 | 198 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
|---|
| 193 | | - deltaR /= 100 * info.camera.SCALE / info.camera.Distance(); |
|---|
| 199 | + deltaR /= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
|---|
| 194 | 200 | double newRad = startRad + deltaR; |
|---|
| 195 | 201 | if (newRad < 0) |
|---|
| 196 | 202 | newRad = 0; |
|---|
| .. | .. |
|---|
| 199 | 205 | else |
|---|
| 200 | 206 | minor = newRad; |
|---|
| 201 | 207 | recalculate(); |
|---|
| 202 | | - info.pane.repaint(); |
|---|
| 208 | + clickInfo.pane.repaint(); |
|---|
| 203 | 209 | } |
|---|
| 204 | 210 | |
|---|
| 205 | 211 | double major; |
|---|