Skip to content

Context Menus demo crashes on negative width or height #4425

@jh05013

Description

@jh05013

Describe the bug

In the web demo, when the plot in the Context Menus demo has negative width or height, the app crashes due to invalid arguments for f64::clamp.

To Reproduce
Steps to reproduce the behavior:

  1. Open the Context Menus demo
  2. Set the width or height of the plot to a negative number by either dragging or manually inputting
  3. The app panics with panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/num/f64.rs:1496:9: min > max, or either was NaN. min = 440.00000059604645, max = -440.00000059604645

Expected behavior

The width or height should be set to 0.

Desktop:

  • OS: Windows
  • Browser: Google Chrome
  • Version 124.0.6367.91 (Official Build) (64-bit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions