Fixed "Add Sprite..." label overlapping with zoom controls
This commit is contained in:
parent
58ca9f17a2
commit
6d14251b0d
2 changed files with 18 additions and 12 deletions
|
@ -3971,9 +3971,9 @@ void CanvasItemEditor::_update_scrollbars() {
|
|||
updating_scroll = true;
|
||||
|
||||
// Move the zoom buttons
|
||||
Point2 zoom_hb_begin = Point2(5, 5);
|
||||
zoom_hb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2();
|
||||
zoom_hb->set_begin(zoom_hb_begin);
|
||||
Point2 controls_vb_begin = Point2(5, 5);
|
||||
controls_vb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2();
|
||||
controls_vb->set_begin(controls_vb_begin);
|
||||
|
||||
// Move and resize the scrollbars
|
||||
Size2 size = viewport->get_size();
|
||||
|
@ -5308,6 +5308,14 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
|||
scene_tree->set_anchors_and_margins_preset(Control::PRESET_WIDE);
|
||||
scene_tree->add_child(p_editor->get_scene_root());
|
||||
|
||||
controls_vb = memnew(VBoxContainer);
|
||||
controls_vb->set_begin(Point2(5, 5));
|
||||
|
||||
zoom_hb = memnew(HBoxContainer);
|
||||
// Bring the zoom percentage closer to the zoom buttons
|
||||
zoom_hb->add_constant_override("separation", Math::round(-8 * EDSCALE));
|
||||
controls_vb->add_child(zoom_hb);
|
||||
|
||||
viewport = memnew(CanvasItemEditorViewport(p_editor, this));
|
||||
viewport_scrollable->add_child(viewport);
|
||||
viewport->set_mouse_filter(MOUSE_FILTER_PASS);
|
||||
|
@ -5351,11 +5359,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
|
|||
v_scroll->connect("value_changed", this, "_update_scroll");
|
||||
v_scroll->hide();
|
||||
|
||||
zoom_hb = memnew(HBoxContainer);
|
||||
viewport->add_child(zoom_hb);
|
||||
zoom_hb->set_begin(Point2(5, 5));
|
||||
// Bring the zoom percentage closer to the zoom buttons
|
||||
zoom_hb->add_constant_override("separation", Math::round(-8 * EDSCALE));
|
||||
viewport->add_child(controls_vb);
|
||||
|
||||
zoom_minus = memnew(ToolButton);
|
||||
zoom_hb->add_child(zoom_minus);
|
||||
|
@ -5742,8 +5746,6 @@ void CanvasItemEditorViewport::_on_change_type_closed() {
|
|||
}
|
||||
|
||||
void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) const {
|
||||
label->set_position(get_global_position() + Point2(14, 14) * EDSCALE);
|
||||
label_desc->set_position(label->get_position() + Point2(0, label->get_size().height));
|
||||
bool add_preview = false;
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
String path = files[i];
|
||||
|
@ -6165,7 +6167,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
|
|||
label->add_color_override("font_color_shadow", Color(0, 0, 0, 1));
|
||||
label->add_constant_override("shadow_as_outline", 1 * EDSCALE);
|
||||
label->hide();
|
||||
editor->get_gui_base()->add_child(label);
|
||||
canvas_item_editor->get_controls_container()->add_child(label);
|
||||
|
||||
label_desc = memnew(Label);
|
||||
label_desc->set_text(TTR("Drag & drop + Shift : Add node as sibling\nDrag & drop + Alt : Change node type"));
|
||||
|
@ -6174,7 +6176,8 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte
|
|||
label_desc->add_constant_override("shadow_as_outline", 1 * EDSCALE);
|
||||
label_desc->add_constant_override("line_spacing", 0);
|
||||
label_desc->hide();
|
||||
editor->get_gui_base()->add_child(label_desc);
|
||||
canvas_item_editor->get_controls_container()->add_child(label_desc);
|
||||
|
||||
VS::get_singleton()->canvas_set_disable_scale(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -530,6 +530,7 @@ private:
|
|||
|
||||
void _button_toggle_anchor_mode(bool p_status);
|
||||
|
||||
VBoxContainer *controls_vb;
|
||||
HBoxContainer *zoom_hb;
|
||||
void _zoom_on_position(float p_zoom, Point2 p_position = Point2());
|
||||
void _update_zoom_label();
|
||||
|
@ -627,6 +628,8 @@ public:
|
|||
|
||||
Control *get_viewport_control() { return viewport; }
|
||||
|
||||
Control *get_controls_container() { return controls_vb; }
|
||||
|
||||
void update_viewport();
|
||||
|
||||
Tool get_current_tool() { return tool; }
|
||||
|
|
Loading…
Reference in a new issue