Image preview in menus #1162

Merged
merged 1 commit into from Dec 9, 2014

Conversation

Projects
None yet
3 participants
@extrajordanary
Contributor

extrajordanary commented Nov 22, 2014

No description provided.

@extrajordanary

This comment has been minimized.

Show comment
Hide comment
Contributor

extrajordanary commented Nov 22, 2014

+ [image setScalesWhenResized:YES];
+
+ // Report an error if the source isn't a valid image
+ if (![image isValid])

This comment has been minimized.

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

You could improve readability a bit if you move this "isValid" statement up a bit and return nil after logging the error. The long else part could be indented back one level so you don't have to think in more code branches. In case isValid can be determined already after the image assignment move it to line 301.

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

You could improve readability a bit if you move this "isValid" statement up a bit and return nil after logging the error. The long else part could be indented back one level so you don't have to think in more code branches. In case isValid can be determined already after the image assignment move it to line 301.

++ (NSImage*) thumbnailImageForResource:(RMResource*)res {
+ NSImage *image = [res previewForResolution:nil];
+
+ // shrink image to appropriate size

This comment has been minimized.

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

Redundant comment

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

Redundant comment

+ // shrink image to appropriate size
+ [image setScalesWhenResized:YES];
+
+ // Report an error if the source isn't a valid image

This comment has been minimized.

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

Redundant comment

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

Redundant comment

+ float oldWidth = image.size.width;
+ float oldHeight = image.size.height;
+
+ // set the scale factor

This comment has been minimized.

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

Redundant comment

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

Redundant comment

+ {
+ NSLog(@"Invalid Image");
+ } else {
+ float maxWidth = 30.0; // edit value for larger/smaller thumbnails

This comment has been minimized.

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

Comment is not informative. Please remove or rephrase if this is really needed. Consider renaming the var if it helps.

@NickyWeber

NickyWeber Nov 24, 2014

Contributor

Comment is not informative. Please remove or rephrase if this is really needed. Consider renaming the var if it helps.

@NickyWeber

This comment has been minimized.

Show comment
Hide comment
@NickyWeber

NickyWeber Nov 24, 2014

Contributor

Looks good.

This pull request looks a bit like #1163. Please incorporated the comments of that pull request into this one.

About my comment remarks: There's some good literature about commenting and good reasons to not do it. For example Robert C. Martin "Clean Code" chapter 4.

Contributor

NickyWeber commented Nov 24, 2014

Looks good.

This pull request looks a bit like #1163. Please incorporated the comments of that pull request into this one.

About my comment remarks: There's some good literature about commenting and good reasons to not do it. For example Robert C. Martin "Clean Code" chapter 4.

@cocojoe

This comment has been minimized.

Show comment
Hide comment
@cocojoe

cocojoe Dec 3, 2014

Member

@extrajordanary Do you have your final tweaks ready? I would like to merge this soon.

Member

cocojoe commented Dec 3, 2014

@extrajordanary Do you have your final tweaks ready? I would like to merge this soon.

@extrajordanary

This comment has been minimized.

Show comment
Hide comment
@extrajordanary

extrajordanary Dec 3, 2014

Contributor

Okay, should be good!

Contributor

extrajordanary commented Dec 3, 2014

Okay, should be good!

@cocojoe

This comment has been minimized.

Show comment
Hide comment
@cocojoe

cocojoe Dec 9, 2014

Member

@extrajordanary Thanks for your contribution.

Member

cocojoe commented Dec 9, 2014

@extrajordanary Thanks for your contribution.

cocojoe added a commit that referenced this pull request Dec 9, 2014

@cocojoe cocojoe merged commit fcc7cdf into spritebuilder:develop Dec 9, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment