[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ExtrusionTool.java,1.1,1.2 MoveTool.ja
Status: Pre-Alpha
Brought to you by:
henryml
From: Jesper P. <je...@us...> - 2005-08-05 11:25:31
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4231 Modified Files: ExtrusionTool.java MoveTool.java Log Message: Disable check for button - bug in JRE/Linux Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MoveTool.java 5 Aug 2005 10:50:16 -0000 1.1 --- MoveTool.java 5 Aug 2005 11:25:18 -0000 1.2 *************** *** 37,90 **** */ protected void dragged(MouseEvent e) { ! if (e.getButton() == MouseEvent.BUTTON1) { ! if (selectedVertex != null) { ! int x = e.getX(); ! int y = e.getY(); ! View view = glv.getView(); ! double[] coords = view.toCanvasCoords(new double[]{x, y}); ! coords = snapToGrid(coords); ! updateVertex(selectedVertex, coords); ! } else if (selectedSurface != null) { ! View view = glv.getView(); ! int x = e.getX(); ! int y = e.getY(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{pressPos[0], pressPos[1]}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! List l = Util.traverse(selectedSurface); ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! coordsa = new double[] {v.getX() + delta[0], ! v.getY() + delta[1], ! v.getZ() + delta[2]}; ! updateVertex(v, coordsa); ! } ! } else if (selectedEdge != null) { ! View view = glv.getView(); ! int x = e.getX(); ! int y = e.getY(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{pressPos[0], pressPos[1]}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! Vertex to = selectedEdge.getTo(); ! Vertex from = selectedEdge.getFrom(); ! ! coordsa = new double[] {to.getX() + delta[0], ! to.getY() + delta[1], ! to.getZ() + delta[2]}; ! updateVertex(to, coordsa); ! coordsa = new double[] {from.getX() + delta[0], ! from.getY() + delta[1], ! from.getZ() + delta[2]}; ! updateVertex(from, coordsa); } ! pressPos[0] = e.getX(); ! pressPos[1] = e.getY(); } } } --- 37,88 ---- */ protected void dragged(MouseEvent e) { ! if (selectedVertex != null) { ! int x = e.getX(); ! int y = e.getY(); ! View view = glv.getView(); ! double[] coords = view.toCanvasCoords(new double[]{x, y}); ! coords = snapToGrid(coords); ! updateVertex(selectedVertex, coords); ! } else if (selectedSurface != null) { ! View view = glv.getView(); ! int x = e.getX(); ! int y = e.getY(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{pressPos[0], pressPos[1]}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! List l = Util.traverse(selectedSurface); ! for (int i = 0; i < l.size(); i++) { ! Vertex v = (Vertex)l.get(i); ! coordsa = new double[] {v.getX() + delta[0], ! v.getY() + delta[1], ! v.getZ() + delta[2]}; ! updateVertex(v, coordsa); } ! } else if (selectedEdge != null) { ! View view = glv.getView(); ! int x = e.getX(); ! int y = e.getY(); ! double[] coordsa = view.toCanvasCoords(new double[]{x, y}); ! double[] coordsb = view.toCanvasCoords(new double[]{pressPos[0], pressPos[1]}); ! double[] delta = new double[] {coordsa[0] - coordsb[0], ! coordsa[1] - coordsb[1], ! coordsa[2] - coordsb[2]}; ! Vertex to = selectedEdge.getTo(); ! Vertex from = selectedEdge.getFrom(); ! ! coordsa = new double[] {to.getX() + delta[0], ! to.getY() + delta[1], ! to.getZ() + delta[2]}; ! updateVertex(to, coordsa); ! coordsa = new double[] {from.getX() + delta[0], ! from.getY() + delta[1], ! from.getZ() + delta[2]}; ! updateVertex(from, coordsa); } + pressPos[0] = e.getX(); + pressPos[1] = e.getY(); } } Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExtrusionTool.java 5 Aug 2005 10:50:16 -0000 1.1 --- ExtrusionTool.java 5 Aug 2005 11:25:18 -0000 1.2 *************** *** 47,74 **** */ protected void dragged(MouseEvent e) { ! if (e.getButton() == MouseEvent.BUTTON1) { ! if (selectedSurface != null) { ! if (!selectedSurface.equals(dragSurface)) { ! if (isExtrudeable(selectedSurface)) { ! dragSurface = selectedSurface; ! } else { ! dragSurface = null; ! createExtension(); ! } ! } ! if (dragSurface != null) { ! Vertex normal = dragSurface.normal(); ! if (normal != null) { ! double[] second = glv.getView().toCanvasCoords(new double[] {e.getX(), e.getY()}); ! normal.scale(1 / normal.length()); ! Vertex proj = dragSurface.projection(second); ! ! List l = Util.traverse(dragSurface); ! for (int count = 0; l != null && count < l.size(); count++) { ! Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + proj.getX(), ! v.getY() + proj.getY(), ! v.getZ() + proj.getZ()}); ! } } } --- 47,72 ---- */ protected void dragged(MouseEvent e) { ! if (selectedSurface != null) { ! if (!selectedSurface.equals(dragSurface)) { ! if (isExtrudeable(selectedSurface)) { ! dragSurface = selectedSurface; ! } else { ! dragSurface = null; ! createExtension(); ! } ! } ! if (dragSurface != null) { ! Vertex normal = dragSurface.normal(); ! if (normal != null) { ! double[] second = glv.getView().toCanvasCoords(new double[] {e.getX(), e.getY()}); ! normal.scale(1 / normal.length()); ! Vertex proj = dragSurface.projection(second); ! ! List l = Util.traverse(dragSurface); ! for (int count = 0; l != null && count < l.size(); count++) { ! Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + proj.getX(), ! v.getY() + proj.getY(), ! v.getZ() + proj.getZ()}); } } |