Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool MoveTool.java,1.37,1.38
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2006-02-16 20:58:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22141/tool Modified Files: MoveTool.java Log Message: Experimenting with having to press shift first when selecting. Added check to see if slide-edges are parrallel to the moved edge in the controlled move-mode Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** MoveTool.java 15 Feb 2006 11:26:35 -0000 1.37 --- MoveTool.java 16 Feb 2006 20:58:14 -0000 1.38 *************** *** 118,122 **** /** ! * Updat selection * */ --- 118,122 ---- /** ! * Update selection * */ *************** *** 136,139 **** --- 136,140 ---- Project.getInstance().changed(vertices); } + /** * Invoked when a mouse button has been pressed on a component. *************** *** 142,167 **** protected void pressed(MouseEvent e) { findTarget(e); ! clearConstructors(moveConstructors); ! if (target != null) { ! if (moveMode != THREE_CLICK) { ! super.pressed(e); ! initial = findInitial(target, e); ! from = initial.copy(); ! ! setupConstructors(); ! displayConstructors(moveConstructors); ! ! vertices = new HashSet(); ! moveEntities = selection; ! collect(selection, vertices); ! if (moveMode == CONTROLLED) { ! if (target instanceof Edge) { ! controlled = (Edge)target; ! } else { ! log.warn("Controlled move only works with edges"); } } - } else { - threeClickMove(e); } } --- 143,172 ---- protected void pressed(MouseEvent e) { findTarget(e); ! if (e.isShiftDown()) { ! super.pressed(e); ! } else { ! clearConstructors(moveConstructors); ! if (target != null) { ! if (moveMode != THREE_CLICK) { ! //super.pressed(e); ! initial = findInitial(target, e); ! from = initial.copy(); ! ! setupConstructors(); ! displayConstructors(moveConstructors); ! ! vertices = new HashSet(); ! moveEntities = selection; ! collect(selection, vertices); ! if (moveMode == CONTROLLED) { ! if (target instanceof Edge) { ! controlled = (Edge)target; ! } else { ! log.warn("Controlled move only works with edges"); ! } } + } else { + threeClickMove(e); } } } *************** *** 458,461 **** --- 463,471 ---- glv.getView().makeTarget(target); dragPlane = targetSurface.plane(); + Vertex controlledDir = controlled.getDirection(); + Vertex surfaceNormal = targetSurface.normal(); + restrictionVector = controlledDir.cross(surfaceNormal); + restrictionVector.scale(1 / restrictionVector.length()); + List edges = targetSurface.getEdges(); int index = edges.indexOf(controlled); *************** *** 472,491 **** rightEdge = (Edge)edges.get(index + 1); } ! Vertex to = controlled.getTo(); ! Vertex from = controlled.getFrom(); ! if (to.getEdges().contains(leftEdge) && ! from.getEdges().contains(rightEdge)) { ! toSlideEdge = leftEdge; ! fromSlideEdge = rightEdge; ! } else if (from.getEdges().contains(leftEdge) && ! to.getEdges().contains(rightEdge)) { ! fromSlideEdge = leftEdge; ! toSlideEdge = rightEdge; } - - Vertex edgeDirection = controlled.getTo().minus(controlled.getFrom()); - Vertex surfaceNormal = targetSurface.normal(); - restrictionVector = edgeDirection.cross(surfaceNormal); - restrictionVector.scale(1 / restrictionVector.length()); } } --- 482,503 ---- rightEdge = (Edge)edges.get(index + 1); } ! if (controlledDir.cross(leftEdge.getDirection()).length() > 0.00001 && ! controlledDir.cross(rightEdge.getDirection()).length() > 0.00001) { ! Vertex to = controlled.getTo(); ! Vertex from = controlled.getFrom(); ! if (to.getEdges().contains(leftEdge) && ! from.getEdges().contains(rightEdge)) { ! toSlideEdge = leftEdge; ! fromSlideEdge = rightEdge; ! } else if (from.getEdges().contains(leftEdge) && ! to.getEdges().contains(rightEdge)) { ! fromSlideEdge = leftEdge; ! toSlideEdge = rightEdge; ! } ! } else { ! dragPlane = null; ! restrictionVector = null; ! log.warn("This edge is bound"); } } } |