Merge pull request #27699 from LATRio/fix_region_editor_margin

Fix TextureRegion margin bug
This commit is contained in:
Rémi Verschelde 2019-04-06 20:45:20 +02:00 committed by GitHub
commit c20c2870a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -205,10 +205,10 @@ void TextureRegionEditor::_region_draw() {
margins[3] = obj_styleBox->get_margin_size(MARGIN_RIGHT); margins[3] = obj_styleBox->get_margin_size(MARGIN_RIGHT);
} }
Vector2 pos[4] = { Vector2 pos[4] = {
mtx.basis_xform(Vector2(0, margins[0])) + Vector2(0, endpoints[0].y - draw_ofs.y), mtx.basis_xform(Vector2(0, margins[0])) + Vector2(0, endpoints[0].y - draw_ofs.y * draw_zoom),
-mtx.basis_xform(Vector2(0, margins[1])) + Vector2(0, endpoints[2].y - draw_ofs.y), -mtx.basis_xform(Vector2(0, margins[1])) + Vector2(0, endpoints[2].y - draw_ofs.y * draw_zoom),
mtx.basis_xform(Vector2(margins[2], 0)) + Vector2(endpoints[0].x - draw_ofs.x, 0), mtx.basis_xform(Vector2(margins[2], 0)) + Vector2(endpoints[0].x - draw_ofs.x * draw_zoom, 0),
-mtx.basis_xform(Vector2(margins[3], 0)) + Vector2(endpoints[2].x - draw_ofs.x, 0) -mtx.basis_xform(Vector2(margins[3], 0)) + Vector2(endpoints[2].x - draw_ofs.x * draw_zoom, 0)
}; };
draw_margin_line(edit_draw, pos[0], pos[0] + Vector2(edit_draw->get_size().x, 0)); draw_margin_line(edit_draw, pos[0], pos[0] + Vector2(edit_draw->get_size().x, 0));