Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Coordinate of drop event relative to Figure
Coordinate of drop event relative to Figure [message #231940] Wed, 21 March 2007 10:45 Go to next message
Eclipse UserFriend
Originally posted by: michele.l.evinco.it

i try to drop an item from a view into mygefeditor where there is a
Figure that have the same dimension of the editor and have a XYLayout as
LauoutManager.
When the drop operation end i draw a new Figure as child of background
Figure at the drop coordinate.
My problem is that the coordinate aren't relative to background Figure
so i draw the new Figure in a wrong position.

I get the coordinate from
TemplateTransferDropTargetListener.drop(DropTargetEvent arg0)

then on the refreshVisual method of EditPart relative to background
Figure i try to translate these coordinate to background Figure relative
coordinate with the methods getFigure().translateToRelative(newDrawFigure);

the class of newDrawFigure implements Translatable and i've implemented
this method :

public void performTranslate(int arg0, int arg1) {
setLocation(new Point(arg0,arg1));

}

but when this method is call by translateToRelative the arguments arg0
and arg1 are always 0 so the figure doesn't move to relative coordinates.
I've tryed with translateToAbsolute but the result is always the same.
With traslateToParent and traslateFromParent the preformTranslate is
never called.

My way to determinate the relative coordinate is correct?

Where i wrong?

Thanks
Michele
Re: Coordinate of drop event relative to Figure [message #231964 is a reply to message #231940] Wed, 21 March 2007 13:21 Go to previous message
Eclipse UserFriend
Originally posted by: michele.l.evinco.it

I find the solution i use getDropLocation in
TemplateTransferDropTargetListener

michele wrote:
> i try to drop an item from a view into mygefeditor where there is a
> Figure that have the same dimension of the editor and have a XYLayout as
> LauoutManager.
> When the drop operation end i draw a new Figure as child of background
> Figure at the drop coordinate.
> My problem is that the coordinate aren't relative to background Figure
> so i draw the new Figure in a wrong position.
>
> I get the coordinate from
> TemplateTransferDropTargetListener.drop(DropTargetEvent arg0)
>
> then on the refreshVisual method of EditPart relative to background
> Figure i try to translate these coordinate to background Figure relative
> coordinate with the methods getFigure().translateToRelative(newDrawFigure);
>
> the class of newDrawFigure implements Translatable and i've implemented
> this method :
>
> public void performTranslate(int arg0, int arg1) {
> setLocation(new Point(arg0,arg1));
>
> }
>
> but when this method is call by translateToRelative the arguments arg0
> and arg1 are always 0 so the figure doesn't move to relative coordinates.
> I've tryed with translateToAbsolute but the result is always the same.
> With traslateToParent and traslateFromParent the preformTranslate is
> never called.
>
> My way to determinate the relative coordinate is correct?
>
> Where i wrong?
>
> Thanks
> Michele
Previous Topic:How to fix problem with draging edit parts
Next Topic:Zooming in one direction
Goto Forum:
  


Current Time: Sat Dec 16 18:55:47 GMT 2017

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

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