Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Resize events consolidation and minor resizer bugs (#2079) #2092

Merged
merged 4 commits into from
Nov 21, 2012
Merged

Resize events consolidation and minor resizer bugs (#2079) #2092

merged 4 commits into from
Nov 21, 2012

Conversation

jbalsas
Copy link
Contributor

@jbalsas jbalsas commented Nov 9, 2012

This pull request consolidates the resize events dispatched by utils/Resizer following the comments on (#2079).

It also fixes some minor resizer bugs such as the one described in #2079 where after dragging the panel shut, it will expand to 10px instead of the original size.

@peterflynn Let me know if this is closer to what you'd expect

@@ -233,6 +244,7 @@ define(function (require, exports, module) {
startPosition = e[directionProperty],
startSize = $element.is(":visible") ? elementSizeFunction.apply($element) : 0,
newSize = startSize,
previousSize = startSize,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I think of it, currentSize may be a better name for this...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think previousSize is an ok enough name.

@ghost ghost assigned peterflynn Nov 12, 2012
@peterflynn
Copy link
Member

Just tested the code a bit and the stream of events looks much cleaner now! I'll review the code itself now.

}

if (elementPrefs.contentSize !== undefined) {
contentSizeFunction.apply($resizableElement, [Math.max(elementPrefs.contentSize, minSize)]);
contentSizeFunction.apply($resizableElement, [elementPrefs.contentSize]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you removed the checks for minSize?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yeah... I forgot to comment on that. The previous logic was wrong and somehow misleading and I wanted to check with you the best approach to take here.

Now that the panels have min-size, the only way for minSize to be chosen here is if we change the minimum size for the panel to a bigger value than the one stored in the preferences in the previous session. With that in mind, we can do two things:

  1. Don't check for minSize. This shows the panel with the stored sizes and the moment you start resizing it jumps to the new minimum size directly.
  2. Check for minSize (like previously), which should automatically resize the panel to the minSize.

There were a couple of issues with 2 before:

  • If you resize the panel to the minimum size (in which case size==minSize), contentSize is always smaller than minSize and we are forcing always a bigger size on it (the scrollbars aren't quite right).
  • If you raise minSize, the panel is resized correctly, but again the content isn't and it is always getting resized to minSize. We'd probably need to set it to minSize-(size-contentSize).
  • We may want to save the preferences in this case, although the code won't complain.

Which behavior do you prefer? If it's the second, I could push it along with the rest of review changes or fix it in a separate issue (I'd say that without the checks, the code at least behaves is it says it does)

@peterflynn
Copy link
Member

Done reviewing. Looks pretty solid overall -- thanks for posting the cleanup so fast!

@jbalsas
Copy link
Contributor Author

jbalsas commented Nov 17, 2012

@peterflynn Changes pushed. Ready for re-review.

Includes fix for #2117 as discussed (pending the mouse-glitch).

Doesn't fix the check for minSize in the preferences, which could be addressed in a separate issue.

@peterflynn
Copy link
Member

@jbalsas: Sorry I took so long to get back to you! This looks solid to me.

Re the min-size issue: your explanation makes sense to me. I don't think we should worry right now about the edge case of min-size increasing after a smaller value is already stored in prefs.

Re requesting animation frames in mousemove vs. at the end of doRedraw(): your latest code still requests at the end of each doRedraw() -- was that your intent? I think it's fine, myself... there's virtually no overhead from extra frames between mousemoves because of the newSize check.

@jbalsas
Copy link
Contributor Author

jbalsas commented Nov 21, 2012

Don't worry!

About requesting animation frames, I was just testing different approaches to see if if it could still be improved a little. As you say, with the newSize check, the impact of doRedraw() is minimal, so I decided to leave it as is.

Feel free to merge this anytime ;)

@peterflynn
Copy link
Member

Sounds good to me -- merging

peterflynn added a commit that referenced this pull request Nov 21, 2012
Clean up panel resize events; fix bugs with double-clicking to expand/collapse (#2079); fix bug with dragging mouse outside window bounds (##2117)
@peterflynn peterflynn merged commit b92c2a7 into adobe:master Nov 21, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants