December 2018
Intermediate to advanced
416 pages
10h 30m
English
Let's add the CalculatePanState() method to calculate how far we have panned the image, and if it should start to affect the GUI, by following these few steps:
private const double DeadZone = 0.4d;private const double DecisionThreshold = 0.4d;private void CalculatePanState(double panX){ var halfScreenWidth = _screenWidth / 2; var deadZoneEnd = DeadZone * halfScreenWidth; if (Math.Abs(panX) < deadZoneEnd) { return; } var passedDeadzone = panX < 0 ? panX + deadZoneEnd : panX - deadZoneEnd; var decisionZoneEnd = DecisionThreshold * halfScreenWidth; ...
Read now
Unlock full access