enso/lib/rust/ensogl/examples/slider/Cargo.toml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
643 B
TOML
Raw Normal View History

[package]
name = "ensogl-example-slider"
version = "0.1.0"
authors = ["Enso Team <contact@enso.org>"]
2021-12-01 18:06:57 +03:00
edition = "2021"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
Numeric slider component enhancement (#3885) 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. https://user-images.githubusercontent.com/117099775/206148098-3b4dc059-18aa-4200-9ee0-5d4382363810.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. https://user-images.githubusercontent.com/117099775/206148139-6149c91d-ef49-4e2d-97f6-71084f52591c.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. https://user-images.githubusercontent.com/117099775/206148170-d3fa4c82-6e73-4b1c-9be9-cb99979f7b70.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. https://user-images.githubusercontent.com/117099775/206148211-0f176aaf-bc1b-45e2-afd7-0d28391aafcb.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. https://user-images.githubusercontent.com/117099775/206148261-ae291073-85e9-4082-9f91-39b65fecdc0f.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.
2022-12-12 11:53:19 +03:00
enso-frp = { path = "../../../frp" }
ensogl-core = { path = "../../core" }
ensogl-hardcoded-theme = { path = "../../app/theme/hardcoded" }
2022-08-27 01:25:34 +03:00
ensogl-text-msdf = { path = "../../component/text/src/font/msdf" }
Numeric slider component with variable precision (#3852) This `Slider` component allows adjusting a numeric value with the mouse. The value is increased or decreased by clicking on the component and dragging it to the left or right. The `Slider` has a configurable default value. `Ctrl`+clicking on the component resets its value to that default. When the value is moved away from the default, the value is printed in **bold**. The `Slider` precision is increased or decreased by clicking the component and dragging upward or downward. This precision influences how quickly the value changes when the mouse moves horizontally, the steps in which the value is incremented or decremented, and the number of digits used to display the value. There is a margin around the component within which the precision is not changed. Beyond this margin, the precision is increased or decreased in powers of 10 (e.g. `0.1` -> `0.01` -> `0.001` when moving the mouse downwards, or `0.1` -> `1.0` -> `10.0` when moving the mouse upwards). The margin and distance between consecutive steps along the vertical axis are configurable. The value of the `Slider` is limited to a configurable range, and cannot be adjusted beyond that range. A colored bar fills the component to indicate the current value within the range. #### Video demonstration https://user-images.githubusercontent.com/117099775/202244982-2f6f419d-7281-41f6-8607-7e492ad25b46.mp4 #### Future additions This is the first iteration of the `Slider` component. Additional features are planned for the future: * Textual editing of the value. * Improved visual feedback on precision changes. * Additional out-of-range behaviors.
2022-11-24 18:37:03 +03:00
ensogl-slider = { path = "../../component/slider" }
wasm-bindgen = { workspace = true }
# Stop wasm-pack from running wasm-opt, because we run it from our build scripts in order to customize options.
[package.metadata.wasm-pack.profile.release]
wasm-opt = false