Ejemplo n.º 1
0
        private void fusionDetection(Word currentWord, Hand secondHand)
        {
            if (!secondHand.grip)
            {
                foreach (var word in words.ToList())
                {
                    if (word != currentWord)
                    {
                        if ((word.typeWord == "top" && currentWord.typeWord == "bottom") || (currentWord.typeWord == "top" && word.typeWord == "bottom"))
                        {
                            if (ImageTools.getDistance(word, currentWord) < 4000)
                            {
                                //do fusion
                                currentWord.Fusion(word);
                                this.window.canvas.Children.Remove(word);
                                words.Remove(word);
                            }
                        }
                    }

                }
            }
        }
Ejemplo n.º 2
0
 private void transformationDetection(Word word, Hand secondHand)
 {
     // Detect if both hands are on the word
     if (secondHand.grip && secondHand.attachedObjectName == word.Name)
     {
         if (word.typeWord == "complete")
         {
             Word nouveau = word.Duplicate();
             words.Add(nouveau);
             this.window.canvas.Children.Add(nouveau);
             secondHand.attachedObjectName = nouveau.Name;
         }
     }
 }
Ejemplo n.º 3
0
        // method to manage to zoom detection
        private void zoomDetection(Word word, Hand secondHand)
        {
            //zoom if second hand gripping and without a text attached
            if (secondHand.grip && secondHand.attachedObjectName == "")
            {
                var distance = ImageTools.getDistance(hands.Item1, hands.Item2);
                var difference = distance - Hand.distance;
                var facteur = difference / 1000000 + 1;
                if (difference > 5000 && word.Width * facteur <= Word.MAX_WIDTH)
                {

                    word.Width *= facteur;
                    word.Height *= facteur;
                }
                else
                    if (difference < -5000 && word.Width * facteur >= Word.MIN_WIDTH)
                    {
                        word.Width *= facteur;
                        word.Height *= facteur;
                    }
                Hand.distance = distance;
            }
        }
Ejemplo n.º 4
0
        // method to manage to rotate detection
        private void rotationDetection(Word word, Hand secondHand)
        {
            //mzoom if second hand open and without a text attached
            if (secondHand.grip && secondHand.attachedObjectName == "")
            {
                double wordRotation = word.beginRotation;

                var newRotation = (wordRotation - ImageTools.getRotation(hands.Item1, hands.Item2)) % 360;
                word.RenderTransform = new RotateTransform(newRotation);
            }
        }