/// <summary>
        /// Here when a ScatterViewItem moves.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnScatterDelta(object sender, ContainerManipulationDeltaEventArgs e)
        {
            // The ScatterViewItem moved, so synchronize visualizations appropriately.
            // Note that doing so is unnecessary when TagVisualizerEvents.Mode is set
            // to Auto.
            TagVisualizerEvents.Synchronize();

            // It's not necessary to check "is auto-update active?" and only call
            // Synchronize() if it isn't, because the Synchronize() method is smart
            // enough not to do redundant checking when auto-synchronize is on.
        }
        /// <summary>
        /// Handles the ScatterManipulationDelta event of the ScatterViewItem control. If the SVI is scaled down, restore the content to its original scale.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.Surface.Presentation.Controls.ContainerManipulationDeltaEventArgs"/> instance containing the event data.</param>
        private void ScatterViewItem_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
        {
            if (e == null || _springScaleX == null || _springScaleY == null || _springTranslateX == null || _springTranslateY == null)
            {
                return;
            }

            if (e.ScaleFactor < 1 && _overridingScatterViewItem)
            {
                // If the SVI is scaled down and this control is stealing touches, restore the size of the content and stop taking over.
                _springScaleX.To     = _springScaleY.To = 1;
                _springTranslateX.To = _springTranslateY.To = 0;
                _spring.Begin(this, true);
                _overridingScatterViewItem = false;
            }
        }
        private void Sites_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
        {
            try
            {
                myClone        = clone();
                myClone.Center = originalCenter;

                int   i        = pd2.FusionSiteLibrary.IndexOf(this);
                Point newPoint = SurfaceWindow1.transformCoords(this, pd2.PD2_SV);
                //pd2.SourceItems.Insert(i, copy);
                //pd2.SourceItems.Remove(this);

                pd2.PD2_siteLibrary.Items.Remove(this);
                pd2.PD2_siteLibrary.Items.Add(myClone);
                pd2.PD2_SV.Items.Add(this);
                this.Center = newPoint;

                this.ContainerManipulationDelta -= Sites_ContainerManipulationDelta;
            }
            catch (Exception exc) { Console.WriteLine(exc); }
        }
 /// <summary>
 /// Called when drawer is moved. 
 /// Meant to make it move only up and down.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DrawerSVI_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
 {
     //if ((e.ManipulationOrigin.Y > 20))
     //{
         DrawerSVI.Center = new Point(DRAWER_MIDDLE_X, DrawerSVI.Center.Y);
     //}
     Console.WriteLine("Touch" + e.ManipulationOrigin.Y);
     
 }
