Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1963 for trunk


Ignore:
Timestamp:
05/30/09 01:51:42 (15 years ago)
Author:
bspisic
Message:

Summer festival commit - did a little bit code refactoring (#664)

File:
1 edited

Legend:

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

    r1530 r1963  
     1using System;
    12using System.Drawing;
    23using System.Windows.Forms;
     
    3031
    3132    private Rectangle CalcRectangle(Point actualPoint) {
    32       Rectangle rectangle = new Rectangle();
    33 
    34       if (startPoint.X < actualPoint.X) {
    35         rectangle.X = startPoint.X;
    36         rectangle.Width = actualPoint.X - startPoint.X;
    37       } else {
    38         rectangle.X = actualPoint.X;
    39         rectangle.Width = startPoint.X - actualPoint.X;
    40       }
    41 
    42       if (startPoint.Y < actualPoint.Y) {
    43         rectangle.Y = startPoint.Y;
    44         rectangle.Height = actualPoint.Y - startPoint.Y;
    45       } else {
    46         rectangle.Y = actualPoint.Y;
    47         rectangle.Height = startPoint.Y - actualPoint.Y;
    48       }
    49 
    50       return rectangle;
     33      int x = Math.Min(startPoint.X, actualPoint.X);
     34      int y = Math.Min(startPoint.Y, actualPoint.Y);
     35      int width = Math.Abs(actualPoint.X - startPoint.X);
     36      int height = Math.Abs(actualPoint.Y - startPoint.Y);
     37     
     38      return new Rectangle(x, y, width, height);
    5139    }
    5240
Note: See TracChangeset for help on using the changeset viewer.