Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 |
|
---|
6 | namespace Microsoft.Research.DynamicDataDisplay.ViewportConstraints
|
---|
7 | {
|
---|
8 | public sealed class DateTimeHorizontalAxisConstraint : ViewportConstraint
|
---|
9 | {
|
---|
10 | private readonly double minSeconds = new TimeSpan(DateTime.MinValue.Ticks).TotalSeconds;
|
---|
11 | private readonly double maxSeconds = new TimeSpan(DateTime.MaxValue.Ticks).TotalSeconds;
|
---|
12 |
|
---|
13 | public override DataRect Apply(DataRect previousDataRect, DataRect proposedDataRect, Viewport2D viewport)
|
---|
14 | {
|
---|
15 | DataRect borderRect = DataRect.Create(minSeconds, proposedDataRect.YMin, maxSeconds, proposedDataRect.YMax);
|
---|
16 | if (proposedDataRect.IntersectsWith(borderRect))
|
---|
17 | {
|
---|
18 | DataRect croppedRect = DataRect.Intersect(proposedDataRect, borderRect);
|
---|
19 | return croppedRect;
|
---|
20 | }
|
---|
21 |
|
---|
22 | return previousDataRect;
|
---|
23 | }
|
---|
24 | }
|
---|
25 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.