mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Show image pan tip in image editor until first time panned
This commit is contained in:
parent
c1aeb24241
commit
a74d510365
3 changed files with 42 additions and 1 deletions
|
@ -98,6 +98,7 @@ public Color CurrentColor
|
|||
private int frameCount;
|
||||
private bool pause, isKeyAllowed;
|
||||
private RectangleAnimation regionAnimation;
|
||||
private TextAnimation editorPanTipAnimation;
|
||||
private Bitmap bmpBackgroundImage;
|
||||
private Cursor defaultCursor;
|
||||
|
||||
|
@ -119,6 +120,15 @@ public RegionCaptureForm(RegionCaptureMode mode, RegionCaptureOptions options)
|
|||
{
|
||||
Duration = TimeSpan.FromMilliseconds(200)
|
||||
};
|
||||
if (IsEditorMode && Options.ShowEditorPanTip)
|
||||
{
|
||||
editorPanTipAnimation = new TextAnimation()
|
||||
{
|
||||
Duration = TimeSpan.FromMilliseconds(5000),
|
||||
FadeOutDuration = TimeSpan.FromMilliseconds(1000),
|
||||
Text = "Tip: You can pan image by holding mouse middle button and dragging."
|
||||
};
|
||||
}
|
||||
|
||||
borderPen = new Pen(Color.Black);
|
||||
borderDotPen = new Pen(Color.White) { DashPattern = new float[] { 5, 5 } };
|
||||
|
@ -425,6 +435,11 @@ private void RegionCaptureForm_Shown(object sender, EventArgs e)
|
|||
|
||||
OnMoved();
|
||||
CenterCanvas();
|
||||
|
||||
if (IsEditorMode && Options.ShowEditorPanTip && editorPanTipAnimation != null)
|
||||
{
|
||||
editorPanTipAnimation.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void RegionCaptureForm_Resize(object sender, EventArgs e)
|
||||
|
@ -820,6 +835,12 @@ private void Draw(Graphics g)
|
|||
DrawCrosshair(g);
|
||||
}
|
||||
|
||||
// Draw image editor bottom tip
|
||||
if (IsEditorMode && Options.ShowEditorPanTip && editorPanTipAnimation != null && editorPanTipAnimation.Update())
|
||||
{
|
||||
DrawBottomTipAnimation(g, editorPanTipAnimation);
|
||||
}
|
||||
|
||||
// Draw menu tooltips
|
||||
if (IsAnnotationMode && ShapeManager.MenuTextAnimation.Update())
|
||||
{
|
||||
|
@ -950,8 +971,14 @@ private void DrawTextAnimation(Graphics g, TextAnimation textAnimation)
|
|||
{
|
||||
Size textSize = g.MeasureString(textAnimation.Text, infoFontMedium).ToSize();
|
||||
int padding = 3;
|
||||
Rectangle textRectangle = new Rectangle(textAnimation.Position.X, textAnimation.Position.Y, textSize.Width + padding * 2, textSize.Height + padding * 2);
|
||||
textSize.Width += padding * 2;
|
||||
textSize.Height += padding * 2;
|
||||
Rectangle textRectangle = new Rectangle(textAnimation.Position.X, textAnimation.Position.Y, textSize.Width, textSize.Height);
|
||||
DrawTextAnimation(g, textAnimation, textRectangle, padding);
|
||||
}
|
||||
|
||||
private void DrawTextAnimation(Graphics g, TextAnimation textAnimation, Rectangle textRectangle, int padding)
|
||||
{
|
||||
using (Brush backgroundBrush = new SolidBrush(Color.FromArgb((int)(textAnimation.Opacity * 175), Color.FromArgb(44, 135, 206))))
|
||||
using (Pen outerBorderPen = new Pen(Color.FromArgb((int)(textAnimation.Opacity * 175), Color.White)))
|
||||
using (Pen innerBorderPen = new Pen(Color.FromArgb((int)(textAnimation.Opacity * 175), Color.FromArgb(0, 81, 145))))
|
||||
|
@ -962,6 +989,17 @@ private void DrawTextAnimation(Graphics g, TextAnimation textAnimation)
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawBottomTipAnimation(Graphics g, TextAnimation textAnimation)
|
||||
{
|
||||
Size textSize = g.MeasureString(textAnimation.Text, infoFontMedium).ToSize();
|
||||
int padding = 5;
|
||||
textSize.Width += padding * 2;
|
||||
textSize.Height += padding * 2;
|
||||
int margin = 20;
|
||||
Rectangle textRectangle = new Rectangle(ClientArea.Width / 2 - textSize.Width / 2, ClientArea.Height - textSize.Height - margin, textSize.Width, textSize.Height);
|
||||
DrawTextAnimation(g, textAnimation, textRectangle, padding);
|
||||
}
|
||||
|
||||
private void WriteTips(StringBuilder sb)
|
||||
{
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__F1__Hide_tips);
|
||||
|
|
|
@ -82,5 +82,6 @@ public class RegionCaptureOptions
|
|||
public ImageEditorStartMode ImageEditorStartMode = ImageEditorStartMode.Maximized;
|
||||
public WindowState ImageEditorWindowState = new WindowState();
|
||||
public Color ImageEditorBackgroundColor = Color.FromArgb(200, 200, 200);
|
||||
public bool ShowEditorPanTip = true;
|
||||
}
|
||||
}
|
|
@ -777,6 +777,8 @@ private void StartPanning()
|
|||
IsPanning = true;
|
||||
Form.PanningStrech = new Point(0, 0);
|
||||
Form.Cursor = Cursors.SizeAll;
|
||||
|
||||
Options.ShowEditorPanTip = false;
|
||||
}
|
||||
|
||||
private void EndPanning()
|
||||
|
|
Loading…
Reference in a new issue