/// <summary> /// Handler for the "Undo All Zoom/Pan" context menu item. Restores the scale ranges to the values /// before all zoom and pan operations /// </summary> /// <remarks> /// This method differs from the <see cref="RestoreScale" /> method in that it sets the scales /// to their initial setting prior to any user actions. The <see cref="RestoreScale" /> method /// sets the scales to full auto mode (regardless of what the initial setting may have been). /// </remarks> /// <param name="primaryPane">The <see cref="GraphPane" /> object which is to be zoomed out</param> public void ZoomOutAll(GraphPane primaryPane) { if (primaryPane != null && !primaryPane.ZoomStack.IsEmpty) { ZoomState.StateType type = primaryPane.ZoomStack.Top.Type; ZoomState oldState = new ZoomState(primaryPane, type); //ZoomState newState = pane.ZoomStack.PopAll( pane ); ZoomState newState = null; if (_isSynchronizeXAxes || _isSynchronizeYAxes) { foreach (GraphPane pane in _masterPane._paneList) { ZoomState state = pane.ZoomStack.PopAll(pane); if (pane == primaryPane) { newState = state; } } } else { newState = primaryPane.ZoomStack.PopAll(primaryPane); } // Provide Callback to notify the user of zoom events if (this.ZoomEvent != null) { this.ZoomEvent(this, oldState, newState); } Refresh(); } }
/// <summary> /// Add the scale range information from the specified <see cref="GraphPane"/> object as a /// new <see cref="ZoomState"/> entry on the stack. /// </summary> /// <param name="pane">The <see cref="GraphPane"/> object from which the scale range /// information should be copied.</param> /// <param name="type">A <see cref="ZoomState.StateType"/> enumeration that indicates whether this /// state is the result of a zoom or pan operation.</param> /// <returns>The resultant <see cref="ZoomState"/> object that was pushed on the stack.</returns> public ZoomState Push(GraphPane pane, ZoomState.StateType type) { ZoomState state = new ZoomState(pane, type); this.Add(state); return(state); }
/// <summary> /// Handler for the "UnZoom/UnPan" context menu item. Restores the scale ranges to the values /// before the last zoom, pan, or scroll operation. /// </summary> /// <remarks> /// Triggers a <see cref="ZoomEvent" /> for any type of undo (including pan, scroll, zoom, and /// wheelzoom). This method will affect all the /// <see cref="GraphPane" /> objects in the <see cref="MasterPane" /> if /// <see cref="IsSynchronizeXAxes" /> or <see cref="IsSynchronizeYAxes" /> is true. /// </remarks> /// <param name="primaryPane">The primary <see cref="GraphPane" /> object which is to be /// zoomed out</param> public void ZoomOut(GraphPane primaryPane) { if (primaryPane == null || primaryPane.ZoomStack.IsEmpty) { return; } ZoomState.StateType type = primaryPane.ZoomStack.Top.Type; ZoomState oldState = new ZoomState(primaryPane, type); ZoomState newState = null; if (_isSynchronizeXAxes || _isSynchronizeYAxes) { foreach (var pane in _masterPane.PaneList.Where(p => p is GraphPane).Cast <GraphPane>()) { var state = pane.ZoomStack.Pop(pane); if (pane == primaryPane) { newState = state; } } } else { newState = primaryPane.ZoomStack.Pop(primaryPane); } // Provide Callback to notify the user of zoom events ZoomEvent?.Invoke(this, oldState, newState); Refresh(); }
/// <summary> /// Save the current states of the GraphPanes to a separate collection. Save a single /// (<see paramref="primaryPane" />) GraphPane if the panes are not synchronized /// (see <see cref="IsSynchronizeXAxes" /> and <see cref="IsSynchronizeYAxes" />), /// or save a list of states for all GraphPanes if the panes are synchronized. /// </summary> /// <param name="primaryPane">The primary GraphPane on which zoom/pan/scroll operations /// are taking place</param> /// <param name="type">The <see cref="ZoomState.StateType" /> that describes the /// current operation</param> /// <returns>The <see cref="ZoomState" /> that corresponds to the /// <see paramref="primaryPane" />. /// </returns> private ZoomState ZoomStateSave(GraphPane primaryPane, ZoomState.StateType type) { ZoomStateClear(); if (_isSynchronizeXAxes || _isSynchronizeYAxes) { foreach (GraphPane pane in _masterPane._paneList) { ZoomState state = new ZoomState(pane, type); if (pane == primaryPane) { _zoomState = state; } _zoomStateStack.Add(state); } } else { _zoomState = new ZoomState(primaryPane, type); } return(_zoomState); }
/// <summary> /// Save the current states of the GraphPanes to a separate collection. Save a single /// (<see paramref="primaryPane" />) GraphPane if the panes are not synchronized /// (see <see cref="IsSynchronizeXAxes" /> and <see cref="IsSynchronizeYAxes" />), /// or save a list of states for all GraphPanes if the panes are synchronized. /// </summary> /// <param name="primaryPane">The primary GraphPane on which zoom/pan/scroll operations /// are taking place</param> /// <param name="type">The <see cref="ZoomState.StateType" /> that describes the /// current operation</param> /// <returns>The <see cref="ZoomState" /> that corresponds to the /// <see paramref="primaryPane" />. /// </returns> private ZoomState ZoomStateSave(GraphPane primaryPane, ZoomState.StateType type) { ZoomStateClear(); if (_isSynchronizeXAxes || _isSynchronizeYAxes) { foreach (var pane in _masterPane.PaneList.Where(p => p is GraphPane).Cast <GraphPane>()) { var state = new ZoomState(pane, type); if (pane == primaryPane) { _zoomState = state; } _zoomStateStack.Add(state); } } else { _zoomState = new ZoomState(primaryPane, type); } return(_zoomState); }
/// <summary> /// Add the scale range information from the specified <see cref="GraphPane"/> object as a /// new <see cref="ZoomState"/> entry on the stack. /// </summary> /// <param name="pane">The <see cref="GraphPane"/> object from which the scale range /// information should be copied.</param> /// <param name="type">A <see cref="ZoomState.StateType"/> enumeration that indicates whether this /// state is the result of a zoom or pan operation.</param> public void Push(GraphPane pane, ZoomState.StateType type) { ZoomState state = new ZoomState(pane, type); this.List.Add(state); }