flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Javier Guerrero García <javi...@gmail.com>
Subject Re: Get mouse coordinates on high speed
Date Thu, 06 Oct 2016 08:38:48 GMT
And don't forget <mx:application frameRate="60"> :)

On Thu, Oct 6, 2016 at 10:24 AM, Maxim Solodovnik <solomax666@gmail.com>
wrote:

> >> Another possibility: don't attach the events to the stage, but to the
> "area" object instead.
> Maybe I'm doing something wrong, but this is what I have started from,
> and it completely not working in my quickstart app
>
> will try "screenRedraw", we'll see it will allow more precise coordinates
> :)
>
> On Thu, Oct 6, 2016 at 3:21 PM, Javier Guerrero García
> <javi.gg@gmail.com> wrote:
> > And the 60fps? :)
> >
> > Also, try this: attach ALWAYS the mousemove event listener (even directly
> > on MXML) instead of attaching it "on demand", and make mouseDown and
> > mouseUp just set a "capturing" variable to either true of false.
> >
> > Another possibility: don't attach the events to the stage, but to the
> > "area" object instead.
> >
> > Another one: IIRC, there was a "screenRedraw" event, triggering right
> after
> > each frame is painted (30-60 times per sec). You could attach the
> capturing
> > function directly to that event, just checking if the "capturing"
> variable
> > is true or false before proceed with the points.push.
> >
> > On Thu, Oct 6, 2016 at 10:03 AM, Maxim Solodovnik <solomax666@gmail.com>
> > wrote:
> >
> >> I tried to change the code as follows
> >> grab points in event handler [1], then actually draw it after
> >> capturing is over [2]
> >> The result curve is not smooth in case of fast, long distance moves
> >>
> >> [1] https://github.com/solomax/FlexSandbox/blob/master/web/
> >> src/Main1.mxml#L37
> >> [2] https://github.com/solomax/FlexSandbox/blob/master/web/
> >> src/Main1.mxml#L31
> >>
> >> On Thu, Oct 6, 2016 at 2:37 PM, Javier Guerrero García
> >> <javi.gg@gmail.com> wrote:
> >> > Yes, I understood, but you can do it in many ways:
> >> >
> >> >    - Capture mouse coordinates, and draw the new pixel on a bitmap
> placed
> >> >    underneath
> >> >    - Capture mouse coordinates, and draw a new <Line> object from
the
> >> last
> >> >    captured point to the new coordinates, and so on
> >> >    - Capture mouse coordinates, and perfom a graphics.lineTo on a
> Sprite
> >> on
> >> >    each mouse move (a one liner for a one liner :)
> >> >
> >> > I think the vector approach should perform better on redraws, and I
> >> really
> >> > do think your problem is right there on the fullscreen redraws: 60fps
> or
> >> > even 30fps should be more than enough to capture a signature.
> >> >
> >> > To confirm first, try first separating the areas, and see it that
> makes
> >> it
> >> > smoother :)
> >> >
> >> > On Thu, Oct 6, 2016 at 9:27 AM, Maxim Solodovnik <
> solomax666@gmail.com>
> >> > wrote:
> >> >
> >> >> It sort of "pencil drawing" by mouse/pen
> >> >> I'll try to capture points and draw it later(or better in separated
> >> thread)
> >> >>
> >> >> Thanks for the pointer
> >> >>
> >> >> On Thu, Oct 6, 2016 at 2:23 PM, Javier Guerrero García
> >> >> <javi.gg@gmail.com> wrote:
> >> >> > Hi Maxim!
> >> >> >
> >> >> > Are you capturing the points on line objects, or on a bitmap drawn
> at
> >> the
> >> >> > bottom that has to be interpolated and redrawn on every mouse
> >> movement?
> >> >> Try
> >> >> > separating the capture and paint areas, capturing line objects
> >> instead of
> >> >> > pixels on a bitmap, or at least draw the bitmap with the lowest
> >> posible
> >> >> > interpolation quality, to see if it helps.
> >> >> >
> >> >> > Hope it works :)
> >> >> >
> >> >> > On Thu, Oct 6, 2016 at 5:49 AM, Maxim Solodovnik <
> >> solomax666@gmail.com>
> >> >> > wrote:
> >> >> >
> >> >> >> changing FPS to 60 doesn't help :( (originally it was 30)
> >> >> >> Final code for capturing events and drawing is the same as
> prototype
> >> >> code
> >> >> >> still got ugly, non-smooth curve in case mouse moving very
fast
> >> >> >>
> >> >> >> Line in much smoother in Gimp
> >> >> >> In fact Flex desktop app produces smooth enough line
> >> >> >> will try to create browser quick start and double check
> >> >> >>
> >> >> >> On Thu, Oct 6, 2016 at 9:18 AM, Maxim Solodovnik <
> >> solomax666@gmail.com>
> >> >> >> wrote:
> >> >> >> > Hello,
> >> >> >> >
> >> >> >> > Thanks a lot for the quick answers, definitely flex is
one of my
> >> >> >> > favorite communities :)
> >> >> >> > Here is example project: https://github.com/solomax/FlexSandbox
> >> >> >> > since it is desktop and tiny it looks not that bad
> >> >> >> > In my main project the resulting line is not smooth at
all :(
> >> >> >> >
> >> >> >> > I'll try to check the code and remove any delays, thanks
for the
> >> >> pointer.
> >> >> >> >
> >> >> >> > Additionally I'll try to check FFT, I have tried to add
> additional
> >> >> >> > points and use cubicCurveTo, but was unable to finish
this (it
> is
> >> >> >> > currently commented)
> >> >> >> >
> >> >> >> > On Thu, Oct 6, 2016 at 1:47 AM, OK <post@olafkrueger.net>
> wrote:
> >> >> >> >> Alex Harui wrote
> >> >> >> >>>>can't you just up the frame per second of
the swf to say 60,
> and
> >> if
> >> >> >> >>>>needed interpolate data points to smooth it?
> >> >> >> >>> That is a possibility, but the interpolation
code may also
> affect
> >> >> input
> >> >> >> >>> rate.
> >> >> >> >>
> >> >> >> >> For this approach it might be helpful to google with
"spline
> >> >> >> interpolation"
> >> >> >> >> and "FFT" (Fast Fourier Transformation). Maybe you
find some
> >> ready to
> >> >> >> use
> >> >> >> >> AS3 implementations.
> >> >> >> >>
> >> >> >> >> Olaf
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context: http://apache-flex-users.
> >> >> >> 2333346.n4.nabble.com/Get-mouse-coordinates-on-high-
> >> >> >> speed-tp13737p13748.html
> >> >> >> >> Sent from the Apache Flex Users mailing list archive
at
> >> Nabble.com.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> > WBR
> >> >> >> > Maxim aka solomax
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> WBR
> >> >> >> Maxim aka solomax
> >> >> >>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> WBR
> >> >> Maxim aka solomax
> >> >>
> >>
> >>
> >>
> >> --
> >> WBR
> >> Maxim aka solomax
> >>
>
>
>
> --
> WBR
> Maxim aka solomax
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message