[longomatch] Scale player icons to fit them to the correct size
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Scale player icons to fit them to the correct size
- Date: Mon, 7 Jul 2014 11:26:22 +0000 (UTC)
commit c98d406720638dee42ad8689f67e29194ccd26f3
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri May 30 00:10:32 2014 +0200
Scale player icons to fit them to the correct size
LongoMatch.Drawing/Widgets/TeamTagger.cs | 32 +++++++++++++++++++++----
LongoMatch.GUI/Gui/Component/CodingWidget.cs | 3 +-
2 files changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch.Drawing/Widgets/TeamTagger.cs b/LongoMatch.Drawing/Widgets/TeamTagger.cs
index 0796beb..1fd11f2 100644
--- a/LongoMatch.Drawing/Widgets/TeamTagger.cs
+++ b/LongoMatch.Drawing/Widgets/TeamTagger.cs
@@ -37,9 +37,10 @@ namespace LongoMatch.Drawing.Widgets
TeamTemplate homeTeam, awayTeam;
Image background;
double currentWidth, currentHeight, scaleX, scaleY;
- Point offset;
double backgroundWidth;
+ Point offset;
MultiSelectionMode prevMode;
+ PlayersIconSize iconSize;
bool inSubs;
public TeamTagger (IWidget widget): base (widget)
@@ -130,10 +131,30 @@ namespace LongoMatch.Drawing.Widgets
}
}
+ PlayersIconSize BestIconSize (int[] formation) {
+ double width = backgroundWidth / NTeams;
+ double optWidth = width / formation.Count();
+ double optHeight = currentHeight / formation.Max();
+ double size = Math.Min (optWidth, optHeight);
+
+ if (size < (int) PlayersIconSize.Small) {
+ return PlayersIconSize.Smallest;
+ } else if (size < (int) PlayersIconSize.Medium) {
+ return PlayersIconSize.Small;
+ } else if (size < (int) PlayersIconSize.Large) {
+ return PlayersIconSize.Medium;
+ } else if (size < (int) PlayersIconSize.ExtraLarge) {
+ return PlayersIconSize.Large;
+ } else {
+ return PlayersIconSize.ExtraLarge;
+ }
+ }
+
void LoadTeam (TeamTemplate template, Team team) {
int index = 0;
double width, colWidth, offsetX;
Color color;
+ PlayersIconSize size = BestIconSize (template.Formation);
width = backgroundWidth / NTeams;
colWidth = width / template.Formation.Length;
@@ -162,7 +183,7 @@ namespace LongoMatch.Drawing.Widgets
for (int row=0; row < template.Formation[col]; row ++) {
Point p = new Point (colX, rowHeight * row + rowHeight / 2);
PlayerObject po = new PlayerObject (template [index], p);
- po.IconSize = PlayersIconSize.Large;
+ po.IconSize = size;
po.UnSelectedColor = color;
Objects.Add (po);
index ++;
@@ -171,14 +192,15 @@ namespace LongoMatch.Drawing.Widgets
}
}
+ /* Substitution players */
for (int i = index; i < template.Count; i++) {
PlayerObject po;
double x, y;
int reli = i - index;
- int size = (int)BenchIconSize;
+ int s = (int)BenchIconSize;
- x = size * (reli % PlayersPorRowInBench) + size / 2;
- y = size * (reli / PlayersPorRowInBench) + size / 2;
+ x = s * (reli % PlayersPorRowInBench) + s / 2;
+ y = s * (reli / PlayersPorRowInBench) + s / 2;
if (team == Team.VISITOR) {
x += BenchWidth + backgroundWidth;
}
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index 7967ff7..e2eead0 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -125,13 +125,14 @@ namespace LongoMatch.Gui.Component
timeline.Visible = value && AnalysisMode == VideoAnalysisMode.Timeline;
buttonswidget.Visible = value && (AnalysisMode ==
VideoAnalysisMode.ManualTagging ||
AnalysisMode ==
VideoAnalysisMode.PredefinedTagging);
-
+ drawingarea1.Visible = buttonswidget.Visible;
}
}
void HandleViewToggled (object sender, EventArgs e)
{
buttonswidget.Visible = autoTaggingMode.Active;
+ drawingarea1.Visible = buttonswidget.Visible;
timeline.Visible = timelineMode.Active;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]