From 6602649bd7f9a9849b25fe55a5e5e8a617f40b70 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 13 Aug 2020 13:39:40 -0700 Subject: All works smoothly --- grapher/Models/Mouse/PointData.cs | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 grapher/Models/Mouse/PointData.cs (limited to 'grapher/Models/Mouse/PointData.cs') diff --git a/grapher/Models/Mouse/PointData.cs b/grapher/Models/Mouse/PointData.cs new file mode 100644 index 0000000..d0273d5 --- /dev/null +++ b/grapher/Models/Mouse/PointData.cs @@ -0,0 +1,46 @@ +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 (double[], double[]) Get() + { + double[] xRet; + double[] yRet; + + lock(Lock) + { + xRet = X; + yRet = Y; + } + + return (xRet, yRet); + } + } +} -- cgit v1.2.3 From 32323636b4b5390c114fc2a6d845b7621a983cdc Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 13 Aug 2020 20:56:41 -0700 Subject: Fix initial points, add poll time constant --- grapher/Models/Mouse/PointData.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'grapher/Models/Mouse/PointData.cs') diff --git a/grapher/Models/Mouse/PointData.cs b/grapher/Models/Mouse/PointData.cs index d0273d5..12a6e73 100644 --- a/grapher/Models/Mouse/PointData.cs +++ b/grapher/Models/Mouse/PointData.cs @@ -29,18 +29,13 @@ namespace grapher.Models.Mouse } } - public (double[], double[]) Get() + public void Get(out double[] x, out double[] y) { - double[] xRet; - double[] yRet; - lock(Lock) { - xRet = X; - yRet = Y; + x = X; + y = Y; } - - return (xRet, yRet); } } } -- cgit v1.2.3