mirror of
https://github.com/Siccity/xNode.git
synced 2026-02-06 23:34:54 +08:00
Fixed box selection not working correctly when zoomed
This commit is contained in:
parent
14c4d0b691
commit
6758a1a7c4
@ -284,14 +284,11 @@ namespace XNodeEditor {
|
||||
|
||||
//If dragging a selection box, add nodes inside to selection
|
||||
if (currentActivity == NodeActivity.DragGrid) {
|
||||
Vector2 startPos = GridToWindowPosition(dragBoxStart);
|
||||
Vector2 size = (mousePos - startPos) / zoom;
|
||||
Rect r = new Rect(dragBoxStart, size);
|
||||
Vector2 rpos = GridToWindowPosition(r.position);
|
||||
if (size.x < 0) { rpos.x += size.x; size.x = Mathf.Abs(size.x); }
|
||||
if (size.y < 0) { rpos.y += size.y; size.y = Mathf.Abs(size.y); }
|
||||
r.position = rpos;
|
||||
r.size = size;
|
||||
Vector2 startPos = GridToWindowPositionNoClipped(dragBoxStart);
|
||||
Vector2 size = mousePos - startPos;
|
||||
if (size.x < 0) { startPos.x += size.x; size.x = Mathf.Abs(size.x); }
|
||||
if (size.y < 0) { startPos.y += size.y; size.y = Mathf.Abs(size.y); }
|
||||
Rect r = new Rect(startPos, size);
|
||||
if (windowRect.Overlaps(r)) preSelection.Add(node);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user