ui/uiprogressview
진행률 표시. (원본 ui/uiprogressview.js 의 UIProgressView, ProgressDirection)
- 호스트 content_size 영역을 트랙으로 쓰고, 값 비율만큼 채움을 그린다. 입력은 받지 않는다.
- 트랙 색은 원본처럼 UIView 의 배경색이다. (set_track_color 는 set_background_color 의 다른 이름)
- 반대편 값(secondary_value)을 정하면 진행 방향의 반대쪽 끝에서 차오르는 두 번째 채움을 그린다. (원본 null 은 None)
Progress display. (UIProgressView, ProgressDirection of the original ui/uiprogressview.js)
- Uses the host's content_size area as the track and draws the fill by the value ratio. Takes no input.
- The track color is UIView's background color as in the original. (set_track_color is another name for set_background_color)
- When the opposite value (secondary_value) is set, draws a second fill that fills from the end opposite the progress direction. (the original null is None)
UIProgressViewstruct traits Default, Component
진행률 표시.
Progress display.
use vanilla::{NodeTree, ProgressDirection, UIProgressView, Vector2};
let mut node_tree = NodeTree::new();
let root_id = node_tree.get_root_id();
let bar_id = node_tree.create_child(root_id, "HealthBar");
node_tree[bar_id].set_content_size(Vector2::create(200.0, 12.0));
let progress_view = node_tree.add_component(bar_id, UIProgressView::new()).expect("progress");
progress_view.set_range(0.0, 120.0);
progress_view.set_value(90.0);
progress_view.set_corner_radius(6.0);
assert_eq!(progress_view.get_ratio(), 0.75);
assert_eq!(progress_view.get_direction(), ProgressDirection::Horizontal);생성. (값 0, 범위 0 ~ 1, 트랙 회색, 채움 파랑)
Constructor. (value 0, range 0 ~ 1, gray track, blue fill)
반환ReturnsUIProgressView 붙기 전의 진행률 표시. (가로 방향, 반대편 값 없음)Progress display before being attached. (horizontal direction, no opposite value)
짝Counterpart: vanilla.js UIProgressView.constructor
품은 뷰 반환.
Returns the embedded view.
반환Returns&UIView 품은 UIView.The embedded UIView.
품은 뷰 반환. (변경용)
Returns the embedded view. (mutable)
반환Returns&mut UIView 품은 UIView.The embedded UIView.
컨텐트 노드 핸들.
Content node handle.
반환ReturnsOption<NodeId> 컨텐트 노드. (트리에 붙기 전이면 None)Content node. (None before being attached to a tree)
짝Counterpart: vanilla.js UIView.getContent
배경색 설정. (트랙 색)
Sets the background color. (track color)
- background_colorimpl Into<Color>
- 트랙 색. (기본
Color::create(0.7, 0.7, 0.7, 1.0))Track color. (defaultColor::create(0.7, 0.7, 0.7, 1.0))
짝Counterpart: vanilla.js UIView.setBackgroundColor
배경색 반환. (트랙 색)
Returns the background color. (track color)
반환ReturnsColor 트랙 색.Track color.
짝Counterpart: vanilla.js UIView.getBackgroundColor
0 ~ 1 비율 반환.
Returns the 0 ~ 1 ratio.
반환Returnsf64 범위 안에서 값의 자리. (0 ~ 1, 최대값이 최소값보다 크지 않으면 0)Position of the value within the range. (0 ~ 1, 0 if the maximum is not greater than the minimum)
짝Counterpart: vanilla.js UIProgressView.getRatio
값 설정. (범위로 자른다)
Sets the value. (clamped to the range)
- valuef64
- 값. (최소값 ~ 최대값으로 자른다)Value. (clamped to minimum ~ maximum)
짝Counterpart: vanilla.js UIProgressView.setValue
값 반환.
Returns the value.
반환Returnsf64 값. (기본 0)Value. (default 0)
짝Counterpart: vanilla.js UIProgressView.getValue
범위 설정. (지금 값을 새 범위로 다시 자른다)
- 반대편 값은 다시 자르지 않는다. (원본과 같음, 그릴 때 비율을 0 ~ 1 로 자른다)
Sets the range. (reclamps the current value to the new range)
- The opposite value is not reclamped. (same as the original, the ratio is clamped to 0 ~ 1 when drawing)
- min_valuef64
- 최소값. (비율 0 자리)Minimum value. (where the ratio is 0)
- max_valuef64
- 최대값. (비율 1 자리)Maximum value. (where the ratio is 1)
짝Counterpart: vanilla.js UIProgressView.setRange
use vanilla::UIProgressView;
let mut progress_view = UIProgressView::new();
progress_view.set_value(0.8);
progress_view.set_range(0.0, 0.5);
assert_eq!(progress_view.get_value(), 0.5);
progress_view.set_range(10.0, 20.0);
assert_eq!(progress_view.get_value(), 10.0);
assert_eq!(progress_view.get_ratio(), 0.0);최소값 반환.
Returns the minimum value.
반환Returnsf64 최소값. (기본 0)Minimum value. (default 0)
짝Counterpart: vanilla.js UIProgressView.getMinValue
최대값 반환.
Returns the maximum value.
반환Returnsf64 최대값. (기본 1)Maximum value. (default 1)
짝Counterpart: vanilla.js UIProgressView.getMaxValue
반대편 값 설정. (None 이면 끔. 범위로 자른다)
Sets the opposite value. (None turns it off. clamped to the range)
- secondary_valueOption<f64>
- 진행 방향의 반대쪽 끝에서 차오르는 두 번째 채움의 값. (None 이면 그리지 않는다)Value of the second fill that fills from the end opposite the progress direction. (not drawn if None)
짝Counterpart: vanilla.js UIProgressView.setSecondaryValue
use vanilla::UIProgressView;
let mut progress_view = UIProgressView::new();
progress_view.set_range(0.0, 100.0);
progress_view.set_value(40.0);
progress_view.set_secondary_value(Some(35.0));
assert_eq!(progress_view.get_secondary_value(), Some(35.0));
progress_view.set_secondary_value(Some(150.0));
assert_eq!(progress_view.get_secondary_value(), Some(100.0));
progress_view.set_secondary_value(None);
assert_eq!(progress_view.get_secondary_value(), None);반대편 값 반환.
Returns the opposite value.
반환ReturnsOption<f64> 반대편 값. (끈 상태면 None, 기본 None)Opposite value. (None when off, default None)
짝Counterpart: vanilla.js UIProgressView.getSecondaryValue
반대편 채움 색 설정.
Sets the opposite fill color.
- colorimpl Into<Color>
- 반대편 채움 색. (기본
Color::create(0.94, 0.33, 0.31, 1.0))Opposite fill color. (defaultColor::create(0.94, 0.33, 0.31, 1.0))
짝Counterpart: vanilla.js UIProgressView.setSecondaryFillColor
반대편 채움 색 반환.
Returns the opposite fill color.
반환ReturnsColor 반대편 채움 색.Opposite fill color.
짝Counterpart: vanilla.js UIProgressView.getSecondaryFillColor
트랙 색 설정. (배경색)
Sets the track color. (background color)
- colorimpl Into<Color>
- 트랙 색. (set_background_color 와 같다)Track color. (same as set_background_color)
짝Counterpart: vanilla.js UIProgressView.setTrackColor
트랙 색 반환. (배경색)
Returns the track color. (background color)
반환ReturnsColor 트랙 색.Track color.
짝Counterpart: vanilla.js UIProgressView.getTrackColor
채움 색 설정.
Sets the fill color.
- colorimpl Into<Color>
- 채움 색. (기본
Color::create(0.23, 0.51, 0.96, 1.0))Fill color. (defaultColor::create(0.23, 0.51, 0.96, 1.0))
짝Counterpart: vanilla.js UIProgressView.setFillColor
채움 색 반환.
Returns the fill color.
반환ReturnsColor 채움 색.Fill color.
짝Counterpart: vanilla.js UIProgressView.getFillColor
둥근 모서리 반지름 설정.
Sets the rounded corner radius.
- corner_radiusf64
- 트랙과 채움의 모서리 반지름. (0 이하면 각진 사각형, 기본 0)Corner radius of the track and fill. (square corners if 0 or less, default 0)
짝Counterpart: vanilla.js UIProgressView.setCornerRadius
둥근 모서리 반지름 반환.
Returns the rounded corner radius.
반환Returnsf64 모서리 반지름. (기본 0)Corner radius. (default 0)
짝Counterpart: vanilla.js UIProgressView.getCornerRadius
방향 설정.
Sets the direction.
- directionProgressDirection
- 진행 방향. (Horizontal 은 왼쪽에서, Vertical 은 아래에서 채운다. 반대편 값은 그 반대쪽 끝에서)Progress direction. (Horizontal fills from the left, Vertical from the bottom. the opposite value from the opposite end)
짝Counterpart: vanilla.js UIProgressView.setDirection
방향 반환.
Returns the direction.
반환ReturnsProgressDirection 진행 방향. (기본 Horizontal)Progress direction. (default Horizontal)
짝Counterpart: vanilla.js UIProgressView.getDirection
ProgressDirectionenum traits Clone, Copy, Debug, PartialEq, Eq
진행 방향.
Progress direction.
| 이름Name | 설명Description |
|---|---|
Horizontal | 왼쪽에서 오른쪽으로 채움.Fills from left to right. |
Vertical | 아래에서 위로 채움.Fills from bottom to top. |