[longomatch] Move play's bondaries checks to the play object
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Move play's bondaries checks to the play object
- Date: Mon, 7 Jul 2014 11:22:55 +0000 (UTC)
commit 696c08e43437243d537e697d95cc9e62dae7f259
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri May 23 16:05:55 2014 +0200
Move play's bondaries checks to the play object
.../CanvasObject/CategoryTimeline.cs | 10 ++++------
LongoMatch.Drawing/CanvasObject/PlayObject.cs | 19 +++++++++++++------
2 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObject/CategoryTimeline.cs
b/LongoMatch.Drawing/CanvasObject/CategoryTimeline.cs
index f2ef55d..3e74f9d 100644
--- a/LongoMatch.Drawing/CanvasObject/CategoryTimeline.cs
+++ b/LongoMatch.Drawing/CanvasObject/CategoryTimeline.cs
@@ -30,11 +30,13 @@ namespace LongoMatch.Drawing.CanvasObject
Color background;
List<PlayObject> plays;
double secondsPerPixel;
+ Time maxTime;
- public CategoryTimeline (List<Play> plays, double offsetY, Color background)
+ public CategoryTimeline (List<Play> plays, Time maxTime, double offsetY, Color background)
{
this.background = background;
this.plays = new List<PlayObject> ();
+ this.maxTime = maxTime;
Visible = true;
CurrentTime = new Time (0);
OffsetY = offsetY;
@@ -68,18 +70,14 @@ namespace LongoMatch.Drawing.CanvasObject
public double OffsetY {
set;
- protected get;
- }
-
- public bool Selected {
get;
- set;
}
public void AddPlay (Play play) {
PlayObject po = new PlayObject (play);
po.OffsetY = OffsetY;
po.SecondsPerPixel = SecondsPerPixel;
+ po.MaxTime = maxTime;
plays.Add (po);
}
diff --git a/LongoMatch.Drawing/CanvasObject/PlayObject.cs b/LongoMatch.Drawing/CanvasObject/PlayObject.cs
index e6e0fe2..549b74a 100644
--- a/LongoMatch.Drawing/CanvasObject/PlayObject.cs
+++ b/LongoMatch.Drawing/CanvasObject/PlayObject.cs
@@ -38,6 +38,11 @@ namespace LongoMatch.Drawing.CanvasObject
set;
}
+ public Time MaxTime {
+ set;
+ protected get;
+ }
+
public double OffsetY {
get;
set;
@@ -48,11 +53,6 @@ namespace LongoMatch.Drawing.CanvasObject
protected get;
}
- public bool Selected {
- set;
- get;
- }
-
double StartX {
get {
return Common.TimeToPos (Play.Start, SecondsPerPixel);
@@ -105,7 +105,14 @@ namespace LongoMatch.Drawing.CanvasObject
public void Move (Selection sel, Point p, Point start) {
Time newTime = Common.PosToTime (p, SecondsPerPixel);
-
+
+ if (p.X < 0) {
+ p.X = 0;
+ } else if (newTime > MaxTime) {
+ p.X = Common.TimeToPos (MaxTime, SecondsPerPixel);
+ }
+ newTime = Common.PosToTime (p, SecondsPerPixel);
+
switch (sel.Position) {
case SelectionPosition.Left: {
if (newTime.MSeconds + MAX_TIME_SPAN > Play.Stop.MSeconds) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]