Made invalidate args so we can pass source and invalidate type

Rebuild does not propagate to parent
This commit is contained in:
Lars Brubaker 2018-05-22 16:17:13 -07:00
parent 28b55b73a5
commit ff6e220b4c
21 changed files with 60 additions and 37 deletions

View file

@ -326,13 +326,16 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
return positionToAlignTo + extraOffset;
}
protected override void OnInvalidate()
public override void OnInvalidate(InvalidateArgs invalidateType)
{
if (!Rebuilding)
if ((invalidateType.InvalidateType == InvalidateType.Content
|| invalidateType.InvalidateType == InvalidateType.Matrix)
&& invalidateType.Source != this
&& !Rebuilding)
{
Rebuild(null);
}
base.OnInvalidate();
base.OnInvalidate(invalidateType);
}
public override void Rebuild(UndoBuffer undoBuffer)
@ -435,8 +438,6 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
});
Rebuilding = false;
base.Rebuild(undoBuffer);
}
public override void Remove(UndoBuffer undoBuffer)

View file

@ -94,7 +94,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
list.Add(next);
}
});
this.Invalidate();
this.Invalidate(new InvalidateArgs(this, InvalidateType.Content));
}
public override void Remove(UndoBuffer undoBuffer)

View file

@ -124,8 +124,18 @@ namespace MatterHackers.MatterControl.DesignTools
}
Rebuilding = false;
// Let the base know it needs to rebuild
base.Rebuild(undoBuffer);
}
public override void OnInvalidate(InvalidateArgs invalidateType)
{
if ((invalidateType.InvalidateType == InvalidateType.Content
|| invalidateType.InvalidateType == InvalidateType.Matrix)
&& invalidateType.Source != this
&& !Rebuilding)
{
Rebuild(null);
}
base.OnInvalidate(invalidateType);
}
}
}

View file

@ -107,10 +107,17 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
});
}
protected override void OnInvalidate()
public override void OnInvalidate(InvalidateArgs invalidateType)
{
if ((invalidateType.InvalidateType == InvalidateType.Content
|| invalidateType.InvalidateType == InvalidateType.Matrix)
&& invalidateType.Source != this
&& !Rebuilding)
{
Rebuild(null);
}
// If the child bounds changed than adjust the scale control
base.OnInvalidate();
base.OnInvalidate(invalidateType);
}
public static FitToBounds3D Create(IObject3D itemToFit)
@ -145,7 +152,6 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
}
Rebuilding = false;
base.Rebuild(undoBuffer);
}
private void AdjustChildSize(object sender, EventArgs e)

View file

@ -112,8 +112,19 @@ namespace MatterHackers.MatterControl.DesignTools
transformedMesh.CalculateNormals();
Rebuilding = false;
base.Rebuild(undoBuffer);
}
}
public override void OnInvalidate(InvalidateArgs invalidateType)
{
if ((invalidateType.InvalidateType == InvalidateType.Content
|| invalidateType.InvalidateType == InvalidateType.Matrix)
&& invalidateType.Source != this
&& !Rebuilding)
{
Rebuild(null);
}
base.OnInvalidate(invalidateType);
}
}
}