Просмотр исходного кода

Fixed clip() method so that it will also keep origin coordinates clipped

Marko Pintera 10 лет назад
Родитель
Сommit
821669e443

+ 2 - 2
BansheeUtility/Source/BsRect2I.cpp

@@ -73,8 +73,8 @@ namespace BansheeEngine
 		int newRight = std::min(x + width, clipRect.x + clipRect.width);
 		int newBottom = std::min(y + height, clipRect.y + clipRect.height);
 
-		x = newLeft;
-		y = newTop;
+		x = std::min(newLeft, newRight);
+		y = std::min(newTop, newBottom);
 		width = std::max(0, newRight - newLeft);
 		height = std::max(0, newBottom - newTop);
 	}

+ 1 - 0
MBansheeEditor/ProjectWindow.cs

@@ -1189,6 +1189,7 @@ namespace BansheeEditor
             Rect2I maxBounds = contentScrollArea.Layout.Bounds;
             maxBounds.x = 0;
             maxBounds.y = 0;
+
             selectionArea.Clip(maxBounds);
 
             return selectionArea;

+ 0 - 11
MBansheeEditor/Scene/SceneWindow.cs

@@ -168,19 +168,12 @@ namespace BansheeEditor
             bool draggedOver = DragDrop.DragInProgress || DragDrop.DropInProgress;
             draggedOver &= inBounds && DragDrop.Type == DragDropType.Resource;
 
-            if (DragDrop.DropInProgress)
-            {
-                Debug.Log("DROP IN PROGRESS: " + draggedOver + " - " + inBounds + " - " + DragDrop.Type);
-            }
-
             if (draggedOver)
             {
                 if (DragDrop.DropInProgress)
                 {
                     dragActive = false;
                     draggedSO = null;
-
-                    Debug.Log("DROPPED DRAGON");
                 }
                 else
                 {
@@ -219,8 +212,6 @@ namespace BansheeEditor
                             Renderable renderable = draggedSO.AddComponent<Renderable>();
                             renderable.Mesh = mesh;
                             renderable.SetMaterial(material);
-
-                            Debug.Log("CREATED DRAGON");
                         }
                     }
 
@@ -241,8 +232,6 @@ namespace BansheeEditor
 
                     if (draggedSO != null)
                     {
-                        Debug.Log("DESTROYED DRAGON");
-
                         draggedSO.Destroy();
                         draggedSO = null;
                     }

+ 2 - 2
MBansheeEngine/Math/Rect2I.cs

@@ -61,8 +61,8 @@ namespace BansheeEngine
 		    int newRight = Math.Min(x + width, clipRect.x + clipRect.width);
 		    int newBottom = Math.Min(y + height, clipRect.y + clipRect.height);
 
-		    x = newLeft;
-		    y = newTop;
+		    x = Math.Min(newLeft, newRight);
+		    y = Math.Min(newTop, newBottom);
 		    width = Math.Max(0, newRight - newLeft);
             height = Math.Max(0, newBottom - newTop);
 	    }