mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 01:06:01 +08:00
UI Sharpness complete fix (#115)
Complete fix to address bluriness of the UI in the Node Editor Window. Previous fixes were not all encompassing and failed to account for now even dimensions of Editor Window.
This commit is contained in:
parent
c306701853
commit
5acb7e4ba8
@ -136,12 +136,7 @@ namespace XNodeEditor {
|
||||
Repaint();
|
||||
}
|
||||
} else if (e.button == 1 || e.button == 2) {
|
||||
Vector2 tempOffset = panOffset;
|
||||
tempOffset += e.delta * zoom;
|
||||
// Round value to increase crispyness of UI text
|
||||
tempOffset.x = Mathf.Round(tempOffset.x);
|
||||
tempOffset.y = Mathf.Round(tempOffset.y);
|
||||
panOffset = tempOffset;
|
||||
panOffset += e.delta * zoom;
|
||||
isPanning = true;
|
||||
}
|
||||
break;
|
||||
@ -276,6 +271,7 @@ namespace XNodeEditor {
|
||||
GenericMenu menu = new GenericMenu();
|
||||
NodeEditor.GetEditor(hoveredNode).AddContextMenuItems(menu);
|
||||
menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
|
||||
e.Use(); // Fixes copy/paste context menu appearing in Unity 5.6.6f2 - doesn't occur in 2018.3.2f1 Probably needs to be used in other places.
|
||||
} else if (!IsHoveringNode) {
|
||||
GenericMenu menu = new GenericMenu();
|
||||
graphEditor.AddContextMenuItems(menu);
|
||||
|
||||
@ -123,8 +123,9 @@ namespace XNodeEditor {
|
||||
|
||||
public Vector2 GridToWindowPositionNoClipped(Vector2 gridPosition) {
|
||||
Vector2 center = position.size * 0.5f;
|
||||
float xOffset = (center.x * zoom + (panOffset.x + gridPosition.x));
|
||||
float yOffset = (center.y * zoom + (panOffset.y + gridPosition.y));
|
||||
// UI Sharpness complete fix - Round final offset not panOffset
|
||||
float xOffset = Mathf.Round(center.x * zoom + (panOffset.x + gridPosition.x));
|
||||
float yOffset = Mathf.Round(center.y * zoom + (panOffset.y + gridPosition.y));
|
||||
return new Vector2(xOffset, yOffset);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user