1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 09:16:01 +08:00

Fixed draging the graph editor window around offseting nodes in the graph

This commit is contained in:
Jeroen van de Haterd 2019-01-23 20:47:01 +01:00
parent ab87555c63
commit 5e182fe073

View File

@ -68,11 +68,15 @@ namespace XNodeEditor {
public void BeginZoomed() { public void BeginZoomed() {
GUI.EndGroup(); GUI.EndGroup();
Rect position = new Rect(this.position);
position.x = 0;
position.y = topPadding;
Rect clippedArea = ScaleSizeBy(position, zoom, TopLeft(position)); Rect clippedArea = ScaleSizeBy(position, zoom, TopLeft(position));
GUI.BeginGroup(clippedArea); GUI.BeginGroup(clippedArea);
_prevGuiMatrix = GUI.matrix; _prevGuiMatrix = GUI.matrix;
Matrix4x4 translation = Matrix4x4.TRS(TopLeft(clippedArea), Quaternion.identity, Vector3.one); Matrix4x4 translation = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one);
Matrix4x4 scale = Matrix4x4.Scale(new Vector3(1.0f / zoom, 1.0f / zoom, 1.0f)); Matrix4x4 scale = Matrix4x4.Scale(new Vector3(1.0f / zoom, 1.0f / zoom, 1.0f));
GUI.matrix = translation * scale * translation.inverse * GUI.matrix; GUI.matrix = translation * scale * translation.inverse * GUI.matrix;