public void TouchAdded(Touch t)
        {
            MTContainer cont = Elements.HitTest(t.TouchPoint, true);
            if (cont == null) return;

            cont.ObjectTouches.Add(t.TouchId, t);
            Touches.Add(t.TouchId, new TouchElement(t, cont));
        }
Пример #2
0
 public void TouchAdded(Touch t)
 {
     IMTContainer cont = Elements.HitTest(t.TouchPoint, true);
     if (cont == null) return;
     if (cont.IsBook() && !cont.IsHitTestVisible(t.TouchPoint))
     {
         var belowItemContainer = cont.GetBelowItem(t.TouchPoint, ++Elements.MaxZIndex);
         if (belowItemContainer != null)
             cont = belowItemContainer;
         else
             return;
     }
     cont.ObjectTouches.Add(t.TouchId, t);
     Touches.Add(t.TouchId, new TouchElement(t, cont));
 }
Пример #3
0
        /// <summary>
        /// Looks at a new touch and uses the ElementAssigner to match it to registered elements.
        /// Puts the touch into the AllTouches dictionary regardless of whether it matches an item or not.
        /// </summary>
        /// <param name="t">New touch object.</param>
        protected void TouchAdded(Touch t)
        {
            CheckConfigured();

            // This might update the UI, so need to be on UI Thread
            if (Thread.CurrentThread.ManagedThreadId != uiThreadId)
            {
                // this.Owner.Dispatcher.Invoke(new TouchAddDelegate(TouchAdded), new object[] { t });
                this.Owner.Dispatcher.Invoke((InvokeDelegate)delegate() { TouchAdded(t); });
                return;
            }

            // Even though we are on the same thread, we still need to lock
            // as the AllTouches collection is public.
            lock (syncRoot)
            {
                Assigner.TouchAdded(t);
                AllTouches.Add(t.TouchId, t);
            }
        }
Пример #4
0
        Touch buildTouch(ITouchData rawTouch)
        {
            TouchProperties prop;
            prop.Acceleration = rawTouch.Acceleration;
            prop.VelocityX = rawTouch.VelocityX;
            prop.VelocityY = rawTouch.VelocityY;

            PointF p = getTouchPoint(rawTouch);

            Touch t = new Touch(rawTouch.Id, p);
            t.Properties = prop;

            return t;
        }
Пример #5
0
 public TouchElement(Touch t, IMTContainer element)
 {
     Touch = t;
     MTElement = element;
 }