Beispiel #5
0
        private void SviScatterManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e) {
            if (_fe.IsFullScreen) return;
            //UpdateAssociatedLine();
            if (_fe == null || _fe.StartSize == null) return;
            if ((_fe.DockingStyle == DockingStyles.Right) &&
                (_svi.Center.X < Application.Current.MainWindow.ActualWidth - _fe.StartSize.Value.Width) &&
                !_fe.Large && !Undocked) {
                var delta = 1 +
                            (Application.Current.MainWindow.ActualWidth - _fe.StartSize.Value.Width -
                             _svi.Center.X)/_fe.DragScaleFactor;


                if (_fe.StartSize != null && !double.IsInfinity(delta)) {
                    _svi.Width = _fe.StartSize.Value.Width*delta;
                    _svi.Height = _fe.StartSize.Value.Height*delta;
                }
            }


            if ((_fe.DockingStyle == DockingStyles.Left) && (_svi.Center.X > _fe.StartSize.Value.Width) &&
                !_fe.Large && !Undocked) {
                var deltax = 1 + (_svi.Center.X - _fe.StartSize.Value.Width)/_fe.DragScaleFactor;
                var deltay = deltax;

                if (_fe.TargetSize.HasValue) {
                    if (_fe.SwitchWidth == _fe.TargetSize.Value.Width) {
                        deltay = ((_fe.TargetSize.Value.Height/_fe.StartSize.Value.Height)/
                                  (_fe.TargetSize.Value.Width/_fe.StartSize.Value.Width)*deltax);
                    }
                }

                if (_fe.StartSize != null && !double.IsInfinity(deltax)) {
                    _svi.Width = _fe.StartSize.Value.Width*deltax;
                    _svi.Height = _fe.StartSize.Value.Height*deltay;
                }
            }

            if ((_fe.DockingStyle == DockingStyles.Up) && (_svi.Center.Y > _fe.StartSize.Value.Width) &&
                !_fe.Large && !Undocked) {
                var deltax = 1 + (_svi.Center.Y - _fe.StartSize.Value.Width)/_fe.DragScaleFactor;
                var deltay = deltax;

                if (_fe.TargetSize.HasValue) {
                    if (_fe.SwitchWidth == _fe.TargetSize.Value.Width) {
                        deltay = ((_fe.TargetSize.Value.Height/_fe.StartSize.Value.Height)/
                                  (_fe.TargetSize.Value.Width/_fe.StartSize.Value.Width)*deltax);
                    }
                }

                if (_fe.StartSize != null && !double.IsInfinity(deltax)) {
                    _svi.Width = _fe.StartSize.Value.Width*deltax;
                    _svi.Height = _fe.StartSize.Value.Height*deltay;
                }
            }
        }
Beispiel #6
0
        private void _svi_ScatterManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e) {
            if (!_fe.CanDrag) return;
            hitResultsList = new List<FloatingElement>();
            // Set up a callback to receive the hit test result enumeration,
            // but no hit test filter enumeration.
            VisualTreeHelper.HitTest(Application.Current.MainWindow,
                null, // No hit test filtering.
                MyHitTestResult,
                new PointHitTestParameters(_svi.Center));

            if (hitResultsList != null && hitResultsList.Count > 0) {
                var fe = hitResultsList[0];
                if (_lastDragElement == null) {
                    fe.ForceDragEnter(this, _fe);
                }
                else {
                    if (fe != _lastDragElement) {
                        _lastDragElement.ForceDragLeave(this, _fe);
                        fe.ForceDragEnter(this, fe);
                    }
                }

                _lastDragElement = fe;
            }
            else {
                if (_lastDragElement != null) {
                    _lastDragElement.ForceDragLeave(this, _fe);
                }
                _lastDragElement = null;
            }
        }
Beispiel #7
0
 /// <summary>
 /// Handles the ScatterManipulationDelta event of the ItemProxy control.
 /// When an item is manipulated, update the attached properties which store its current state.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Microsoft.Surface.Presentation.Controls.ContainerManipulationDeltaEventArgs"/> instance containing the event data.</param>
 private void ScatterViewItem_ScatterManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
 {
     UpdateManipulation(sender as ScatterViewItem);
 }
 //Determines stopping/out of bounds conditions for manipulation of the shutter
 private void Level1_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
 {
     ScatterViewItem L1 = (ScatterViewItem)sender;
     //If its center is ever higher than its highest point, lower than its lowest point, or less than 50 higher than L2's center
     if ((L1.Center.Y < high.Y) || (L1.Center.Y > low.Y) || (L1.Center.Y > (sw1.L2.Center.Y - snapThreshold_L2)))
         L1.CancelManipulation();
     L1.Center = new Point(low.X, L1.Center.Y);
 }
