Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2016


Ignore:
Timestamp:
06/04/09 20:45:39 (15 years ago)
Author:
bspisic
Message:

Refactoring ZoomListener(#664)

Location:
trunk/sources/HeuristicLab.Visualization/3.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization/3.2/LineChart.cs

    r2015 r2016  
    654654          ZoomListener zoomListener = new ZoomListener(e.Location);
    655655          zoomListener.DrawRectangle += DrawRectangle;
    656           zoomListener.SetClippingArea += SetClippingArea;
     656          zoomListener.Zoom += Zoom;
    657657
    658658          rectangleShape.Rectangle = RectangleD.Empty;
     
    728728    }
    729729
    730     private void SetClippingArea(Rectangle rectangle) {
     730    private void Zoom(Rectangle rectangle) {
    731731      RectangleD clippingArea = Transform.ToWorld(rectangle, xAxis.Viewport, xAxis.ClippingArea);
    732732
  • trunk/sources/HeuristicLab.Visualization/3.2/ZoomListener.cs

    r1963 r2016  
    88
    99    public event RectangleHandler DrawRectangle;
    10     public event RectangleHandler SetClippingArea;
     10    public event RectangleHandler Zoom;
    1111
    1212    public ZoomListener(Point startPoint) {
     
    2323
    2424    public void MouseUp(object sender, MouseEventArgs e) {
    25      if(SetClippingArea != null) {
    26        SetClippingArea(CalcRectangle(e.Location));
     25     if(Zoom != null) {
     26       Zoom(CalcRectangle(e.Location));
    2727     }
    2828    }
     
    3838      return new Rectangle(x, y, width, height);
    3939    }
    40 
    41     public static RectangleD ZoomClippingArea(RectangleD clippingArea, double zoomFactor) {
    42       double x1, x2, y1, y2, width, height;
    43 
    44       width = clippingArea.Width * zoomFactor;
    45       height = clippingArea.Height * zoomFactor;
    46 
    47       x1 = clippingArea.X1 - (width - clippingArea.Width) / 2;
    48       y1 = clippingArea.Y1 - (height - clippingArea.Height) / 2;
    49       x2 = width + x1;
    50       y2 = height + y1;
    51 
    52       return new RectangleD(x1, y1, x2, y2);
    53     }
    5440  }
    5541}
Note: See TracChangeset for help on using the changeset viewer.