Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composition redesign #15

Closed
wants to merge 17 commits into from
Closed

Conversation

burtlo
Copy link

@burtlo burtlo commented Mar 28, 2012

I really love the menu and wanted to use any data source (not just an array), more touch events, and the ability to manipulate the images and animations. I also wanted the menu items to be able to hold some data object that I could store and retrieve on selection instead of relying on an index.

Ultimately, feel free to ignore this pull request, I simply wanted to share with you the work as this likely may not be a goal you had in mind for your codebase.

  • Converted project to ARC
  • AppDelegate in the example is no longer responsible for the menu and an example view controller was created.
  • Menu will generate delegate events for will expand, did expand,
    will close, and did close.
  • Menu will ask a delegate should expand and should close
  • Menu will generate events for tap and long press
  • Menu is populated from a Data Source Delegate
  • Menu is designed by a MenuItemFactory
  • Menu is composed with animations for expand, close, selected, unselected
  • Menu animations are now in their own separate classes
  • Menu items will generate events for tap and long press
  • Menu items are designed by a MenuItemFactory
  • Menu items contain a dataObject

Franklin Webber added 8 commits March 28, 2012 11:59
  * Converted project to ARC

  * Menu will generate delegate events for `will expand`, `did expand`,
    `will close`, and `did close`.
  * Menu will ask a delegate `should expand` and `should close`
  * Menu will generate events for `tap` and `long press`
  * Menu is populated from a Data Source Delegate
  * Menu is designed by a MenuItemFactory
  * Menu is composed with animations for expand, close, selected, unselected

  * Menu items will generate events for `tap` and `long press`
  * Menu items are designed by a MenuItemFactory
  * Menu items contain a `dataObject`
  There was some code related to landing indexs and items that is
  now removed as it was being used for another branch of work .
@levey
Copy link
Owner

levey commented Mar 29, 2012

Hello burtlo,
Nice refactoring:)
But what I prefer is that this menu should not be heavy, folks download it ,extend it:)
Do you think it's better?

@burtlo
Copy link
Author

burtlo commented Mar 29, 2012

Better gets the job done and I think your initial implementation does get the job done. So you are not obligated to act on the pull request. I simply wanted to share the design/refactoring with you and those that watch the project.

I believe this implementation does appear heavier because there are more files. It also lacked an initialization with an array, which I added in the last commit. The concept of the QuadCurveDataSource is fairly familiar with those that have use UITableViews. The use of a factory for the design, QuadCurveMenuItemFactory, and the animations, QuadCurveAnimation, is not as common but gives the library some very large gains in the realm to allow people to easily configure the menu as you would expect from a standard library.

Franklin Webber added 4 commits March 28, 2012 21:51
* Created a protocol for a menu director which will layout the items
  in the menu.
* Implmented the linear menu director
* Initialization of the menu with a center point
* Animations now maintain their own delays
@burtlo
Copy link
Author

burtlo commented Mar 31, 2012

How is this for awesome modularity?

I created a protocol which is call the QuadCurveMenuDirector which is responsible for laying out all the items in the menu. I moved all the radial positioning logic into this new class QuadCurveRadialDirector. Then I implemented a QuadCurveLinearDirector.

Previously an instance of the menu was limited to being radial. Now it can also be represented in a linear fashion with a simple command.

[self.menu setMenuDirector:[[QuadCurveLinearDirector alloc] init]];

@burtlo
Copy link
Author

burtlo commented Mar 31, 2012

Thanks to @myStrom for implementing RNExpandingButtonBar which gave me the inspiration to extend QuadCurve further.

Franklin Webber added 2 commits March 30, 2012 23:57
  Also removed mention of University as it was being default generated
for me"
* duration and delay between each item
* Set up a number of defaults
* Allowed rotation and blowup/shrink scale configuration
@burtlo
Copy link
Author

burtlo commented Mar 31, 2012

This now includes the pull request #12 and #13 which would provide a user with the way to configure the animation duration and rotation.

@levey
Copy link
Owner

levey commented Mar 31, 2012

your version crashed,
2012-03-31 16:13:50.838 AwesomeMenu[5913:f803] Menu - Tapped
2012-03-31 16:13:50.841 AwesomeMenu[5913:f803] Menu - Will Expand
2012-03-31 16:13:50.843 AwesomeMenu[5913:f803] Menu - Did Expand
2012-03-31 16:13:53.207 AwesomeMenu[5913:f803] Menu Item (2) - Long Pressed
2012-03-31 16:13:54.372 AwesomeMenu[5913:f803] Menu Item (2) - Long Pressed
2012-03-31 16:13:55.919 AwesomeMenu[5913:f803] Menu Item (2) - Long Pressed
2012-03-31 16:13:57.554 AwesomeMenu[5913:f803] Menu Item (2) - Long Pressed
2012-03-31 16:13:59.124 AwesomeMenu[5913:f803] Menu Item (2) - Long Pressed
2012-03-31 16:14:00.007 AwesomeMenu[5913:f803] Menu Item (2) - Long Pressed
2012-03-31 16:14:01.931 AwesomeMenu[5913:f803] Menu Item (1) - Tapped
2012-03-31 16:14:01.988 AwesomeMenu[5913:f803] * Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:

@burtlo
Copy link
Author

burtlo commented Mar 31, 2012

I am able to reproduce it. I'll see what I can do to fix it.

@burtlo
Copy link
Author

burtlo commented Mar 31, 2012

Give that a try. For some reason having a CABasicAnimation instead of a CAKeyframeAnimation animation causes less trouble

  Instead of hard-coding the cant to the left or return to center
  the animations are now configurable through properties.
@burtlo
Copy link
Author

burtlo commented Apr 3, 2012

Main menu item animation is now configurable for expand/close

@levey
Copy link
Owner

levey commented Apr 15, 2012

It can not be merged... maybe I have updated something, Should I provide a link of your menu in the README.md?

@levey levey closed this Apr 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants