Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix wrap content calculation by filter hidden views #280

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

Open
ruslandzhafarov wants to merge 10 commits into layoutBox:master
base: master
Choose a base branch
Loading
from ruslandzhafarov:patch-1

Conversation

@ruslandzhafarov
Copy link

@ruslandzhafarov ruslandzhafarov commented Mar 28, 2024

No description provided.

let subviews: [PinView.PinView]
switch viewFilter {
case .visibleOnly:
subviews = view.subviews.filter { !0ドル.isHidden }
Copy link
Contributor

@MontakOleg MontakOleg Mar 28, 2024

Choose a reason for hiding this comment

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

What about views with alpha = 0?

There is public visible(_ views: [UIView]) views filter that takes alpha into account -

return views.filter({ !0ドル.isHidden && 0ドル.alpha > 0 })
, it may lead to confusion if name "view filter" will behave differently here.

Copy link
Member

Choose a reason for hiding this comment

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

Good point, you could use the visible() here to filter views.


private func wrapContent(_ type: WrapType, padding: PEdgeInsets, _ context: Context) -> PinLayout {
let subviews = view.subviews
private func wrapContent(_ type: WrapType, padding: PEdgeInsets, viewFilter: ViewFilter = .none, _ context: Context) -> PinLayout {
Copy link
Contributor

@MontakOleg MontakOleg Mar 28, 2024

Choose a reason for hiding this comment

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

do we need default argument value (viewFilter = .none) in private function?

Copy link
Member

Choose a reason for hiding this comment

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

Not needed here, the parameter should always be specified by callers

Copy link
Member

@lucdion lucdion left a comment

Choose a reason for hiding this comment

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

Excellent. Could you update the documentation of wrapContent (README.md)? 🙏

let subviews: [PinView.PinView]
switch viewFilter {
case .visibleOnly:
subviews = view.subviews.filter { !0ドル.isHidden }
Copy link
Member

Choose a reason for hiding this comment

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

Good point, you could use the visible() here to filter views.

}

public var isVisible: Bool {
!isHidden && alphaValue > 0
Copy link
Member

@lucdion lucdion Apr 5, 2024

Choose a reason for hiding this comment

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

Suggested change
!isHidden && alphaValue > 0
return !isHidden && alphaValue > 0

}

public var isVisible: Bool {
!isHidden && alpha > 0
Copy link
Member

@lucdion lucdion Apr 5, 2024

Choose a reason for hiding this comment

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

Suggested change
!isHidden && alpha > 0
return !isHidden && alpha > 0

Copy link

bump
why not merge?

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

Reviewers

@lucdion lucdion lucdion approved these changes

@MontakOleg MontakOleg Awaiting requested review from MontakOleg

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /