Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numeric slider component enhancement #3885

Merged
merged 210 commits into from
Dec 12, 2022

Conversation

galin-enso
Copy link
Contributor

@galin-enso galin-enso commented Nov 17, 2022

Pull Request Description

This is an enhancement of the Slider component implemented in #3852. It adds the following features:

  • Tooltips and precision change hints
  • Selectable slider limit behaviors
  • Textual slider value editing
  • Vertical slider layout

Tooltips

An information tooltip can now be added to a slider, it is shown when the mouse hovers over the component. Additionally, a pop-up indicating the slider's precision appears when the slider's precision has been adjusted.

unknown_2022.12.07-10.51.mp4

Slider limits

The previous slider implementation clamped the adjusted value to the slider's minimum/maximum limits. Now the following behaviors are available:

  • Hard limits: Clamp the value to a range within the slider's limits.
  • Soft limits: The value can extend beyond the slider's limits. When this occurs, an overflow indicator will be displayed on the side of the limit that is exceeded.
  • Adaptive limits: The value can extend beyond the slider's limits. When this occurs, the exceeded limit will temporarily be adjusted to double the slider's range. This will be performed iteratively until the value falls within the extended limits. When a limit is extended and the value is adjusted to fit a smaller range, the extended limit will be iteratively halved until only the necessary range is covered. The slider's extended limits will never shrink to a range smaller than the original range.

These behaviors can be set to the lower and upper limits of a slider independently.

unknown_2022.12.07-10.52.mp4

Textual editing

The slider's value can now be entered through a text input field. Double-click to edit the slider's current value. To confirm the edit press enter, or press escape to cancel the edit. If an invalid value is entered on confirmation the slider will revert to its value before the edit. The slider's precision will be adjusted based on the number of decimal places of the value entered.

unknown_2022.12.07-10.54.mp4

Vertical layout

The slider component now supports a vertical layout. In this case value adjustment is performed by a vertical mouse movement, and a horizontal movement adjusts the slider's precision. The slider's track now fills the component in a vertical direction, and the slider's label is displayed near the top end of the component.

unknown_2022.12.07-10.58_1.mp4

Scroll bar mode

The slider component supports two indicator modes:

  • Track: The component is filled with a colored bar from the lower limit (empty) to the upper limit (full) dependent on the slider's value.
  • Thumb: The component contains a rounded indicator that moves along the slider from one end to the other, indicating the slider's value proportionally to the slider's limits. The width of the indicator is configurable.
    In addition, the value text, text entry, and precision adjustment can be turned off to provide a scroll bar appearance when used with the Thumb indicator.
unknown_2022.12.07-10.59.mp4

Example scene shortcuts

The example scene contains two shortcuts in order to evaluate the dynamic addition and removal of the slider components:

  • CTRL+D drops all the slider components that are added to the scene.
  • CTRL+A adds a new set of example slider components to the scene.

Important Notes

Checklist

Please include the following checklist in your PR:

  • The documentation has been updated if necessary.
  • All code conforms to the
    Scala,
    Java,
    and
    Rust
    style guides.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed: Enso GUI was tested when built using BOTH
      ./run ide build and ./run ide watch.

Copy link
Member

@wdanilo wdanilo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge it :)

@galin-enso galin-enso added the CI: Ready to merge This PR is eligible for automatic merge label Dec 12, 2022
@mergify mergify bot merged commit b2b6061 into develop Dec 12, 2022
@mergify mergify bot deleted the wip/galin-enso/numeric-slider-enhancement-183816694 branch December 12, 2022 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants