Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » moving an extended draw2d-figure with mouse
moving an extended draw2d-figure with mouse [message #235190] Wed, 06 June 2007 14:25 Go to next message
Eclipse UserFriend
Originally posted by: Markus.Voss.post.rwth-aachen.de

Hi,

I created my own figure by extending the draw2d-figure-class and put an
instance of that on a FigureCanvas.

Now I want to move the figure on the canvas when the mouse is pressed on the
figure and moved. Therefore I added a MouseMotionListener to my extended
figure instance, calling the setLocation(...)-method of my figure instance
from within the mouseDragged(...)-method of the implementation of the
MouseMotionListener.

This works so far, but the movements are very jerky and slow! Does anyone
now how to make it behave more fluent? Is my approach bad, or is there
something I can do to improve it???

Best regards,

Markus
Re: moving an extended draw2d-figure with mouse [message #235292 is a reply to message #235190] Fri, 08 June 2007 01:44 Go to previous messageGo to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

If you move your figure on each mouse drag and the movement looks jerky
try to introduce a tolerance value for mouse drag, i.e. if you drag over
5-10 pixels along x or y axis then move the figure.

Cheers,
Alex
Re: moving an extended draw2d-figure with mouse [message #235400 is a reply to message #235292] Mon, 11 June 2007 20:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Markus.Voss.post.rwth-aachen.de

Thanks, but...

.... with the tolerance window its not jerky for an unknown reason, but jerky
due to the implementation... then the figure jumps in steps of the tolerance
window...

Therefore, not really what I was looking for. Another thing that I observed
is that the first few, say 5, seconds it is quite ok, but after that it
starts getting more and more jerky... the code is not very much... I do not
really see a reason for that behaviour...

Any more suggestions?




"Alex Boyko" <aboyko@ca.ibm.com> schrieb im Newsbeitrag

news:4030ac88120772a00fcf8edd711f643a$1@www.eclipse.org...
> Hi,
>
> If you move your figure on each mouse drag and the movement looks jerky
> try to introduce a tolerance value for mouse drag, i.e. if you drag over
> 5-10 pixels along x or y axis then move the figure.
>
> Cheers,
> Alex
>
Re: moving an extended draw2d-figure with mouse [message #235428 is a reply to message #235400] Tue, 12 June 2007 14:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

There is a draw2d.examples project in CVS. See the FAQ for how to load it.

"Markus Voss" <Markus.Voss@post.rwth-aachen.de> wrote in message
news:f4kaee$734$1@build.eclipse.org...
> Thanks, but...
>
> ... with the tolerance window its not jerky for an unknown reason, but
> jerky
> due to the implementation... then the figure jumps in steps of the
> tolerance
> window...
>
> Therefore, not really what I was looking for. Another thing that I
> observed
> is that the first few, say 5, seconds it is quite ok, but after that it
> starts getting more and more jerky... the code is not very much... I do
> not
> really see a reason for that behaviour...
>
> Any more suggestions?
>
>
>
>
> "Alex Boyko" <aboyko@ca.ibm.com> schrieb im Newsbeitrag
>
> news:4030ac88120772a00fcf8edd711f643a$1@www.eclipse.org...
>> Hi,
>>
>> If you move your figure on each mouse drag and the movement looks jerky
>> try to introduce a tolerance value for mouse drag, i.e. if you drag over
>> 5-10 pixels along x or y axis then move the figure.
>>
>> Cheers,
>> Alex
>>
>
>
Re: moving an extended draw2d-figure with mouse [message #235492 is a reply to message #235428] Tue, 12 June 2007 16:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Markus.Voss.post.rwth-aachen.de

I know the draw2d.examples and draw2d.tests...

Unfortunately none is covering my problem...


"Randy Hudson" <none@ibm.com> schrieb im Newsbeitrag
news:f4mbf6$e8g$1@build.eclipse.org...
> There is a draw2d.examples project in CVS. See the FAQ for how to load it.
>
> "Markus Voss" <Markus.Voss@post.rwth-aachen.de> wrote in message
> news:f4kaee$734$1@build.eclipse.org...
> > Thanks, but...
> >
> > ... with the tolerance window its not jerky for an unknown reason, but
> > jerky
> > due to the implementation... then the figure jumps in steps of the
> > tolerance
> > window...
> >
> > Therefore, not really what I was looking for. Another thing that I
> > observed
> > is that the first few, say 5, seconds it is quite ok, but after that it
> > starts getting more and more jerky... the code is not very much... I do
> > not
> > really see a reason for that behaviour...
> >
> > Any more suggestions?
> >
> >
> >
> >
> > "Alex Boyko" <aboyko@ca.ibm.com> schrieb im Newsbeitrag
> >
> > news:4030ac88120772a00fcf8edd711f643a$1@www.eclipse.org...
> >> Hi,
> >>
> >> If you move your figure on each mouse drag and the movement looks jerky
> >> try to introduce a tolerance value for mouse drag, i.e. if you drag
over
> >> 5-10 pixels along x or y axis then move the figure.
> >>
> >> Cheers,
> >> Alex
> >>
> >
> >
>
>
Re: moving an extended draw2d-figure with mouse [message #235622 is a reply to message #235492] Wed, 13 June 2007 16:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Markus.Voss.post.rwth-aachen.de

Ok, I found a solution, although I am not convinced by this solution. For my
Figure I do not use the paint(graphics g)-method and therefore did not
override it.

Now, when I override the paint(graphics g)-method with an empty
implementation, my figure still moves jerky. But when I add something
calling a method on "g", then my figure moves fluently. E.g. I set the
backgroundColor to blue, calling

g.setBackgroundColor(new Color(...));



This does not appear on the screen, as my figure is created as child
consisting of more children to the parent figure, all children of type
IFigure. Therefore the painting on "g" does not appear.


Very strange...

Best regards,

Markus


"Markus Voss" <Markus.Voss@post.rwth-aachen.de> schrieb im Newsbeitrag
news:f4mgl6$8g1$1@build.eclipse.org...
> I know the draw2d.examples and draw2d.tests...
>
> Unfortunately none is covering my problem...
>
>
> "Randy Hudson" <none@ibm.com> schrieb im Newsbeitrag
> news:f4mbf6$e8g$1@build.eclipse.org...
> > There is a draw2d.examples project in CVS. See the FAQ for how to load
it.
> >
> > "Markus Voss" <Markus.Voss@post.rwth-aachen.de> wrote in message
> > news:f4kaee$734$1@build.eclipse.org...
> > > Thanks, but...
> > >
> > > ... with the tolerance window its not jerky for an unknown reason, but
> > > jerky
> > > due to the implementation... then the figure jumps in steps of the
> > > tolerance
> > > window...
> > >
> > > Therefore, not really what I was looking for. Another thing that I
> > > observed
> > > is that the first few, say 5, seconds it is quite ok, but after that
it
> > > starts getting more and more jerky... the code is not very much... I
do
> > > not
> > > really see a reason for that behaviour...
> > >
> > > Any more suggestions?
> > >
> > >
> > >
> > >
> > > "Alex Boyko" <aboyko@ca.ibm.com> schrieb im Newsbeitrag
> > >
> > > news:4030ac88120772a00fcf8edd711f643a$1@www.eclipse.org...
> > >> Hi,
> > >>
> > >> If you move your figure on each mouse drag and the movement looks
jerky
> > >> try to introduce a tolerance value for mouse drag, i.e. if you drag
> over
> > >> 5-10 pixels along x or y axis then move the figure.
> > >>
> > >> Cheers,
> > >> Alex
> > >>
> > >
> > >
> >
> >
>
>
Re: moving an extended draw2d-figure with mouse [message #235937 is a reply to message #235622] Tue, 19 June 2007 00:12 Go to previous message
Eclipse UserFriend
Originally posted by: none.ibm.com

Please attach a snippet or some code.

"Markus Voss" <Markus.Voss@post.rwth-aachen.de> wrote in message
news:f4p5q0$hm9$1@build.eclipse.org...
> Ok, I found a solution, although I am not convinced by this solution. For
> my
> Figure I do not use the paint(graphics g)-method and therefore did not
> override it.
>
> Now, when I override the paint(graphics g)-method with an empty
> implementation, my figure still moves jerky. But when I add something
> calling a method on "g", then my figure moves fluently. E.g. I set the
> backgroundColor to blue, calling
>
> g.setBackgroundColor(new Color(...));
>
>
>
> This does not appear on the screen, as my figure is created as child
> consisting of more children to the parent figure, all children of type
> IFigure. Therefore the painting on "g" does not appear.
>
>
> Very strange...
>
> Best regards,
>
> Markus
>
Previous Topic:deployment descriptor user-interface for web.xml
Next Topic:Is GEF suitable for this use case?
Goto Forum:
  


Current Time: Sat Aug 13 00:40:02 GMT 2022

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

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

Back to the top