MCPcopy Create free account
hub / github.com/angular-rust/ux-components / set_scroll_percent

Method set_scroll_percent

src/elements/scroll_view.rs:154–163  ·  view source on GitHub ↗

?_horizontal:Option , ?_vertical:Option

(&self, horizontal: Option<f32>, vertical: Option<f32>)

Source from the content-addressed store, hash-verified

152
153 // ?_horizontal:Option<f32>, ?_vertical:Option<f32>
154 pub fn set_scroll_percent(&self, horizontal: Option<f32>, vertical: Option<f32>) {
155 let mut state = self.state.borrow_mut();
156 let percent_v = vertical.unwrap_or(state.percent_v);
157 let percent_h = horizontal.unwrap_or(state.percent_h);
158
159 state.percent_v = percent_v.clamp(0.0, 1.0);
160 state.percent_h = percent_h.clamp(0.0, 1.0);
161
162 self.update_scroll();
163 }
164
165 pub fn update_container(&self) {
166 let mut state = self.state.borrow_mut();

Callers 1

mousewheelMethod · 0.45

Calls 1

update_scrollMethod · 0.45

Tested by

no test coverage detected