harisrinivasr / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

panning limit on y axis buggy #212

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. put a pan limit on y axis
2. try to pan past it very hard
3. you will 'break through' the limit

What is the expected output? What do you see instead?
It should not go past the limit.

Please provide a source code snippet that we can use to replicate the issue.

What version of the product binary library are you using?
1.0.0

Please provide any additional information below.
The fix is to replace in org.achartengine.tools.pan.java lines nr 102-121 with:

if (limits != null) {
            if (notLimitedBottom) {
              notLimitedBottom = limits[2] <= range[2] + deltaY;
            }
            if (notLimitedUp) {
              notLimitedUp = limits[3] >= range[3] + deltaY;
            }
          }
          if (!limited || (notLimitedBottom && notLimitedUp)) {
            setYRange(range[2] + deltaY, range[3] + deltaY, i);
            limitsReachedY = false;
          } else {
            limitsReachedY = true;
          }

Original issue reported on code.google.com by niels...@gmail.com on 23 Apr 2012 at 3:04

GoogleCodeExporter commented 9 years ago
And we also fixed another small bug:

What steps will reproduce the problem?
1. put a pan limit on any axis
2. get close to the limit
3. try to move fast towards the limit
4. you will not move

What is the expected output? What do you see instead?
It should go to the limit instead of not moving at all.

Please provide a source code snippet that we can use to replicate the issue.

What version of the product binary library are you using?
1.0.0

Please provide any additional information below.
The fix (including above bug fix) is to replace in 
org.achartengine.tools.pan.java lines nr 89-121 with:

              if(notLimitedLeft == false && range[0] > limits[0])
              {
                deltaX = limits[0] - range[0];
                notLimitedLeft = true;
              }
            }
            if (notLimitedRight) {
              notLimitedRight = limits[1] >= range[1] + deltaX;
              if(notLimitedRight == false && range[1] < limits[1])
              {
                deltaX = limits[1] - range[1];
                notLimitedRight = true;
              }
            }
          }
          if (!limited || (notLimitedLeft && notLimitedRight)) {
            setXRange(range[0] + deltaX, range[1] + deltaX, i);
            limitsReachedX = false;
          } else {
            limitsReachedX = true;
          }
        }
        if (mRenderer.isPanYEnabled()) {
          if (limits != null) {
            if (notLimitedBottom) {
              notLimitedBottom = limits[2] <= range[2] + deltaY;
              if(notLimitedBottom == false && range[2] > limits[2])
              {
                deltaY = limits[2] - range[2];
                notLimitedBottom = true;
              }
            }
            if (notLimitedUp) {
              notLimitedUp = limits[3] >= range[3] + deltaY;
              if(notLimitedUp == false && range[3] < limits[3])
              {
                deltaY = limits[3] - range[3];
                notLimitedUp = true;
              }
            }
          }
          if (!limited || (notLimitedBottom && notLimitedUp)) {
            setYRange(range[2] + deltaY, range[3] + deltaY, i);
            limitsReachedY = false;
          } else {
            limitsReachedY = true;
          }

Original comment by niels...@gmail.com on 23 Apr 2012 at 3:09

GoogleCodeExporter commented 9 years ago
Thanks. I only included the first part.
If you still see the second issue, please provide a patch rather than a 
copy-pasted code.

Original comment by dandrome...@gmail.com on 12 May 2012 at 11:33