[longomatch] Implement clipping while moving timenode objects
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Implement clipping while moving timenode objects
- Date: Thu, 23 Apr 2015 16:56:33 +0000 (UTC)
commit 5688537f64801e6ad86639643914f94ca6431d40
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu Apr 23 18:47:18 2015 +0200
Implement clipping while moving timenode objects
.../CanvasObjects/Timeline/TimeNodeObject.cs | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObjects/Timeline/TimeNodeObject.cs
b/LongoMatch.Drawing/CanvasObjects/Timeline/TimeNodeObject.cs
index 3ad6e12..d7ba80c 100644
--- a/LongoMatch.Drawing/CanvasObjects/Timeline/TimeNodeObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/Timeline/TimeNodeObject.cs
@@ -149,6 +149,8 @@ namespace LongoMatch.Drawing.CanvasObjects.Timeline
public void Move (Selection sel, Point p, Point start)
{
+ double diffX;
+
// Apply dragging restrictions
if (DraggingMode == NodeDraggingMode.None)
return;
@@ -165,6 +167,7 @@ namespace LongoMatch.Drawing.CanvasObjects.Timeline
}
Time newTime = Utils.PosToTime (p, SecondsPerPixel);
+ diffX = p.X - start.X;
if (p.X < 0) {
p.X = 0;
@@ -194,9 +197,12 @@ namespace LongoMatch.Drawing.CanvasObjects.Timeline
}
break;
case SelectionPosition.All:
- Time diff = Utils.PosToTime (new Point (p.X - start.X, p.Y), SecondsPerPixel);
- TimeNode.Start += diff;
- TimeNode.Stop += diff;
+ Time diff = Utils.PosToTime (new Point (diffX, p.Y), SecondsPerPixel);
+ if ((TimeNode.Start + diff) >= new Time (0) &&
+ (TimeNode.Start + diff) < MaxTime) {
+ TimeNode.Start += diff;
+ TimeNode.Stop += diff;
+ }
break;
}
movingPos = sel.Position;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]