@@ -181,14 +181,14 @@ fn (cfg &ScrollbarCfg) mouse_move(layout &Layout, mut e Event, mut w Window) {
181181 if e.mouse_x > = (ly.shape.x - extend)
182182 && e.mouse_x < = (ly.shape.x + ly.shape.width + extend) {
183183 offset := offset_mouse_change_x (ly, e.mouse_dx, cfg.id_track, w)
184- w.view_state.offset_x_state [cfg.id_track] = offset
184+ w.view_state.scroll_x [cfg.id_track] = offset
185185 }
186186 }
187187 else {
188188 if e.mouse_y > = (ly.shape.y - extend)
189189 && e.mouse_y < = (ly.shape.y + ly.shape.height + extend) {
190190 offset := offset_mouse_change_y (ly, e.mouse_dy, cfg.id_track, w)
191- w.view_state.offset_y_state [cfg.id_track] = offset
191+ w.view_state.scroll_y [cfg.id_track] = offset
192192 }
193193 }
194194 }
@@ -219,7 +219,7 @@ fn (cfg &ScrollbarCfg) amend_layout(mut layout Layout, mut w Window) {
219219 thumb_width := f32_clamp (t_width, min_thumb_size, layout.shape.width)
220220
221221 available_width := layout.shape.width - thumb_width
222- scroll_offset := - w.view_state.offset_x_state [cfg.id_track]
222+ scroll_offset := - w.view_state.scroll_x [cfg.id_track]
223223 offset := if available_width == 0 {
224224 0
225225 } else {
@@ -247,7 +247,7 @@ fn (cfg &ScrollbarCfg) amend_layout(mut layout Layout, mut w Window) {
247247 thumb_height := f32_clamp (t_height, min_thumb_size, layout.shape.height)
248248
249249 available_height := layout.shape.height - thumb_height
250- scroll_offset := - w.view_state.offset_y_state [cfg.id_track]
250+ scroll_offset := - w.view_state.scroll_y [cfg.id_track]
251251 offset := if available_height == 0 {
252252 0
253253 } else {
@@ -307,7 +307,7 @@ fn find_layout_by_id_scroll(layout &Layout, id_scroll u32) ?Layout {
307307fn offset_mouse_change_x (layout & Layout, mouse_x f32 , id_scroll u32 , w & Window) f32 {
308308 total_width := content_width (layout)
309309 shape_width := layout.shape.width - layout.shape.padding.width ()
310- old_offset := w.view_state.offset_x_state [id_scroll]
310+ old_offset := w.view_state.scroll_x [id_scroll]
311311 new_offset := mouse_x * (total_width / shape_width)
312312 offset := old_offset - new_offset
313313 return f32_min (0 , f32_max (offset, shape_width - total_width))
@@ -327,7 +327,7 @@ fn offset_mouse_change_x(layout &Layout, mouse_x f32, id_scroll u32, w &Window)
327327fn offset_mouse_change_y (layout & Layout, mouse_y f32 , id_scroll u32 , w & Window) f32 {
328328 total_height := content_height (layout)
329329 shape_height := layout.shape.height - layout.shape.padding.height ()
330- old_offset := w.view_state.offset_y_state [id_scroll]
330+ old_offset := w.view_state.scroll_y [id_scroll]
331331 new_offset := mouse_y * (total_height / shape_height)
332332 offset := old_offset - new_offset
333333 return f32_min (0 , f32_max (offset, shape_height - total_height))
@@ -352,7 +352,7 @@ fn offset_from_mouse_x(layout &Layout, mouse_x f32, id_scroll u32, mut w Window)
352352 if percent > = 0.97 {
353353 percent = 1
354354 }
355- w.view_state.offset_x_state [id_scroll] = - percent * (total_width - sb.shape.width)
355+ w.view_state.scroll_x [id_scroll] = - percent * (total_width - sb.shape.width)
356356 }
357357}
358358
@@ -375,7 +375,7 @@ fn offset_from_mouse_y(layout &Layout, mouse_y f32, id_scroll u32, mut w Window)
375375 if percent > = 0.97 {
376376 percent = 1
377377 }
378- w.view_state.offset_y_state [id_scroll] = - percent * (total_height - sb.shape.height)
378+ w.view_state.scroll_y [id_scroll] = - percent * (total_height - sb.shape.height)
379379 }
380380}
381381
@@ -393,8 +393,8 @@ fn scroll_horizontal(layout &Layout, delta f32, mut w Window) bool {
393393 if v_id > 0 {
394394 // scrollable region does not including padding
395395 max_offset := f32_min (0 , layout.shape.width - layout.shape.padding.width () - content_width (layout))
396- offset_x := w.view_state.offset_x_state [v_id] + delta * gui_theme.scroll_multiplier
397- w.view_state.offset_x_state [v_id] = f32_clamp (offset_x, max_offset, 0 )
396+ offset_x := w.view_state.scroll_x [v_id] + delta * gui_theme.scroll_multiplier
397+ w.view_state.scroll_x [v_id] = f32_clamp (offset_x, max_offset, 0 )
398398 return true
399399 }
400400 return false
@@ -414,8 +414,8 @@ fn scroll_vertical(layout &Layout, delta f32, mut w Window) bool {
414414 if v_id > 0 {
415415 // scrollable region does not including padding
416416 max_offset := f32_min (0 , layout.shape.height - layout.shape.padding.height () - content_height (layout))
417- offset_y := w.view_state.offset_y_state [v_id] + delta * gui_theme.scroll_multiplier
418- w.view_state.offset_y_state [v_id] = f32_clamp (offset_y, max_offset, 0 )
417+ offset_y := w.view_state.scroll_y [v_id] + delta * gui_theme.scroll_multiplier
418+ w.view_state.scroll_y [v_id] = f32_clamp (offset_y, max_offset, 0 )
419419 return true
420420 }
421421 return false
0 commit comments