Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

CPScrollView adjusts documentView's origin incorrectly on CPScrollView resize #1674

Open
bradytrix opened this Issue · 9 comments

5 participants

@bradytrix

When a CPScrollView is created in IB, and its autosizing is set in such a way that the CPScrollView will change its height when the window changes height, the CPScrollView will adjust the origin of its documentView when the CPScrollView's height changes. This is not how the NSScrollView will behave when working from the same NIB.

My guess is that this is related to nib2cib's attempt to swap the autosizing mask flags for the browser's coordinate system. I say that because of the fix (below)...

How to reproduce:

1) Create new project with capp with the NIB template: "capp gen -t NibApplication bugTest", listen to the project with XcodeCapp, and open the project in Xcode/IB

2) Add an NSScrollView to the NIB, and under Autosizing, attach the view to the TOP, BOTTOM, and LEFT. Also, make the Height sizable so that the view will grow/shrink when the window's height changes.

3) Create an NSImageView that will become the document view. Choose a tall image for the imageView's content obviously so that scrolling will be tested appropriately. (Don't add the NSImageView as a subview of the NSScrollView in IB, just leave it as a root-level object, and we'll set it as the documentView in code.) Set the NSImageView's autosize mask thusly: attach to TOP and LEFT (should be the default).

4) Create outlets for the NSScrollView and NSImageView in the app controller and hook them up.

5) In the app controller, inside of awakeFromCib, set the imageView as the documentView of the scrollView. Also be sure to tell the scrollView setHasVerticalScroller:YES.

6) Open this project in your browser and resize the browser window. Watch as the scrollView changes in height (expected) but also moves the origin of the imageView (not expected).

HOW TO FIX:

1) Go into our NIB in Xcode/IB and change the autosize mask settings of the NSImageView from (attach TOP, attach LEFT) to this (attach BOTTOM, attach LEFT).

2) Now run in the browser again and notice that the origin of the documentView is no longer modified on the scrollView resize.

The reason that I'm pointing the finger at nib2cib is because when doing the above steps programmatically, same values and sizes for everything but leaving IB out of the process completely, everything works fine.

Hope this bug report helps. Thanks for the great work on Cappuccino, I think it's remarkable.

@cappbot
Collaborator

Milestone: Someday. Label: #new. What's next? A reviewer should examine this issue.

@bradytrix

Forgot to include my OS/dev info:

Cappuccino Version: v0.9.6-RC2 (git commit -- d4b0e2a)
OS: OSX 10.7.4
Xcode Version 4.3.2 (4E2002)
Browsers Tested: Firefox 15.01, Safari 5.1.6 (7534.56.5)

@thewalkingtoast

+tools
-#new
+#needs-confirmation

@cappbot
Collaborator

Milestone: Someday. Labels: #needs-confirmation, tools. What's next? This issue needs a volunteer to independently reproduce the issue.

@daboe01

@bradytrix: can you please put your reduction online?
+#needs-reduction

@cappbot
Collaborator

Milestone: Someday. Labels: #needs-confirmation, #needs-reduction, tools. What's next?

  • This issue needs a volunteer to independently reproduce the issue.
  • A minimal test app should be created which demonstrates the concern of this issue in isolation.
@ahankinson

I've made a reduction of it here:

https://dl.dropboxusercontent.com/u/1996023/capp/Issue1674.tgz

The bug is still present, as far as I can tell.

@daboe01

thank you!
+#acknowledged
-#needs-confirmation
-#needs-reduction
+#needs-patch

@cappbot
Collaborator

Milestone: Someday. Labels: #acknowledged, #needs-patch, tools. What's next? This issue needs a volunteer to write and submit code to address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.