Comments (9)
#70 is caused by this same problem. Fixing this has the additional bonus of resolving that issue 🤘
from reactivecocoalayout.
You're probably seeing CGRectNull
(or, at least, a rectangle passing the CGRectIsNull
test).
yielding negative values for some members, which won't throw an exception
Most CGRect
functions will standardize the provided rectangle, which would turn a negative width/height into a flipped rectangle. That's an incorrect (and probably very confusing) result.
check for NaN values afterwards, replacing them with 0's or something suitable
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.
from reactivecocoalayout.
What about adding an operator that lets you pass in a parameter of a rect rect signal to use in place of CGRectNull
?
from reactivecocoalayout.
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.
from reactivecocoalayout.
Are you proposing that the null mapping be accepted as a parameter into any method that could yield a CGRectNull
value or that it be an operator that can be applied to any signal that sends CGRect
s?
from reactivecocoalayout.
I'm saying that in order for a mapping to be valuable, it would have to be required anywhere a CGRectNull
might appear — otherwise, nobody will know the variant is there, and we're back to the same shitty exceptions.
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 frame
/rcl_frame
, so I think falling back to an empty rectangle is better.
from reactivecocoalayout.
otherwise, nobody will know it's there, and we're back to the same shitty exceptions.
I think I disagree there, because this is nothing new to anyone who uses CGRectInset
by itself. It's logical to assume that a signal operator that wraps CGRectInset
would have the same caveats. An optional mapping using a separate operator would eliminate the burden of having to enforce it and give people an easy option for resolving the problem in cases where they know that it's possible for a CGRectNull
value to be generated.
from reactivecocoalayout.
Also, applying said operator at the end of the signal chain would guarantee that it does not get passed through to rcl_frame
.
from reactivecocoalayout.
We can adjust the inset operator, but it absolutely should have a required nullRect:
parameter (using a constant rectangle, since it's just meant as a fallback). If the user doesn't care about that case, they can pass in CGRectNull
anyways.
from reactivecocoalayout.
Related Issues (20)
- when I set rcl_top , why the height and width changed ? HOT 1
- Add Carthage compatibility badge to the README
- Split animation behaviors into a separate library HOT 3
- Concat after animation HOT 1
- -rcl_frameSignal etc al should complete on object dealloc HOT 1
- NSView.rcl_baselineSignal does not update
- ld: library not found for -lReactiveCocoaLayout iOS HOT 1
- Add bootstrap and cibuild scripts
- Where is rcl_center? HOT 4
- Why can't I do both alignTop and alignRight? HOT 2
- Why can't I use signals that return constant numbers in my layout chain? HOT 9
- ResizingWindow demo has a lot of layer-backing artifacts HOT 1
- ResizingWindow throws exceptions if the window is sized too small
- A signal equivalent to AVMakeRectWithAspectRatioInsideRect ? HOT 6
- (NS | UI)EdgeInsets operators HOT 6
- Equally Space Views HOT 2
- Adopt the Flexbox spec. It's been much improved over the past year. HOT 2
- Create New Tag HOT 3
- RCL doesn't respect `flipped` coordinate space? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reactivecocoalayout.