Преглед на файлове

Fix preview not getting downsized

Equbuxu преди 2 години
родител
ревизия
9974b8bc0b
променени са 2 файла, в които са добавени 8 реда и са изтрити 1 реда
  1. 7 0
      src/PixiEditor.DrawingApi.Core/Numerics/RectI.cs
  2. 1 1
      src/PixiEditor/Models/Rendering/MemberPreviewUpdater.cs

+ 7 - 0
src/PixiEditor.DrawingApi.Core/Numerics/RectI.cs

@@ -276,6 +276,13 @@ public struct RectI : IEquatable<RectI>
         return ContainsInclusive(rect.TopLeft) && ContainsInclusive(rect.BottomRight);
     }
 
+
+    public readonly bool ContainsExclusive(RectI rect)
+    {
+        return ContainsExclusive(rect.TopLeft) && ContainsExclusive(rect.BottomRight);
+    }
+
+
     public readonly bool ContainsPixel(VecI pixelTopLeft) => ContainsPixel(pixelTopLeft.X, pixelTopLeft.Y);
     public readonly bool ContainsPixel(int pixelTopLeftX, int pixelTopLeftY)
     {

+ 1 - 1
src/PixiEditor/Models/Rendering/MemberPreviewUpdater.cs

@@ -258,7 +258,7 @@ internal class MemberPreviewUpdater
         if (targetLastCollection.TryGetValue(member.GuidValue, out RectI tightBounds))
             prevTightBounds = tightBounds;
 
-        if (prevTightBounds is not null && currentlyAffectedArea.GlobalArea is not null && prevTightBounds.Value.ContainsInclusive(currentlyAffectedArea.GlobalArea.Value))
+        if (prevTightBounds is not null && currentlyAffectedArea.GlobalArea is not null && prevTightBounds.Value.ContainsExclusive(currentlyAffectedArea.GlobalArea.Value))
         {
             // if the affected area is fully inside the previous tight bounds, the tight bounds couldn't possibly have changed
             return prevTightBounds.Value;