CGRectInset() returning NaN values #84
Comments
#70 is caused by this same problem. Fixing this has the additional bonus of resolving that issue 🤘 |
You're probably seeing
Most
This could also cause problems, since some views don't gracefully handle having a zero size. TBH, I don't have a good answer to this. No potential solution here (including "don't do that") is really satisfactory, since they all cause incorrect or obnoxious behavior of some sort. |
What about adding an operator that lets you pass in a parameter of a |
To really do it right, it'd have to be an error not to provide a null mapping. I guess we should just use an empty rectangle. That's what division does right now. |
Are you proposing that the null mapping be accepted as a parameter into any method that could yield a |
I'm saying that in order for a mapping to be valuable, it would have to be required anywhere a Of course, that'd be a huge burden for maintainers and consumers of the framework, and still doesn't prevent a null rectangle from slipping through when binding to |
I think I disagree there, because this is nothing new to anyone who uses |
Also, applying said operator at the end of the signal chain would guarantee that it does not get passed through to |
We can adjust the inset operator, but it absolutely should have a required |
When using any operator that uses
CGRectInset()
internally (e.g.-insetWidth:height:
), if the rect being inset is too small to apply the inset,CGRectInset()
will return a rect with some values set toNaN
. This is especially dangerous when binding torcl_frame
orrcl_bounds
asNSView
throws an exception when attempting to set a frame with non-finite values.What would be a good solution for this? One way is to just not use
CGRectInset()
and apply the insets manually (yielding negative values for some members, which won't throw an exception) or keepCGRectInset()
and check for NaN values afterwards, replacing them with 0's or something suitable.The text was updated successfully, but these errors were encountered: