Skip to main content



      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 06: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 09: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:Ruler with different units
Next Topic:Lock down the GraphicalEditor to prevent editing?
Goto Forum:
  


Current Time: Sun May 11 14:22:05 EDT 2025

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

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

Back to the top