Fix T103739: Nodes pasted at wrong position with UI scale

This commit is contained in:
Leon Schittek 2023-01-09 11:37:27 -05:00 committed by Hans Goudey
parent 08b2d04021
commit 891fe70d7f
Notes: blender-bot 2023-02-14 09:02:41 +01:00
Referenced by issue #103739, Node Editor: Node pasted at double the mouse position
1 changed files with 1 additions and 2 deletions

View File

@ -257,11 +257,10 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
}
/* DPI factor needs to be removed when computing a View2D offset from drawing rects. */
center /= clipboard.nodes.size();
center /= UI_DPI_FAC;
float2 mouse_location;
RNA_property_float_get_array(op->ptr, offset_prop, mouse_location);
const float2 offset = mouse_location - center;
const float2 offset = (mouse_location - center) / UI_DPI_FAC;
for (bNode *new_node : node_map.values()) {
new_node->locx += offset.x;