Enforce a line length limit.
This commit is contained in:
@@ -82,8 +82,15 @@ namespace OpenRA.Widgets
|
||||
return ThumbRect.Contains(mi.Location);
|
||||
}
|
||||
|
||||
float ValueFromPx(int x) { return MinimumValue + (MaximumValue - MinimumValue) * (x - 0.5f * RenderBounds.Height) / (RenderBounds.Width - RenderBounds.Height); }
|
||||
protected int PxFromValue(float x) { return (int)(0.5f * RenderBounds.Height + (RenderBounds.Width - RenderBounds.Height) * (x - MinimumValue) / (MaximumValue - MinimumValue)); }
|
||||
float ValueFromPx(int x)
|
||||
{
|
||||
return MinimumValue + (MaximumValue - MinimumValue) * (x - 0.5f * RenderBounds.Height) / (RenderBounds.Width - RenderBounds.Height);
|
||||
}
|
||||
|
||||
protected int PxFromValue(float x)
|
||||
{
|
||||
return (int)(0.5f * RenderBounds.Height + (RenderBounds.Width - RenderBounds.Height) * (x - MinimumValue) / (MaximumValue - MinimumValue));
|
||||
}
|
||||
|
||||
public override Widget Clone() { return new SliderWidget(this); }
|
||||
|
||||
|
||||
@@ -82,7 +82,9 @@ namespace OpenRA.Widgets
|
||||
TextureChannel.Alpha);
|
||||
|
||||
var scale = Math.Min((float)RenderBounds.Width / video.Width, (float)RenderBounds.Height / video.Height * AspectRatio);
|
||||
videoOrigin = new float2(RenderBounds.X + (RenderBounds.Width - scale * video.Width) / 2, RenderBounds.Y + (RenderBounds.Height - scale * video.Height * AspectRatio) / 2);
|
||||
videoOrigin = new float2(
|
||||
RenderBounds.X + (RenderBounds.Width - scale * video.Width) / 2,
|
||||
RenderBounds.Y + (RenderBounds.Height - scale * video.Height * AspectRatio) / 2);
|
||||
|
||||
// Round size to integer pixels. Round up to be consistent with the scale calcuation.
|
||||
videoSize = new float2((int)Math.Ceiling(video.Width * scale), (int)Math.Ceiling(video.Height * AspectRatio * scale));
|
||||
|
||||
@@ -184,7 +184,8 @@ namespace OpenRA.Widgets
|
||||
}
|
||||
else if (o.TargetLocation != CPos.Zero)
|
||||
{
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
|
||||
world.AddFrameEndTask(w => w.Add(
|
||||
new SpriteEffect(worldRenderer.Position(worldRenderer.Viewport.ViewToWorldPx(mi.Location)), world, "moveflsh", "moveflash")));
|
||||
flashed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user