[longomatch] Implement zoom out with the Shift modifier
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Implement zoom out with the Shift modifier
- Date: Thu, 23 Apr 2015 15:20:53 +0000 (UTC)
commit 1204113b09080beb2e98edfbccd3ef4a98468700
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Apr 21 13:01:04 2015 +0200
Implement zoom out with the Shift modifier
LongoMatch.Drawing/Widgets/Blackboard.cs | 31 ++++++++++++++++++++++++++++-
LongoMatch.GUI/Gui/Dialog/DrawingTool.cs | 2 +-
2 files changed, 30 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Drawing/Widgets/Blackboard.cs b/LongoMatch.Drawing/Widgets/Blackboard.cs
index ef6d706..8adb021 100644
--- a/LongoMatch.Drawing/Widgets/Blackboard.cs
+++ b/LongoMatch.Drawing/Widgets/Blackboard.cs
@@ -40,6 +40,7 @@ namespace LongoMatch.Drawing.Widgets
DrawTool tool;
FrameDrawing drawing;
ISurface backbuffer;
+ ButtonModifier modifier;
bool handdrawing, inObjectCreation, inZooming;
double currentZoom;
@@ -54,6 +55,7 @@ namespace LongoMatch.Drawing.Widgets
FontSize = 12;
tool = DrawTool.Selection;
currentZoom = 1;
+ MinZoom = 1;
MaxZoom = 4;
}
@@ -176,6 +178,14 @@ namespace LongoMatch.Drawing.Widgets
}
/// <summary>
+ /// Sets the minimum zoom allowed
+ /// </summary>
+ public double MinZoom {
+ get;
+ set;
+ }
+
+ /// <summary>
/// Deletes the current selection from the frame drawing.
/// </summary>
public void DeleteSelection ()
@@ -365,8 +375,19 @@ namespace LongoMatch.Drawing.Widgets
handdrawing = true;
break;
case DrawTool.Zoom:
- Zoom (Math.Min (currentZoom + 0.1, MaxZoom), MoveStart);
- break;
+ {
+ double newZoom = currentZoom;
+
+ if (modifier == ButtonModifier.Shift) {
+ newZoom -= 0.1;
+ } else {
+ newZoom += 0.1;
+ }
+ newZoom = Math.Max (newZoom, MinZoom);
+ newZoom = Math.Min (newZoom, MaxZoom);
+ Zoom (newZoom, MoveStart);
+ break;
+ }
}
if (drawable != null) {
@@ -431,6 +452,12 @@ namespace LongoMatch.Drawing.Widgets
}
}
+ protected override void HandleLeftButton (Point coords, ButtonModifier modif)
+ {
+ modifier = modif;
+ base.HandleLeftButton (coords, modif);
+ }
+
void UpdateCounters ()
{
int index = 1;
diff --git a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
index d71baf6..8fb53cb 100644
--- a/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
+++ b/LongoMatch.GUI/Gui/Dialog/DrawingTool.cs
@@ -107,7 +107,7 @@ namespace LongoMatch.Gui.Dialog
stylecombobox.TooltipMarkup = Catalog.GetString ("Change the line style");
typecombobox.TooltipMarkup = Catalog.GetString ("Change the line style");
clearbutton.TooltipMarkup = Catalog.GetString ("Clear all drawings");
- zoombutton.TooltipMarkup = Catalog.GetString ("Zoom tool. Click to zoom in, Alt+Click
to zoom out");
+ zoombutton.TooltipMarkup = Catalog.GetString ("Zoom tool. Click to zoom in, Alt+Shift
to zoom out");
FillLineStyle ();
FillLineType ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]