Exemple #1
0
        public void clearAll()
        {
            linesInProcess.Clear();
            LineStore.clearLines();

            this.SetNeedsDisplay();
        }
Exemple #2
0
 public void deleteLine(IntPtr sender)
 {
     LineStore.removeCompletedLine(selectedLine);
     selectedLine = null;
     UIGestureRecognizer[] grs = this.GestureRecognizers;
     foreach (UIGestureRecognizer gestRec in grs)
     {
         if (gestRec.GetType() != new UITapGestureRecognizer().GetType())
         {
             gestRec.Enabled = true;
         }
     }
     this.SetNeedsDisplay();
 }
Exemple #3
0
        public void endTouches(NSSet touches, UIEvent evt)
        {
            if (linesInProcess.Count < 1)
            {
                bool   firstTouch = true;
                Circle circle     = null;
                string key        = "";
                // Remove ending touches from Dictionary
                foreach (UITouch t in touches)
                {
                    if (firstTouch)
                    {
                        key = NSValue.ValueFromNonretainedObject(t).ToString();
                        // Find the circle for this touch
                        circlesInProcess.TryGetValue(key, out circle);
                        firstTouch = false;
                    }
                }
                // If this is a double tap, "line" will be nil
                // so make sure not to add it to the array
                if (circle != null)
                {
                    LineStore.addCompletedCircle(circle);
                    circlesInProcess.Remove(key);
                }
            }
            else
            {
                // Remove ending touches from Dictionary
                foreach (UITouch t in touches)
                {
                    string key = NSValue.ValueFromNonretainedObject(t).ToString();

                    // Find the line for this touch
                    Line line = new Line();
                    linesInProcess.TryGetValue(key, out line);

                    // If this is a double tap, "line" will be nil
                    // so make sure not to add it to the array
                    if (line != null)
                    {
                        LineStore.addCompletedLine(line);
                        linesInProcess.Remove(key);
                    }
                }
            }
            this.SetNeedsDisplay();
        }
Exemple #4
0
        public void endTouches(NSSet touches)
        {
            // Remove ending touches from Dictionary
            foreach (UITouch t in touches)
            {
                string key = NSValue.ValueFromNonretainedObject(t).ToString();

                // Find the line for this touch
                Line line = new Line();
                linesInProcess.TryGetValue(key, out line);

                // If this is a double tap, "line" will be nil
                // so make sure not to add it to the array
                if (line != null)
                {
                    LineStore.addCompletedLine(line);
                    linesInProcess.Remove(key);
                }
            }
            this.SetNeedsDisplay();
        }
Exemple #5
0
        void moveLine(UIPanGestureRecognizer gr)
        {
            // if no line selected, do nothing
            if (selectedLine == null)
            {
                return;
            }

            // When the pan gesture recognizer changes its position...
            if (gr.State == UIGestureRecognizerState.Changed)
            {
                // How far has the pan moved?
                CGPoint translation = gr.TranslationInView(this);

                // Add the translation to the current begin and end points of the line
                CGPoint begin = selectedLine.begin;
                CGPoint end   = selectedLine.end;
                begin.X += translation.X;
                begin.Y += translation.Y;
                end.X   += translation.X;
                end.Y   += translation.Y;

                // Set the new beginning and end points of the line
                selectedLine.begin = begin;
                selectedLine.end   = end;

                LineStore.updateCompletedLine(selectedLine);

                this.SetNeedsDisplay();

                gr.SetTranslation(new CGPoint(0, 0), this);
            }
            else if (gr.State == UIGestureRecognizerState.Ended)
            {
                selectedLine = null;
            }
        }
 public TouchViewController() : base()
 {
     LineStore.loadItemsFromArchive();
 }