Free cookie consent management tool by TermsFeed Policy Generator

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

Refactoring ZoomListener(#664)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.