Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » ScaledGraphics : problem with Zoom
ScaledGraphics : problem with Zoom [message #236372] Wed, 27 June 2007 01:05 Go to next message
Eclipse UserFriend
Originally posted by: ben.tiscali.fr

Hi guys,

I have a problem with my source code. I can't write the whole code source
here cause 1)the code is very specific to my data, 2)my boss don't want to
:p

So i have a SystemeFigure class :
public class SystemeFigure extends Figure implements java.io.Serializable{

....

}

in which i put some kind of Shape (Rectangle or Ellipse).
I'm also able to move these shapes, or to detect when the mouse come in
(the "selected shape" change colour, and a tooltip appears).
It works well.

Now i'm trying to setup a zoom in order to scale the shapes. So i
redefined the method called paintClientArea (I have found this solution on
a website).

protected void paintClientArea(Graphics graphics) {

if (getChildren().isEmpty())
return;

boolean optimizeClip = getBorder() == null || getBorder().isOpaque();

ScaledGraphics g = new ScaledGraphics(graphics);


if (!optimizeClip)
g.clipRect(getBounds().getCropped(getInsets()));
g.translate(getBounds().x + getInsets().left, getBounds().y +
getInsets().top);
g.scale(zoom);
g.pushState();
paintChildren(g);

g.popState();
g.dispose();
graphics.restoreState();

}

It's almost work : when i click on ZoomIn or ZoomOut button, the size of
shapes increase (or decrase). But i can't anymore move them. The position
seems to be the same whereas it's not the same place (cause of zoom) at
screen. ToolTip confirm : they appears at the old position of the shape.

Any ideas ?

ps : sorry for my english
Re: ScaledGraphics : problem with Zoom [message #237482 is a reply to message #236372] Thu, 02 August 2007 13:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ben00ze.gmail.com

Still can't figure how to solve this ....
Do someone have a tutorial or source code about this ?
Re: ScaledGraphics : problem with Zoom [message #237523 is a reply to message #237482] Fri, 03 August 2007 11:16 Go to previous message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
Have a look on the ZoomExample.java in org.eclipse.draw2d.examples.zoom,
it is very helpful

Manuel


Previous Topic:Use of Draw2d, outside Eclipse
Next Topic:MultiPageEditorPart Graphicaleditor + CodeEditor
Goto Forum:
  


Current Time: Thu Apr 18 08:04:38 GMT 2024

Powered by FUDForum. Page generated in 0.01999 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top