Hello ! I'm attempt to write graphics WISIWIG editor that can create figures in real scale . Ie if section have original width 1000.789 millimeters then on screen it have width 10.00789 mm at scale 0.01 (100:1). I know that i be able to use AffineTransform to convert user space coordinates to device space . But events on draw surface (i use JPanel) generate only int values of it coordinates. I attempt to fix this by convert MouseEvent to ScaledMouseEvent : class Surface extends JPanel implements MouseListener,MouseMotionListener { //cached transform AffineTransform at;
... public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); AffineTransform old = g2.getTransform(); g2.transform(at); figures.draw(g); g2.setTransform(old); } public void mousePressed(MouseEvent e){ //use cached transform Point2D p=at.inversTransform(e.getPoint(),null); ScaledMouseEvent se=new ScaledMouseEvent(this, e.getID(), e.getWhen(), e.getModifiers(), p.getX(), p.getY(), e.getClickCount(), e.isPopupTrigger()); ... } public void mouseDragged(MouseEvent e){ //use cached transform Point2D p=at.inversTransform(e.getPoint(),null); ScaledMouseEvent se=new ScaledMouseEvent(this, e.getID(), e.getWhen(), e.getModifiers(), p.getX(), p.getY(), e.getClickCount(), e.isPopupTrigger()); ... } ... } But then i drag figures along screen theirs outline and corner handles "diddes" and derived event coordinates step by 1/scale . Can anyone help me to avoid this ? -- Best regards, Andrey mailto:[EMAIL PROTECTED] =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".