Fixes scrollbar positions on HiDPI display

* TextureRegion editor
* Ploygon2D UV editor
This commit is contained in:
Haoyu Qiu 2020-01-23 08:55:52 +08:00
parent 94d3bcbc9b
commit b420618c46
2 changed files with 6 additions and 4 deletions

View file

@ -92,6 +92,9 @@ void Polygon2DEditor::_notification(int p_what) {
b_snap_grid->set_icon(get_icon("Grid", "EditorIcons")); b_snap_grid->set_icon(get_icon("Grid", "EditorIcons"));
b_snap_enable->set_icon(get_icon("SnapGrid", "EditorIcons")); b_snap_enable->set_icon(get_icon("SnapGrid", "EditorIcons"));
uv_icon_zoom->set_texture(get_icon("Zoom", "EditorIcons")); uv_icon_zoom->set_texture(get_icon("Zoom", "EditorIcons"));
uv_vscroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
uv_hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
} break; } break;
case NOTIFICATION_VISIBILITY_CHANGED: { case NOTIFICATION_VISIBILITY_CHANGED: {
@ -1471,12 +1474,10 @@ Polygon2DEditor::Polygon2DEditor(EditorNode *p_editor) :
uv_vscroll = memnew(VScrollBar); uv_vscroll = memnew(VScrollBar);
uv_vscroll->set_step(0.001); uv_vscroll->set_step(0.001);
uv_edit_draw->add_child(uv_vscroll); uv_edit_draw->add_child(uv_vscroll);
uv_vscroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
uv_vscroll->connect("value_changed", this, "_uv_scroll_changed"); uv_vscroll->connect("value_changed", this, "_uv_scroll_changed");
uv_hscroll = memnew(HScrollBar); uv_hscroll = memnew(HScrollBar);
uv_hscroll->set_step(0.001); uv_hscroll->set_step(0.001);
uv_edit_draw->add_child(uv_hscroll); uv_edit_draw->add_child(uv_hscroll);
uv_hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
uv_hscroll->connect("value_changed", this, "_uv_scroll_changed"); uv_hscroll->connect("value_changed", this, "_uv_scroll_changed");
bone_scroll_main_vb = memnew(VBoxContainer); bone_scroll_main_vb = memnew(VBoxContainer);

View file

@ -736,6 +736,9 @@ void TextureRegionEditor::_notification(int p_what) {
zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons")); zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons")); zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons")); zoom_in->set_icon(get_icon("ZoomMore", "EditorIcons"));
vscroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
} break; } break;
case NOTIFICATION_VISIBILITY_CHANGED: { case NOTIFICATION_VISIBILITY_CHANGED: {
if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) { if (snap_mode == SNAP_AUTOSLICE && is_visible() && autoslice_is_dirty) {
@ -1022,12 +1025,10 @@ TextureRegionEditor::TextureRegionEditor(EditorNode *p_editor) {
vscroll = memnew(VScrollBar); vscroll = memnew(VScrollBar);
vscroll->set_step(0.001); vscroll->set_step(0.001);
edit_draw->add_child(vscroll); edit_draw->add_child(vscroll);
vscroll->set_anchors_and_margins_preset(PRESET_RIGHT_WIDE);
vscroll->connect("value_changed", this, "_scroll_changed"); vscroll->connect("value_changed", this, "_scroll_changed");
hscroll = memnew(HScrollBar); hscroll = memnew(HScrollBar);
hscroll->set_step(0.001); hscroll->set_step(0.001);
edit_draw->add_child(hscroll); edit_draw->add_child(hscroll);
hscroll->set_anchors_and_margins_preset(PRESET_BOTTOM_WIDE);
hscroll->connect("value_changed", this, "_scroll_changed"); hscroll->connect("value_changed", this, "_scroll_changed");
updating_scroll = false; updating_scroll = false;