material-showcase-ios icon indicating copy to clipboard operation
material-showcase-ios copied to clipboard

Secondary text have multi line draw over target view

Open fadizant opened this issue 7 years ago • 15 comments

When the secondary text have multi line ( more than 3 lines ) and instructionView will show above of target view the text will draw over target view.

I have make some changes in MaterialShowcase.swift to calculate the height depends of text font and size for primary text and secondary text not to be static as before LABEL_DEFAULT_HEIGHT * 2

can you check this issue please, thanks.

private func addInstructionView(at center: CGPoint) {
 .....

 width = containerView.frame.width - (xPosition + xPosition)

 yPosition = center.y - TEXT_CENTER_OFFSET - ( calculateHeight(text: primaryText, font: primaryTextFont ?? UIFont.boldSystemFont(ofSize: primaryTextSize), width: width) +  calculateHeight(text: secondaryText, font: secondaryTextFont ?? UIFont.systemFont(ofSize: secondaryTextSize), width: width) )//LABEL_DEFAULT_HEIGHT * 2
 .....
 }

fadizant avatar Mar 10 '19 12:03 fadizant

I agree with this change because I also need it. Developer, please review this issue!

zahariadaniel16 avatar Mar 21 '19 14:03 zahariadaniel16

@fadizant. Thank you for addressing the issue. Can you send a PR for that?

quangctkm9207 avatar Mar 21 '19 23:03 quangctkm9207

@fadizant @quangctkm9207 Has this been addressed at all?

mjenj avatar Sep 07 '20 13:09 mjenj

Also having issues with this, can someone please assist? image

Zyb3r avatar Sep 07 '20 13:09 Zyb3r

Can you try to adjust showcase.backgroundRadius to see if the situation can be improved?

quangctkm9207 avatar Sep 08 '20 01:09 quangctkm9207

Adjusting the size of the background radius did not help me. Going off what @fadizant said I've created a pull request which dynamically calculates the height https://github.com/aromajoin/material-showcase-ios/pull/133

Please could you take a look @quangctkm9207 ? Thanks

mjenj avatar Sep 08 '20 06:09 mjenj

Thank you @mjenj. I am going to check it out.

quangctkm9207 avatar Sep 08 '20 06:09 quangctkm9207

@Zyb3r @mjenj : Have you tried the latest version 0.7.2 that has just been released yesterday?

quangctkm9207 avatar Sep 08 '20 06:09 quangctkm9207

I just updated now, and the problem is better but unfortunately still not fixed. The size of the target is definitely a factor, and if I make the target smaller, I can see the text, but not the whole target which isn't ideal

mjenj avatar Sep 08 '20 07:09 mjenj

As @mjenj mentioned, we updated and it is slightly better, but the text still extends outside of the view

Zyb3r avatar Sep 08 '20 07:09 Zyb3r

Thanks for confirming. I have tried @mjenj PR, and I have a comment over there. It seems that there is no a perfect solution for this issue.

quangctkm9207 avatar Sep 08 '20 08:09 quangctkm9207

Thanks, I'll investigate and see if I can find a compromise

mjenj avatar Sep 08 '20 08:09 mjenj

I've added a new comment on the pull request. I agree your solution is working better in most cases, I'm just not sure how to fix it. The 2 factors I believe are the targetHolderRadius and whether the button is on the left or right

mjenj avatar Sep 08 '20 09:09 mjenj

We've found a work around for our use case, by setting the target to 0, however if you manage to solve the problem please ping me. Thanks for being responsive :)

mjenj avatar Sep 08 '20 12:09 mjenj

Thank you @mjenj.

quangctkm9207 avatar Sep 09 '20 02:09 quangctkm9207