@@ -267,7 +267,8 @@ void Slider::_notification(int p_what) {
267
267
double ratio = Math::is_nan (get_as_ratio ()) ? 0 : get_as_ratio ();
268
268
269
269
Ref<StyleBox> style = theme_cache.slider_style ;
270
- Ref<Texture2D> tick = theme_cache.tick_icon ;
270
+ Ref<Texture2D> tick_bottom = theme_cache.tick_bottom_icon ;
271
+ Ref<Texture2D> tick_top = theme_cache.tick_top_icon ;
271
272
272
273
bool highlighted = editable && (mouse_inside || has_focus ());
273
274
Ref<Texture2D> grabber;
@@ -296,13 +297,17 @@ void Slider::_notification(int p_what) {
296
297
grabber_area->draw (ci, Rect2i (Point2i ((size.width - widget_width) / 2 , Math::round (size.height - areasize * ratio - grabber->get_height () / 2 + grabber_shift)), Size2i (widget_width, Math::round (areasize * ratio + grabber->get_height () / 2 - grabber_shift))));
297
298
298
299
if (ticks > 1 ) {
299
- int grabber_offset = (grabber->get_height () / 2 - tick->get_height () / 2 );
300
+ int grabber_offset_bottom = (grabber->get_height () / 2 - tick_bottom->get_height () / 2 );
301
+ int grabber_offset_top = (grabber->get_height () / 2 - tick_top->get_height () / 2 );
300
302
for (int i = 0 ; i < ticks; i++) {
301
303
if (!ticks_on_borders && (i == 0 || i + 1 == ticks)) {
302
304
continue ;
303
305
}
304
- int ofs = (i * areasize / (ticks - 1 )) + grabber_offset - grabber_shift;
305
- tick->draw (ci, Point2i ((size.width - widget_width) / 2 , ofs));
306
+ int ofs_bottom = (i * areasize / (ticks - 1 )) + grabber_offset_bottom - grabber_shift;
307
+ tick_bottom->draw (ci, Point2i (widget_width + (size.width - widget_width) / 2 + theme_cache.tick_bottom_offset , ofs_bottom));
308
+
309
+ int ofs_top = (i * areasize / (ticks - 1 )) + grabber_offset_top - grabber_shift;
310
+ tick_top->draw (ci, Point2i ((size.width - widget_width) / 2 - tick_top->get_width () - theme_cache.tick_top_offset , ofs_top));
306
311
}
307
312
}
308
313
grabber->draw (ci, Point2i (size.width / 2 - grabber->get_width () / 2 + theme_cache.grabber_offset , size.height - ratio * areasize - grabber->get_height () + grabber_shift));
@@ -321,13 +326,17 @@ void Slider::_notification(int p_what) {
321
326
}
322
327
323
328
if (ticks > 1 ) {
324
- int grabber_offset = (grabber->get_width () / 2 - tick->get_width () / 2 );
329
+ int grabber_offset_bottom = (grabber->get_width () / 2 - tick_bottom->get_width () / 2 );
330
+ int grabber_offset_top = (grabber->get_width () / 2 - tick_top->get_width () / 2 );
325
331
for (int i = 0 ; i < ticks; i++) {
326
332
if ((!ticks_on_borders) && ((i == 0 ) || ((i + 1 ) == ticks))) {
327
333
continue ;
328
334
}
329
- int ofs = (i * areasize / (ticks - 1 )) + grabber_offset + grabber_shift;
330
- tick->draw (ci, Point2i (ofs, (size.height - widget_height) / 2 ));
335
+ int ofs_bottom = (i * areasize / (ticks - 1 )) + grabber_offset_bottom + grabber_shift;
336
+ tick_bottom->draw (ci, Point2i (ofs_bottom, widget_height + (size.height - widget_height) / 2 + theme_cache.tick_bottom_offset ));
337
+
338
+ int ofs_top = (i * areasize / (ticks - 1 )) + grabber_offset_top + grabber_shift;
339
+ tick_top->draw (ci, Point2i (ofs_top, (size.height - widget_height) / 2 - tick_top->get_height () - theme_cache.tick_top_offset ));
331
340
}
332
341
}
333
342
grabber->draw (ci, Point2i ((rtl ? 1 - ratio : ratio) * areasize + grabber_shift, size.height / 2 - grabber->get_height () / 2 + theme_cache.grabber_offset ));
@@ -419,10 +428,13 @@ void Slider::_bind_methods() {
419
428
BIND_THEME_ITEM_CUSTOM (Theme::DATA_TYPE_ICON, Slider, grabber_icon, " grabber" );
420
429
BIND_THEME_ITEM_CUSTOM (Theme::DATA_TYPE_ICON, Slider, grabber_hl_icon, " grabber_highlight" );
421
430
BIND_THEME_ITEM_CUSTOM (Theme::DATA_TYPE_ICON, Slider, grabber_disabled_icon, " grabber_disabled" );
422
- BIND_THEME_ITEM_CUSTOM (Theme::DATA_TYPE_ICON, Slider, tick_icon, " tick" );
431
+ BIND_THEME_ITEM_CUSTOM (Theme::DATA_TYPE_ICON, Slider, tick_bottom_icon, " tick_bottom" );
432
+ BIND_THEME_ITEM_CUSTOM (Theme::DATA_TYPE_ICON, Slider, tick_top_icon, " tick_top" );
423
433
424
434
BIND_THEME_ITEM (Theme::DATA_TYPE_CONSTANT, Slider, center_grabber);
425
435
BIND_THEME_ITEM (Theme::DATA_TYPE_CONSTANT, Slider, grabber_offset);
436
+ BIND_THEME_ITEM (Theme::DATA_TYPE_CONSTANT, Slider, tick_bottom_offset);
437
+ BIND_THEME_ITEM (Theme::DATA_TYPE_CONSTANT, Slider, tick_top_offset);
426
438
}
427
439
428
440
Slider::Slider (Orientation p_orientation) {
0 commit comments