Hi All,
I am trying to drag the Rectangle in SVGCanvas. If I do it slowly, it is
working smoothly. But in case of faster dragging, it is not moving properly. I
have also referred http://wiki.apache.org/xmlgraphics-batik/DragTutorial for
mouse dragging. But it is not working. I have attached my sample code for your
reference.
private class OnMoveAction implements EventListener {
public void handleEvent(Event evt) {
if (actionNode == null)return;
dragged = true;
DOMMouseEvent elEvt = (DOMMouseEvent)evt;
int nowToX = elEvt.getClientX();
int nowToY = elEvt.getClientY();
SVGDocument svgDocument = svgCanvas.getSVGDocument();
SVGPoint trans = svgDocument.getRootElement().getCurrentTranslate();
float scale = svgDocument.getRootElement().getCurrentScale();
nowToX = (int)((nowToX - trans.getX()) / scale);
nowToY = (int)((nowToY - trans.getY()) / scale);
if (action == DRAG) {
((Element)actionNode).setAttribute("x", "" + (nowToX - dx));
((Element)actionNode).setAttribute("y", "" + (nowToY - dy));
}
}
Please give me the better solution for dragging the SVG elements in SVGCanvas.
Thanks,
Selva
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]