OK, here's what I changed to in order to get the right coordinates in the MouseMove event:
DOMMouseEvent elementEvent = (DOMMouseEvent) event; int dragMoveX = elementEvent.getClientX(); int dragMoveY = elementEvent.getClientY(); SVGOMPoint point = new SVGOMPoint(dragMoveX, dragMoveY); Node node = ((Node) event.getTarget()).getParentNode(); SVGMatrix matrix = ((SVGLocatable) node).getScreenCTM(); matrix = matrix.inverse(); SVGOMPoint dragPoint = (SVGOMPoint) point.matrixTransform(matrix); Element targetElement = DragStatus.getSelectedElement(); I still have the mouse being able to get "out" of the element. Again, I still get motion on the element, but it becomes further and further out of sync with the mouse. > Ahh, this is your bug, right now you are essentially killing every other > mouse move delta, Are you saying I should be appending a new translate for each delta? I thought incrementing an existing translate would essentially end up being translated by deltaX, deltaY from mouse press to mouse release. Michael Bishop -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, October 27, 2005 10:49 AM To: [email protected] Cc: [email protected] Subject: RE: Weird problem using translations. Hi Michael, "Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on 10/27/2005 09:22:39 AM: > Not quite what I'm doing. After I calculate the deltas between > mouse moves, I add to the original translate values, I don't add new > translate attributes. > > I am not adding translate values, I'm adding TO the existing translate > value. I had originally set the translate based on the delta from where > the mouse was originally pressed to "now", but I got some really weird > behavior where the element would "jump" back to its original position > every other mouse event. Ahh, this is your bug, right now you are essentially killing every other mouse move delta, going back to your earlier message I notice: > > - I transform the coordinates in my MouseMove event by getting the > > client X/Y from the DOMMouseEvent, creating an SVGOMPoint, and > > inverting the matrix from the event.getTarget().getScreenCTM(). This is the problem, the getScreenCTM for target will include the 'update' to the transform, which generally you don't want. You probably want to do something like: Node n = event.getTarget().getParentNode(); SVGMatrix mat = ((SVGLocatable)n).getScreenCTM(); I suspect this will fix all your problems (with either way of doing things). --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