Beispiel #9
0
 private void ScatterViewItem_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
 {
     GhostFrameManipulated();
 }
        private void Sites_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
        {
            try
            {
                myClone = clone();
                myClone.Center = originalCenter;

                int i = pd2.FusionSiteLibrary.IndexOf(this);
                Point newPoint = SurfaceWindow1.transformCoords(this, pd2.PD2_SV);
                //pd2.SourceItems.Insert(i, copy);
                //pd2.SourceItems.Remove(this);

                pd2.PD2_siteLibrary.Items.Remove(this);
                pd2.PD2_siteLibrary.Items.Add(myClone);
                pd2.PD2_SV.Items.Add(this);
                this.Center = newPoint;

                this.ContainerManipulationDelta -= Sites_ContainerManipulationDelta;
            }
            catch (Exception exc) { Console.WriteLine(exc); }
        }
        /// <summary>
        /// Handles the ScatterManipulationDelta event of the ScatterViewItem control. If the SVI is scaled down, restore the content to its original scale.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.Surface.Presentation.Controls.ContainerManipulationDeltaEventArgs"/> instance containing the event data.</param>
        private void ScatterViewItem_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
        {
            if (e == null || _springScaleX == null || _springScaleY == null || _springTranslateX == null || _springTranslateY == null)
            {
                return;
            }

            if (e.ScaleFactor < 1 && _overridingScatterViewItem)
            {
                // If the SVI is scaled down and this control is stealing touches, restore the size of the content and stop taking over.
                _springScaleX.To = _springScaleY.To = 1;
                _springTranslateX.To = _springTranslateY.To = 0;
                _spring.Begin(this, true);
                _overridingScatterViewItem = false;
            }
        }
 void item_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
 {
     Trace.WriteLine("Delta: " + e.HorizontalChange + ", " + e.VerticalChange);
     Trace.WriteLine("Orientation: " + e.RotationalChange);
 }
        /// <summary>
        /// Called when a ScatterViewItem is resized or moved
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnManipulation(object sender, ContainerManipulationDeltaEventArgs e)
        {
            ScatterViewItem item = (ScatterViewItem)sender;

            Menu.Menu menu = FindTheMenu((Canvas)(item.Content));
            if (menu == null)
            {
                return;
            }
            //if the menu has been moved to the edge of the screen
            if (item.Center.X <= -item.Width * 0.10 || item.Center.Y <= -item.Height * 0.10 || item.Center.Y >= this.Height + item.Height * 0.10 || item.Center.X >= this.Width + item.Width * 0.10)
            {

                if (menu != null)
                {
                    ((TreeMenu)menu).StopTimer();
                    MenuList.Remove(menu);
                    scatter.Items.Remove(item);

                    Log.Deleted(DeletionMethod.Swipe, menu);
                    ((TreeMenu)menu).Delete();
                }
            }
            else
            {
                if (e.ScaleFactor != 1)
                {
                    ((TreeMenu)menu).ReDraw(item.Width, item.Height);
                    ((TreeMenu)menu).SizeCrumbs();
                }
                menu.interactive = true;
            }
        }
        //Differentiates ElementMenu interaction from drag/drop interaction
        //Once minimum distance met, create copy to leave in original spot
        private void Part_ContainerManipulationDelta(object sender, ContainerManipulationDeltaEventArgs e)
        {
            try
            {
                Point x = this.Center;
                if (Math.Abs(Original.Y - x.Y) > 20 || Math.Abs(Original.X - x.X) > 20)
                {
                    Part p = sender as Part;
                    myClone = p.clone();
                    myClone.Center = Original; //Put clone in original's place
                    myClone.BorderBrush = p.BorderBrush;

                    ScatterView parent = p.Parent as ScatterView;
                    parent.Items.Add(myClone);

                    if (parent.Name == "L0_resultsSV")
                    { //Check if Level0 and give clone L0-appropriate behavior (e.g. dimming/disabling)
                        myClone.Opacity = 0.5; //Visually indicate not selectable
                        myClone.IsManipulationEnabled = false; //Disable manipulation until original's fate determined
                    }
                    else
                    { //Moving Part from L1 parts holder to L1Module build tabs; needs to be in L1_SV during transfer
                        p.changeParents_SV(parent, sw1.L1.L1_SV);
                    }

                    //Prevent it from continuously creating copies
                    p.ContainerManipulationDelta -= Part_ContainerManipulationDelta;
                }
            }
            catch (Exception exc) { Console.WriteLine("Part Delta \n" + exc); }
        }