Пример #1
0
        public MultiTouchProcessResult Process(MultiTouchPointerEventData eventData, Win10TouchInputModule module)
        {
            GestureData = GetGestureData(eventData);

            int touchCount = eventData.touchCluster.Count;

            if (touchCount < MinimumFingers || touchCount > MaximumFingers)
            {
                Reset(eventData);
                return(MultiTouchProcessResult.NotProcessed);         // Wrong touch count, don't check
            }

            if (touchCount != GestureData.PriorCluster.Count)
            {
                Reset(eventData);
            }

            bool anyEvent = false;

            if (HasPriorData)
            {
                NormalizedPriorCluster.CopyFrom(GestureData.PriorCluster);
                NormalizedPriorCluster.NormalizeForCentroidDelta(eventData.touchCluster);
                EvaluateRelativeMotion(eventData);
                anyEvent = CheckPan(eventData) || CheckRotate(eventData) || CheckPinch(eventData);
            }

            if (!HasPriorData || anyEvent)
            {
                GestureData.PriorCluster.CopyFrom(eventData.touchCluster);
            }
            return(anyEvent ? ResultIfEventSent : ResultIfTouchCountMatches);
        }
Пример #2
0
        private void ClearPointerPressOrDrag(MultiTouchPointerEventData eventData)
        {
            if (!eventData.singleTouchProcessingEnabled)
            {
                return;
            }

            Win10TouchInputModule module;

            if (Win10TouchInputModule.TryGetCurrentWin10TouchInputModule(out module))
            {
                module.CancelSingleTouchProcessing(eventData);
            }
        }
Пример #3
0
        // Update is called once per frame
        protected void Update()
        {
            _sb.AppendFormat("Alt-L({0}) -R({1}) -GR({2})\n", Input.GetKey(KeyCode.LeftAlt), Input.GetKey(KeyCode.RightAlt), Input.GetKey(KeyCode.AltGr));
            _sb.AppendFormat("Ctl-L({0}) -R({1})\n", Input.GetKey(KeyCode.LeftControl), Input.GetKey(KeyCode.RightControl));
            _sb.AppendFormat("Shift-L({0}) -R({1})\n", Input.GetKey(KeyCode.LeftShift), Input.GetKey(KeyCode.RightShift));

            Win10TouchInputModule inputModule;

            if (Win10TouchInputModule.TryGetCurrentWin10TouchInputModule(out inputModule))
            {
                var tracker = inputModule.TouchTracker;
                for (int i = 0; i < tracker.SpanningTreeCount; i++)
                {
                    if (tracker.GetSpanningTree(i).GetTouchCluster(_cluster))
                    {
                        int activeId = _cluster.ActiveTouchId;
                        _sb.AppendFormat("Cluster ID {0} [\n", _cluster.ClusterId);
                        foreach (var touch in _cluster)
                        {
                            _sb.Append(touch.fingerId == activeId ? "**  " : "    ");
                            _sb.AppendLine(touch.ToString());
                        }
                        _sb.AppendLine("]");
                    }
                }

                _sb.Append(inputModule.DebugString).AppendLine();
            }

            foreach (var statusCollector in _collectors)
            {
                statusCollector.CollectStatus(_sb);
            }

            //DisplayControl.text = _sb.ToString();
            _sb.Length = 0;
        }