Пример #1
0
        public void AddShift(Position cursor_position, Point shift)
        {
            var indices = GetClosestShiftIndexes(cursor_position, 2);

            if (indices != null && indices[0].Item2 < Options.Instance.calibration_mode.zone_size)
            {
                Shifts[indices[0].Item1] = new ShiftItem(cursor_position, shift);
                if (indices.Count > 1 && indices[1].Item2 < Options.Instance.calibration_mode.zone_size)
                {
                    Shifts.RemoveAt(indices[1].Item1);
                }
            }
            else if (Shifts.Count() < Options.Instance.calibration_mode.max_zones_count)
            {
                Shifts.Add(new ShiftItem(cursor_position, shift));
            }
            else
            {
                Shifts[GetClosestPointOfHihestDensity(cursor_position)] = new ShiftItem(cursor_position, shift);
            }

            AsyncSaver.Save(Filepath, GetDeepCopy);
            NotifyOnChange();
        }