2020-09-13 13:04:57 -07:00
|
|
|
|
/*
|
|
|
|
|
|
Copyright (c) 2019, Lars Brubaker, John Lewin
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright notice, this
|
|
|
|
|
|
list of conditions and the following disclaimer.
|
|
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
|
|
|
|
|
and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
The views and conclusions contained in the software and documentation are those
|
|
|
|
|
|
of the authors and should not be interpreted as representing official policies,
|
|
|
|
|
|
either expressed or implied, of the FreeBSD Project.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2020-09-13 14:17:33 -07:00
|
|
|
|
using System.ComponentModel;
|
2020-09-13 21:03:02 -07:00
|
|
|
|
using System.IO;
|
2021-04-19 18:00:48 -07:00
|
|
|
|
using System.Linq;
|
2020-09-13 21:03:02 -07:00
|
|
|
|
using System.Threading;
|
2020-09-13 13:04:57 -07:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using MatterHackers.Agg;
|
2020-09-13 21:03:02 -07:00
|
|
|
|
using MatterHackers.Agg.Platform;
|
2020-09-13 13:04:57 -07:00
|
|
|
|
using MatterHackers.Agg.UI;
|
|
|
|
|
|
using MatterHackers.DataConverters3D;
|
|
|
|
|
|
using MatterHackers.Localizations;
|
|
|
|
|
|
using MatterHackers.MatterControl.PartPreviewWindow;
|
|
|
|
|
|
using MatterHackers.MeshVisualizer;
|
|
|
|
|
|
using MatterHackers.PolygonMesh;
|
2020-09-13 21:03:02 -07:00
|
|
|
|
using MatterHackers.PolygonMesh.Processors;
|
2020-09-13 13:04:57 -07:00
|
|
|
|
using MatterHackers.RenderOpenGl;
|
|
|
|
|
|
using MatterHackers.VectorMath;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MatterHackers.MatterControl.DesignTools
|
|
|
|
|
|
{
|
2021-05-11 08:00:25 -07:00
|
|
|
|
[MarkDownDescription("Drag the spheres to the locations you would like to measure the distance between. The object on the bed will not print.")]
|
2021-04-17 22:35:53 -07:00
|
|
|
|
[HideMeterialAndColor]
|
2021-11-19 15:44:00 -08:00
|
|
|
|
public class MeasureToolObject3D : Object3D, IObject3DControlsProvider, ICustomEditorDraw, IEditorButtonProvider
|
2020-09-13 13:04:57 -07:00
|
|
|
|
{
|
2020-09-13 21:03:02 -07:00
|
|
|
|
private static Mesh shape = null;
|
2020-09-16 22:44:28 -07:00
|
|
|
|
private List<IObject3DControl> editorControls = null;
|
2021-04-21 18:07:44 -07:00
|
|
|
|
private GuiWidget containerWidget;
|
|
|
|
|
|
private GuiWidget textWidget;
|
2021-04-23 15:39:44 -07:00
|
|
|
|
private Object3DControlsLayer controlLayer;
|
2020-09-13 21:03:02 -07:00
|
|
|
|
|
2020-09-13 13:04:57 -07:00
|
|
|
|
public MeasureToolObject3D()
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = "Measure Tool".Localize();
|
|
|
|
|
|
Color = Color.FromHSL(.11, .98, .76);
|
2020-09-13 19:09:09 -07:00
|
|
|
|
|
2020-09-13 21:03:02 -07:00
|
|
|
|
if (shape == null)
|
|
|
|
|
|
{
|
2020-11-25 07:39:36 -08:00
|
|
|
|
using (Stream measureAmfStream = StaticData.Instance.OpenStream(Path.Combine("Stls", "measure_tool.stl")))
|
2020-09-13 21:03:02 -07:00
|
|
|
|
{
|
|
|
|
|
|
shape = StlProcessing.Load(measureAmfStream, CancellationToken.None);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-09-13 19:09:09 -07:00
|
|
|
|
|
2020-09-13 21:03:02 -07:00
|
|
|
|
Mesh = shape;
|
2020-09-13 13:04:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static async Task<MeasureToolObject3D> Create()
|
|
|
|
|
|
{
|
|
|
|
|
|
var item = new MeasureToolObject3D();
|
|
|
|
|
|
await item.Rebuild();
|
|
|
|
|
|
return item;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-19 15:44:00 -08:00
|
|
|
|
public bool DoEditorDraw(bool isSelected) => true;
|
|
|
|
|
|
|
2020-09-13 14:17:33 -07:00
|
|
|
|
[HideFromEditor]
|
2021-04-23 15:39:44 -07:00
|
|
|
|
private Vector3 worldStartPosition
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return LocalStartPosition.Transform(this.WorldMatrix());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
LocalStartPosition = value.Transform(this.WorldMatrix().Inverted);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HideFromEditor]
|
|
|
|
|
|
private Vector3 worldEndPosition
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return LocalEndPosition.Transform(this.WorldMatrix());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
LocalEndPosition = value.Transform(this.WorldMatrix().Inverted);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-09-13 13:04:57 -07:00
|
|
|
|
|
2020-09-13 14:17:33 -07:00
|
|
|
|
[HideFromEditor]
|
2021-04-27 07:19:02 -07:00
|
|
|
|
public Vector3 LocalStartPosition { get; set; }
|
2021-04-23 15:39:44 -07:00
|
|
|
|
|
|
|
|
|
|
[HideFromEditor]
|
2021-04-27 07:19:02 -07:00
|
|
|
|
public Vector3 LocalEndPosition { get; set; }
|
2021-04-23 15:39:44 -07:00
|
|
|
|
|
2020-09-13 13:04:57 -07:00
|
|
|
|
|
2020-09-13 14:17:33 -07:00
|
|
|
|
[ReadOnly(true)]
|
2021-04-17 22:35:53 -07:00
|
|
|
|
public double Distance { get; set; } = 0;
|
|
|
|
|
|
|
2020-09-13 19:09:09 -07:00
|
|
|
|
[HideFromEditor]
|
|
|
|
|
|
public bool PositionsHaveBeenSet { get; set; } = false;
|
|
|
|
|
|
|
2021-10-19 10:19:34 -07:00
|
|
|
|
public override bool Printable => false;
|
2020-09-13 21:03:02 -07:00
|
|
|
|
|
2020-09-16 22:44:28 -07:00
|
|
|
|
public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer)
|
2020-09-13 13:04:57 -07:00
|
|
|
|
{
|
2020-09-15 07:56:31 -07:00
|
|
|
|
if (editorControls == null)
|
2020-09-13 13:04:57 -07:00
|
|
|
|
{
|
2020-09-15 07:56:31 -07:00
|
|
|
|
editorControls = new List<IObject3DControl>
|
2020-09-13 14:17:33 -07:00
|
|
|
|
{
|
2021-04-29 11:17:31 -07:00
|
|
|
|
// Start Position Object
|
2020-09-15 07:56:31 -07:00
|
|
|
|
new TracedPositionObject3DControl(object3DControlsLayer,
|
|
|
|
|
|
this,
|
2021-04-29 11:17:31 -07:00
|
|
|
|
// get position function
|
2021-04-27 07:19:02 -07:00
|
|
|
|
() => worldStartPosition,
|
2021-04-29 11:17:31 -07:00
|
|
|
|
// set position function
|
2020-09-15 07:56:31 -07:00
|
|
|
|
(position) =>
|
|
|
|
|
|
{
|
2021-04-29 11:17:31 -07:00
|
|
|
|
if (!PositionsHaveBeenSet)
|
|
|
|
|
|
{
|
|
|
|
|
|
PositionsHaveBeenSet = true;
|
|
|
|
|
|
}
|
2020-09-15 07:56:31 -07:00
|
|
|
|
|
2021-04-23 15:39:44 -07:00
|
|
|
|
worldStartPosition = position;
|
2021-04-29 11:17:31 -07:00
|
|
|
|
Distance = (worldStartPosition - worldEndPosition).Length;
|
|
|
|
|
|
UiThread.RunOnIdle(() => Invalidate(InvalidateType.DisplayValues));
|
|
|
|
|
|
},
|
|
|
|
|
|
// edit complete function
|
|
|
|
|
|
(undoPosition) => SetUndoData(undoPosition, worldEndPosition)
|
|
|
|
|
|
),
|
|
|
|
|
|
// End Position Object
|
2020-09-15 07:56:31 -07:00
|
|
|
|
new TracedPositionObject3DControl(object3DControlsLayer,
|
|
|
|
|
|
this,
|
2021-04-29 11:17:31 -07:00
|
|
|
|
// get position function
|
2021-04-27 07:19:02 -07:00
|
|
|
|
() => worldEndPosition,
|
2021-04-29 11:17:31 -07:00
|
|
|
|
// set position function
|
2020-09-15 07:56:31 -07:00
|
|
|
|
(position) =>
|
|
|
|
|
|
{
|
2021-04-29 11:17:31 -07:00
|
|
|
|
if (!PositionsHaveBeenSet)
|
|
|
|
|
|
{
|
|
|
|
|
|
PositionsHaveBeenSet = true;
|
|
|
|
|
|
}
|
2020-09-15 07:56:31 -07:00
|
|
|
|
|
2021-04-23 15:39:44 -07:00
|
|
|
|
worldEndPosition = position;
|
2021-04-29 11:17:31 -07:00
|
|
|
|
Distance = (worldStartPosition - worldEndPosition).Length;
|
|
|
|
|
|
UiThread.RunOnIdle(() => Invalidate(InvalidateType.DisplayValues));
|
|
|
|
|
|
},
|
|
|
|
|
|
// edit complete function
|
|
|
|
|
|
(undoPosition) => SetUndoData(worldStartPosition, undoPosition)
|
|
|
|
|
|
),
|
2020-09-15 07:56:31 -07:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-02-25 17:42:31 -08:00
|
|
|
|
object3DControlsLayer.Object3DControls.Modify((list) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
list.AddRange(editorControls);
|
|
|
|
|
|
});
|
2020-09-13 13:04:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-04-29 11:17:31 -07:00
|
|
|
|
private void SetUndoData(Vector3 undoStartPosition, Vector3 undoEndPosition)
|
|
|
|
|
|
{
|
|
|
|
|
|
var doStartPosition = worldStartPosition;
|
|
|
|
|
|
var doEndPosition = worldEndPosition;
|
|
|
|
|
|
|
2021-11-26 07:41:43 -08:00
|
|
|
|
var undoBuffer = controlLayer?.Scene?.UndoBuffer;
|
|
|
|
|
|
if (undoBuffer != null)
|
2021-04-29 11:17:31 -07:00
|
|
|
|
{
|
2021-11-26 07:41:43 -08:00
|
|
|
|
undoBuffer.Add(new UndoRedoActions(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
worldStartPosition = undoStartPosition;
|
|
|
|
|
|
worldEndPosition = undoEndPosition;
|
|
|
|
|
|
this.Invalidate(InvalidateType.Matrix);
|
|
|
|
|
|
},
|
|
|
|
|
|
() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
worldStartPosition = doStartPosition;
|
|
|
|
|
|
worldEndPosition = doEndPosition;
|
|
|
|
|
|
this.Invalidate(InvalidateType.Matrix);
|
|
|
|
|
|
}));
|
|
|
|
|
|
}
|
2021-04-29 11:17:31 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-09-13 13:04:57 -07:00
|
|
|
|
public override async void OnInvalidate(InvalidateArgs invalidateType)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (invalidateType.InvalidateType.HasFlag(InvalidateType.Properties)
|
|
|
|
|
|
&& invalidateType.Source == this)
|
|
|
|
|
|
{
|
|
|
|
|
|
await Rebuild();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnInvalidate(invalidateType);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override Task Rebuild()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.DebugDepth("Rebuild");
|
|
|
|
|
|
|
|
|
|
|
|
using (RebuildLock())
|
|
|
|
|
|
{
|
|
|
|
|
|
using (new CenterAndHeightMaintainer(this))
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-05 22:01:50 -08:00
|
|
|
|
this.CancelAllParentBuilding();
|
2020-09-13 13:04:57 -07:00
|
|
|
|
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-11-19 15:44:00 -08:00
|
|
|
|
public void AddEditorTransparents(Object3DControlsLayer layer, List<Object3DView> transparentMeshes, DrawEventArgs e) { }
|
|
|
|
|
|
|
|
|
|
|
|
public void DrawEditor(Object3DControlsLayer controlLayer, DrawEventArgs e)
|
2020-09-13 13:04:57 -07:00
|
|
|
|
{
|
2021-04-27 07:19:02 -07:00
|
|
|
|
if (!PositionsHaveBeenSet)
|
|
|
|
|
|
{
|
|
|
|
|
|
var aabb = this.Mesh.GetAxisAlignedBoundingBox();
|
|
|
|
|
|
LocalStartPosition = aabb.Center + new Vector3(-10, 5, 3);
|
|
|
|
|
|
LocalEndPosition = aabb.Center + new Vector3(10, 5, 3);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var start = worldStartPosition;
|
|
|
|
|
|
var end = worldEndPosition;
|
2020-10-08 22:17:52 -07:00
|
|
|
|
|
2021-04-17 22:35:53 -07:00
|
|
|
|
var world = controlLayer.World;
|
2020-10-08 22:17:52 -07:00
|
|
|
|
// draw on top of anything that is already drawn
|
2021-04-17 22:35:53 -07:00
|
|
|
|
world.Render3DLine(start,
|
|
|
|
|
|
end,
|
|
|
|
|
|
Color.Black.WithAlpha(Constants.LineAlpha),
|
|
|
|
|
|
false,
|
2021-04-19 09:14:49 -07:00
|
|
|
|
GuiWidget.DeviceScale,
|
2021-04-17 22:35:53 -07:00
|
|
|
|
true,
|
|
|
|
|
|
true);
|
2020-10-08 22:17:52 -07:00
|
|
|
|
|
|
|
|
|
|
// Restore DepthTest
|
2021-04-20 07:57:51 -07:00
|
|
|
|
world.Render3DLine(start,
|
|
|
|
|
|
end,
|
|
|
|
|
|
Color.Black.WithAlpha(Constants.LineAlpha),
|
|
|
|
|
|
true,
|
|
|
|
|
|
GuiWidget.DeviceScale,
|
|
|
|
|
|
true,
|
|
|
|
|
|
true);
|
2021-04-17 22:35:53 -07:00
|
|
|
|
|
|
|
|
|
|
var screenStart = world.GetScreenPosition(start);
|
|
|
|
|
|
var screenEnd = world.GetScreenPosition(end);
|
|
|
|
|
|
|
|
|
|
|
|
var center = (screenStart + screenEnd) / 2;
|
|
|
|
|
|
|
|
|
|
|
|
if (PositionsHaveBeenSet)
|
|
|
|
|
|
{
|
2021-04-19 18:00:48 -07:00
|
|
|
|
CreateWidgetIfRequired(controlLayer);
|
2021-05-03 17:22:48 -07:00
|
|
|
|
// always keep the displayed distance the actual world distance
|
|
|
|
|
|
var worldStartPosition = LocalStartPosition.Transform(this.WorldMatrix());
|
|
|
|
|
|
var worldEndPosition = LocalEndPosition.Transform(this.WorldMatrix());
|
|
|
|
|
|
Distance = (worldStartPosition - worldEndPosition).Length;
|
2021-04-21 18:07:44 -07:00
|
|
|
|
textWidget.Text = Distance.ToString("0.##");
|
|
|
|
|
|
containerWidget.Position = center - new Vector2(containerWidget.LocalBounds.Width / 2, containerWidget.LocalBounds.Height / 2);
|
2021-04-27 07:19:02 -07:00
|
|
|
|
containerWidget.Visible = true;
|
2021-04-19 18:00:48 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-02 00:52:04 +00:00
|
|
|
|
public AxisAlignedBoundingBox GetEditorWorldspaceAABB(Object3DControlsLayer layer)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new AxisAlignedBoundingBox(new Vector3[] { worldStartPosition, worldEndPosition });
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-04-19 18:00:48 -07:00
|
|
|
|
private void CreateWidgetIfRequired(Object3DControlsLayer controlLayer)
|
|
|
|
|
|
{
|
2021-04-21 18:07:44 -07:00
|
|
|
|
if (containerWidget == null
|
|
|
|
|
|
|| containerWidget.Parents<SystemWindow>().Count() == 0)
|
2021-04-19 18:00:48 -07:00
|
|
|
|
{
|
2021-04-23 15:39:44 -07:00
|
|
|
|
this.controlLayer = controlLayer;
|
2021-04-19 18:00:48 -07:00
|
|
|
|
var theme = ApplicationController.Instance.MenuTheme;
|
2021-04-21 18:07:44 -07:00
|
|
|
|
containerWidget = new GuiWidget()
|
2021-04-17 22:35:53 -07:00
|
|
|
|
{
|
2021-04-21 08:44:07 -07:00
|
|
|
|
HAnchor = HAnchor.Fit,
|
2021-04-19 18:00:48 -07:00
|
|
|
|
VAnchor = VAnchor.Fit,
|
2021-04-21 08:44:07 -07:00
|
|
|
|
Padding = 5,
|
2021-04-19 18:00:48 -07:00
|
|
|
|
BackgroundColor = theme.BackgroundColor,
|
|
|
|
|
|
BackgroundRadius = new RadiusCorners(3 * GuiWidget.DeviceScale),
|
|
|
|
|
|
BorderColor = theme.PrimaryAccentColor,
|
|
|
|
|
|
BackgroundOutlineWidth = 1,
|
|
|
|
|
|
};
|
2021-04-17 22:35:53 -07:00
|
|
|
|
|
2021-04-21 18:07:44 -07:00
|
|
|
|
containerWidget.AddChild(textWidget = new TextWidget(Distance.ToString("0.##"))
|
2021-04-21 08:44:07 -07:00
|
|
|
|
{
|
|
|
|
|
|
TextColor = theme.TextColor,
|
|
|
|
|
|
PointSize = 10,
|
|
|
|
|
|
Selectable = true,
|
|
|
|
|
|
AutoExpandBoundsToText = true,
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2021-04-21 18:07:44 -07:00
|
|
|
|
controlLayer.GuiSurface.AddChild(containerWidget);
|
2021-04-17 22:35:53 -07:00
|
|
|
|
|
2021-04-20 07:57:51 -07:00
|
|
|
|
controlLayer.GuiSurface.AfterDraw += GuiSurface_AfterDraw;
|
2021-04-17 22:35:53 -07:00
|
|
|
|
|
2021-04-20 07:57:51 -07:00
|
|
|
|
void NumberWidget_MouseDown(object sender, MouseEventArgs e2)
|
2021-04-19 18:00:48 -07:00
|
|
|
|
{
|
|
|
|
|
|
controlLayer.Scene.SelectedItem = this;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-04-21 18:07:44 -07:00
|
|
|
|
containerWidget.MouseDown += NumberWidget_MouseDown;
|
2021-04-19 18:00:48 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-04-20 07:57:51 -07:00
|
|
|
|
private void GuiSurface_AfterDraw(object sender, DrawEventArgs e)
|
2021-04-19 18:00:48 -07:00
|
|
|
|
{
|
2021-04-23 15:39:44 -07:00
|
|
|
|
if (!controlLayer.Scene.Contains(this))
|
2021-04-19 18:00:48 -07:00
|
|
|
|
{
|
2021-04-21 18:07:44 -07:00
|
|
|
|
containerWidget.Close();
|
2021-04-20 07:57:51 -07:00
|
|
|
|
if (sender is GuiWidget guiWidget)
|
|
|
|
|
|
{
|
|
|
|
|
|
guiWidget.AfterDraw -= GuiSurface_AfterDraw;
|
|
|
|
|
|
}
|
2021-04-17 22:35:53 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IEnumerable<EditorButtonData> GetEditorButtonsData()
|
|
|
|
|
|
{
|
|
|
|
|
|
yield return new EditorButtonData()
|
|
|
|
|
|
{
|
|
|
|
|
|
Action = () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
Distance = 0;
|
2021-04-21 18:07:44 -07:00
|
|
|
|
if (containerWidget != null)
|
2021-04-20 07:57:51 -07:00
|
|
|
|
{
|
2021-04-21 18:07:44 -07:00
|
|
|
|
containerWidget.Visible = false;
|
2021-04-20 07:57:51 -07:00
|
|
|
|
}
|
2021-04-17 22:35:53 -07:00
|
|
|
|
PositionsHaveBeenSet = false;
|
|
|
|
|
|
UiThread.RunOnIdle(() => Invalidate(InvalidateType.DisplayValues));
|
|
|
|
|
|
},
|
|
|
|
|
|
HelpText = "Reset the line ends back to their starting positions".Localize(),
|
|
|
|
|
|
Name = "Reset".Localize(),
|
|
|
|
|
|
};
|
2020-09-13 13:04:57 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|