Files
stgsharp/源代码/StgSharp/Controlling/Controls/MarkingLable.cs
T

51 lines
1.1 KiB
C#

using StgSharp.Controls;
using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace StgSharp.Controls
{
public class MarkingLabel : ControllingItem
{
public override vec4d[] TextureBox
{
get => marker.TextureCoord;
}
private vec2d _currentPosition, _movementVec;
private TimeFunction _movement;
private PlainGeometryMesh marker;
public void MoveTo(vec2d target)
{
Move(target - Position);
}
public void Move(vec2d movement)
{
if (!_movement.IsComplete)
{
Position = _currentPosition + _movement.Calculate() * _movementVec;
}
}
public MarkingLabel(PlainGeometryMesh marker, TimeFunction movement)
{
this.marker = marker;
_movement = movement;
}
public override IEnumerator<PlainGeometryMesh> GetEnumerator()
{
yield return marker;
}
}
}