Esempio n. 1
0
 /// <summary>
 /// For requesting registered workspace to zoom in out from a point
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public virtual void OnRequestZoomToViewportPoint(object sender, ZoomEventArgs e)
 {
     if (RequestZoomToViewportPoint != null)
     {
         RequestZoomToViewportPoint(this, e);
     }
 }
Esempio n. 2
0
        internal void ZoomOutInternal()
        {
            var args = new ZoomEventArgs(-Configurations.ZoomIncrement);

            OnRequestZoomToViewportCenter(this, args);
            ResetFitViewToggle(null);
        }
Esempio n. 3
0
 /// <summary>
 /// For requesting registered workspace to zoom in or out to fitview
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public virtual void OnRequestZoomToFitView(object sender, ZoomEventArgs e)
 {
     if (RequestZoomToFitView != null)
     {
         RequestZoomToFitView(this, e);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// For requesting registered workspace to zoom in center
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnRequestZoomToViewportCenter(object sender, ZoomEventArgs e)
 {
     if (RequestZoomToViewportCenter != null)
     {
         RequestZoomToViewportCenter(this, e);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// For requesting registered workspace to zoom in or out to fitview
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnRequestZoomToFitView(object sender, ZoomEventArgs e)
 {
     if (RequestZoomToFitView != null)
     {
         RequestZoomToFitView(this, e);
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Used during open and workspace changes to set the zoom of the workspace
 /// </summary>
 /// <param name="sender">The object which triggers the event</param>
 /// <param name="e">The zoom event data.</param>
 internal virtual void OnZoomChanged(object sender, ZoomEventArgs e)
 {
     if (ZoomChanged != null)
     {
         //Debug.WriteLine(string.Format("Setting zoom to {0}", e.Zoom));
         ZoomChanged(this, e);
     }
 }
Esempio n. 7
0
 /// <summary>
 /// Used during open and workspace changes to set the zoom of the workspace
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public virtual void OnZoomChanged(object sender, ZoomEventArgs e)
 {
     if (ZoomChanged != null)
     {
         //Debug.WriteLine(string.Format("Setting zoom to {0}", e.Zoom));
         ZoomChanged(this, e);
     }
     dynSettings.Controller.DynamoViewModel.HideInfoBubble(null);
 }
Esempio n. 8
0
        internal void FitViewInternal()
        {
            // Get the offset and focus width & height (zoom if 100%)
            double minX, maxX, minY, maxY;

            // Get the width and height of area to fit
            if (DynamoSelection.Instance.Selection.Count > 0)
            {   // has selection
                minX = GetSelectionMinX();
                maxX = GetSelectionMaxX();
                minY = GetSelectionMinY();
                maxY = GetSelectionMaxY();
            }
            else
            {
                // no selection, fitview all nodes and notes
                var nodes  = _nodes.Select(x => x.NodeModel);
                var notes  = _notes.Select(x => x.Model);
                var models = nodes.Concat <ModelBase>(notes);

                if (!models.Any())
                {
                    return;
                }

                // initialize to the first model (either note or node) on the list

                var firstModel = models.First();
                minX = firstModel.X;
                maxX = firstModel.X;
                minY = firstModel.Y;
                maxY = firstModel.Y;

                foreach (var model in models)
                {
                    //calculates the min and max positions of both x and y coords of all nodes and notes
                    minX = Math.Min(model.X, minX);
                    maxX = Math.Max(model.X + model.Width, maxX);
                    minY = Math.Min(model.Y, minY);
                    maxY = Math.Max(model.Y + model.Height, maxY);
                }
            }

            var    offset      = new Point2D(minX, minY);
            double focusWidth  = maxX - minX;
            double focusHeight = maxY - minY;

            _fitViewActualZoomToggle = !_fitViewActualZoomToggle;
            ZoomEventArgs zoomArgs = _fitViewActualZoomToggle
                ? new ZoomEventArgs(offset, focusWidth, focusHeight)
                : new ZoomEventArgs(offset, focusWidth, focusHeight, 1.0);

            OnRequestZoomToFitView(this, zoomArgs);
        }
Esempio n. 9
0
        private void FitView(object o)
        {
            // Get the offset and focus width & height (zoom if 100%)
            double minX, maxX, minY, maxY;

            // Get the width and height of area to fit
            if (DynamoSelection.Instance.Selection.Count > 0)
            {   // has selection
                minX = GetSelectionMinX();
                maxX = GetSelectionMaxX();
                minY = GetSelectionMinY();
                maxY = GetSelectionMaxY();
            }
            else
            {   // no selection, fitview all nodes
                if (_nodes.Count() <= 0)
                {
                    return;
                }

                IEnumerable <ILocatable> nodes = _nodes.Select((x) => x.NodeModel).Where((x) => x is ILocatable).Cast <ILocatable>();
                minX = nodes.Select((x) => x.X).Min();
                maxX = nodes.Select((x) => x.X + x.Width).Max();
                minY = nodes.Select((y) => y.Y).Min();
                maxY = nodes.Select((y) => y.Y + y.Height).Max();
            }

            Point         offset      = new Point(minX, minY);
            double        focusWidth  = maxX - minX;
            double        focusHeight = maxY - minY;
            ZoomEventArgs zoomArgs;

            _fitViewActualZoomToggle = !_fitViewActualZoomToggle;
            if (_fitViewActualZoomToggle)
            {
                zoomArgs = new ZoomEventArgs(offset, focusWidth, focusHeight);
            }
            else
            {
                zoomArgs = new ZoomEventArgs(offset, focusWidth, focusHeight, 1.0);
            }

            OnRequestZoomToFitView(this, zoomArgs);
        }
Esempio n. 10
0
        internal void FitViewInternal()
        {
            // Get the offset and focus width & height (zoom if 100%)
            double minX, maxX, minY, maxY;

            // Get the width and height of area to fit
            if (DynamoSelection.Instance.Selection.Count > 0)
            {   // has selection
                minX = GetSelectionMinX();
                maxX = GetSelectionMaxX();
                minY = GetSelectionMinY();
                maxY = GetSelectionMaxY();
            }
            else
            {   // no selection, fitview all nodes
                if (!_nodes.Any())
                {
                    return;
                }

                List <NodeModel> nodes = _nodes.Select(x => x.NodeModel).Where(x => x != null).ToList();
                minX = nodes.Select(x => x.X).Min();
                maxX = nodes.Select(x => x.X + x.Width).Max();
                minY = nodes.Select(y => y.Y).Min();
                maxY = nodes.Select(y => y.Y + y.Height).Max();
            }

            var    offset      = new Point2D(minX, minY);
            double focusWidth  = maxX - minX;
            double focusHeight = maxY - minY;

            _fitViewActualZoomToggle = !_fitViewActualZoomToggle;
            ZoomEventArgs zoomArgs = _fitViewActualZoomToggle
                ? new ZoomEventArgs(offset, focusWidth, focusHeight)
                : new ZoomEventArgs(offset, focusWidth, focusHeight, 1.0);

            OnRequestZoomToFitView(this, zoomArgs);
        }