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

FABButton depth preset stop working #1110

Closed
StepanetsDmtry opened this issue Jul 2, 2018 · 3 comments
Closed

FABButton depth preset stop working #1110

StepanetsDmtry opened this issue Jul 2, 2018 · 3 comments

Comments

@StepanetsDmtry
Copy link

After last update 2.16.0 a depthPreset property stop working for circle shapePreset. This is because after installing a depthPreset CALayer calls layoutShape() method. In this method, maskToBounds property always is true for circle shapePreset. If I change maskToBounds = false, all working fine.

open func layoutShape() {
    guard .none != shapePreset else {
      return
    }
    
    if 0 == bounds.width {
      bounds.size.width = bounds.height
    }
    
    if 0 == bounds.height {
      bounds.size.height = bounds.width
    }
    
    guard .circle == shapePreset else {
      masksToBounds = false
      cornerRadius = 0
      return
    }
    
    masksToBounds = true
    cornerRadius = bounds.width / 2
  }
@OrkhanAlikhanov
Copy link
Contributor

@DanielDahan I confirm that FABButton has no depth after b90ee8a as explained in the issue.

Basically we have no control over layer.masksToBounds property as it's overridden on layout cycle. Only workaround is to subclass FABButton (or any affected component) and change the property there.

class FABButton: Material.FABButton {
  override func layoutSubviews() {
    super.layoutSubviews()
    layer.masksToBounds = false
   }
}

@daniel-jonathan
Copy link
Member

masksToBounds = true should actually be removed. It is incorrectly being placed on the wrong layer. It should be added to the visualLayer. I will fix this as I know the complexity of its behaviour well. I will work on this tonight. Thank you!

@daniel-jonathan
Copy link
Member

daniel-jonathan commented Jul 5, 2018

Fixed the issue f99b6df, and the update will be released in a few hours. Thank you!

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

No branches or pull requests

3 participants