summaryrefslogtreecommitdiff
path: root/grapher/Models/Mouse/PointData.cs
blob: 12a6e733a5024dcdfa0eb1081bec4e8e9c11147e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace grapher.Models.Mouse
{
    public class PointData
    {
        public PointData()
        {
            Lock = new Object();
            X = new double[] { 0 };
            Y = new double[] { 0 };
        }

        public Object Lock { get; }

        private double[] X { get; set; }
        private double[] Y { get; set; }

        public void Set(double x, double y)
        {
            lock(Lock)
            {
                X[0] = x;
                Y[0] = y;
            }
        }

        public void Get(out double[] x, out double[] y)
        {
            lock(Lock)
            {
                x = X;
                y = Y;
            }
        }
    }
}