question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should Rect Width and Height have negative values?

See original GitHub issue

There is no logic in that because what defines that the Rect could have negative values are your sides. e.g.: r = new Rect (-10, -10, 5, 5) result in the follow: Left = -10, Right = -5, Top = -10, Botton = -5

Thoughts, please???

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
migueldeicazacommented, Jun 16, 2020

We should not allow negatives for now - this will catch bugs if they crop up.

If one day there is a scenario that makes sense we can explicitly enable this back, for now the checks seem like they do more good. I merged the patch that had this.

1reaction
tigcommented, Jun 15, 2020

If you do this, please bring over the the updated implementations of all three classes, or figure out how to reference System.Windows directly. We should NOT have duplicated/modified code for such fundamental classes that have been so thoroughly tested.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why System.Drawing.Rectangle allow contain negative ...
No, it means that you ran out of space, and the width should be treated as zero. Also, the width may go negative...
Read more >
rect.Contains cant accept rects with a negative width and ...
A Rectangle whose width or height is negative has neither location nor dimension along those axes with negative dimensions. Such a Rectangle is ......
Read more >
Can the width of a rectangular solid be negative?
No, width basically means length. Length can never be negative. It may be considered negative from a frame of reference. For e.g. the...
Read more >
Rectangle does funny things with negative height/width ...
If you have a rectangle with a negative height or width values, it will be created in ways that may be confusing to...
Read more >
Rect.Width Property (System.Windows)
Property Value​​ A positive number that represents the width of the rectangle. The default is 0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found