Code review comment for lp:~nick-dedekind/unity8/expanded-panel-design

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> > > In qml/Panel/PanelVelocityCalculator.qml:
> > >
> > > It looks like every time the velocityTimer is triggered, the velocity is
> > being
> > > calculated twice (stopLateralChanges being updated twice).
> > >
> > > """
> > > 2418 + calc.trackedPosition = trackedValue;
> > > 2419 + root.stopLateralChanges = Math.abs(calc.calculate()) >
> > > velocityThreashold;
> > > """
> > >
> > > Line 2418 will trigger calc.onTrackedPositionChanged() which does the same
> > as
> > > line 2419.
> >
> > Yes, but it's required since we need to do the calculation even if
> > onTrackedPositionChanged doesnt change (for decrease in velocity). I've put
> in
> > a check a guard only to do the recalc in the timer if the trackedPosition
> > doesn't change.
>
> Ahhh... now I got it, might make sense then to stick to updating the velocity
> every 50ms, ie only on the timer, instead of both due to timer timeout and due
> to tracked value change, to be consistent. Will hopefully simplify the code as
> well.

Ok, I've moved everything into a update function.
I've also improved performance by only starting the timer if tracked, and only emitting the threshold signal if it was previously in "stopped mode".

>
> Also it seems this timer is always running. You don't seem to ever stop it?

« Back to merge proposal