divyavamsee / core-plot

Automatically exported from code.google.com/p/core-plot
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Scatter Plot pan with momentum and rubber-band effect at global ranges #531

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've already implemented a somewhat hacky version of this to CPTXYPlotSpace for 
a project at work and would like to contribute back to core-plot, but before 
cleaning things up and submitting a proper pull request, I wanted to start a 
discussion about adding in optional support for panning with momentum and as a 
separate but related feature, having panning past the end of a globalX or 
globalY range feel fluid like the standard iOS rubber-band effect at the end of 
a scrollview.

Adding momentum to panning really just makes the whole interaction feel a lot 
more fluid, and to be honest, it wasn't even a very large change, but it was 
the type of change that wasn't possible without modifying core-plot directly.

Adding the rubber-band snap-back effect past the globalX and/or globalY was a 
bit trickier, but I think it's a great UX in terms of letting the user "feel" 
the end of a plot as opposed to having a hard stop and possibly being confused 
about why you can't scroll more.  It's also very consistent with standard iOS 
UX.

All this being said, I 100% think both of these options should be optionally 
enabled (if you guys wanted to include them).

Definitely let me know your thoughts or if you'd like me to send you a copy of 
my altered source.

-- Travis

Original issue reported on code.google.com by fisch0...@gmail.com on 5 May 2013 at 12:11

GoogleCodeExporter commented 9 years ago
This is a great idea. Others have asked about this before, too. If you have 
some code you'd like to share, please run a diff against the latest code and 
post the patch file here.

Original comment by eskr...@mac.com on 5 May 2013 at 1:58

GoogleCodeExporter commented 9 years ago
Ok; I'll clean it up and post the diff tomorrow.

-- Travis

Original comment by fisch0...@gmail.com on 5 May 2013 at 2:35

GoogleCodeExporter commented 9 years ago
Here's a diff for adding momentum panning to the scatter plot's x-range, as 
well as enabling the option of elastic global ranges (only for the x-axis right 
now).

Original comment by fisch0...@gmail.com on 6 May 2013 at 5:51

Attachments:

GoogleCodeExporter commented 9 years ago
Note: the changes to CPTScatterPlot.m are a different change; please disregard 
in the diff.

Original comment by fisch0...@gmail.com on 6 May 2013 at 5:51

GoogleCodeExporter commented 9 years ago
I created a new branch called "momentumScrolling" and imported this patch. 
Because it uses blocks, it will have to go in the release-2.0 branch when 
finished.

We need to add support for elasticity on the y-axis, too, before we merge.

I also want to experiment with using CPTAnimation for both momentum and elastic 
bounce-back. This would make it easy to use animation curves for a gradual 
deceleration on the scrolling and a bounce effect at the global ranges. This 
would also remove the block dependency and allow this feature to merge with the 
default branch instead.

Original comment by eskr...@mac.com on 11 May 2013 at 7:01

GoogleCodeExporter commented 9 years ago
I've updated the branch to support both the x- and y- axes and use CPTAnimation 
instead of blocks. Let me know what you think. We might need to tweak some of 
the animation parameters—suggestions welcome.

Original comment by eskr...@mac.com on 21 May 2013 at 12:12

GoogleCodeExporter commented 9 years ago
LOoks awesome from my first read-through and definitely cleaner to use the 
CPTAnimation; I'll try integrating it into my product and respond with more 
feedback sometime in the next day.

One thing I think we'll need is delegate callbacks to notify the plot space 
delegate that momentum has started / ended (I've already added this to my 
original version).  For instance, in my app, I want the y-axis to update w/ a 
subtle animation only after momentum / elasticity ends and the scatter plot is 
horizontally fixed.

Thanks!
-- Travis

Original comment by fisch0...@gmail.com on 21 May 2013 at 12:38

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 33b18bd72fb1.

Original comment by eskr...@mac.com on 27 May 2013 at 12:34