Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/04/09 20:02:56 (16 years ago)
Author:
bspisic
Message:

Reordered of zooming and panning (#664)

File:
1 edited

Legend:

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

    r2013 r2014  
    639639    #region Zooming / Panning
    640640
    641     private void Pan(Point startPoint, Point endPoint) {
    642       RectangleD clippingArea = Translate.ClippingArea(startPoint, endPoint, xAxis.ClippingArea, xAxis.Viewport);
    643 
    644       SetClipX(clippingArea.X1, clippingArea.X2);
    645 
    646       foreach (RowEntry rowEntry in rowEntries) {
    647         if (rowEntry.DataRow.YAxis.ClipChangeable) {
    648           clippingArea = Translate.ClippingArea(startPoint, endPoint, rowEntry.LinesShape.ClippingArea,
    649                                                 rowEntry.LinesShape.Viewport);
    650           SetClipY(rowEntry, clippingArea.Y1, clippingArea.Y2);
    651         }
    652       }
    653 
    654       canvasUI.Invalidate();
    655     }
    656 
    657     private void PanEnd(Point startPoint, Point endPoint) {
    658       Pan(startPoint, endPoint);
    659     }
    660 
    661     private void SetClippingArea(Rectangle rectangle) {
    662       RectangleD clippingArea = Transform.ToWorld(rectangle, xAxis.Viewport, xAxis.ClippingArea);
    663 
    664       SetClipX(clippingArea.X1, clippingArea.X2);
    665 
    666       foreach (RowEntry rowEntry in rowEntries) {
    667         if (rowEntry.DataRow.YAxis.ClipChangeable) {
    668           clippingArea = Transform.ToWorld(rectangle, rowEntry.LinesShape.Viewport, rowEntry.LinesShape.ClippingArea);
    669 
    670           SetClipY(rowEntry, clippingArea.Y1, clippingArea.Y2);
    671         }
    672       }
    673 
    674       userInteractionShape.RemoveShape(rectangleShape);
    675       canvasUI.Invalidate();
    676     }
    677 
    678     private void DrawRectangle(Rectangle rectangle) {
    679       rectangleShape.Rectangle = Transform.ToWorld(rectangle, userInteractionShape.Viewport,
    680                                                    userInteractionShape.ClippingArea);
    681       canvasUI.Invalidate();
    682     }
    683 
    684641    private void canvasUI1_MouseDown(object sender, MouseEventArgs e) {
    685642      Focus();
     
    735692        world = Transform.ToWorld(e.Location, xAxis.Viewport, xAxis.ClippingArea);
    736693
    737         double x1 = world.X - (world.X - xAxis.ClippingArea.X1)*zoomFactor;
    738         double x2 = world.X + (xAxis.ClippingArea.X2 - world.X)*zoomFactor;
     694        double x1 = world.X - (world.X - xAxis.ClippingArea.X1) * zoomFactor;
     695        double x2 = world.X + (xAxis.ClippingArea.X2 - world.X) * zoomFactor;
    739696
    740697        SetClipX(x1, x2);
     
    743700          world = Transform.ToWorld(e.Location, rowEntry.LinesShape.Viewport, rowEntry.LinesShape.ClippingArea);
    744701
    745           double y1 = world.Y - (world.Y - rowEntry.LinesShape.ClippingArea.Y1)*zoomFactor;
    746           double y2 = world.Y + (rowEntry.LinesShape.ClippingArea.Y2 - world.Y)*zoomFactor;
     702          double y1 = world.Y - (world.Y - rowEntry.LinesShape.ClippingArea.Y1) * zoomFactor;
     703          double y2 = world.Y + (rowEntry.LinesShape.ClippingArea.Y2 - world.Y) * zoomFactor;
    747704
    748705          SetClipY(rowEntry, y1, y2);
     
    751708        canvasUI.Invalidate();
    752709      }
     710    }
     711
     712    private void Pan(Point startPoint, Point endPoint) {
     713      RectangleD clippingArea = Translate.ClippingArea(startPoint, endPoint, xAxis.ClippingArea, xAxis.Viewport);
     714
     715      SetClipX(clippingArea.X1, clippingArea.X2);
     716
     717      foreach (RowEntry rowEntry in rowEntries) {
     718        if (rowEntry.DataRow.YAxis.ClipChangeable) {
     719          clippingArea = Translate.ClippingArea(startPoint, endPoint, rowEntry.LinesShape.ClippingArea,
     720                                                rowEntry.LinesShape.Viewport);
     721          SetClipY(rowEntry, clippingArea.Y1, clippingArea.Y2);
     722        }
     723      }
     724
     725      canvasUI.Invalidate();
     726    }
     727
     728    private void PanEnd(Point startPoint, Point endPoint) {
     729      Pan(startPoint, endPoint);
     730    }
     731
     732    private void DrawRectangle(Rectangle rectangle) {
     733      rectangleShape.Rectangle = Transform.ToWorld(rectangle, userInteractionShape.Viewport,
     734                                                   userInteractionShape.ClippingArea);
     735      canvasUI.Invalidate();
     736    }
     737
     738    private void SetClippingArea(Rectangle rectangle) {
     739      RectangleD clippingArea = Transform.ToWorld(rectangle, xAxis.Viewport, xAxis.ClippingArea);
     740
     741      SetClipX(clippingArea.X1, clippingArea.X2);
     742
     743      foreach (RowEntry rowEntry in rowEntries) {
     744        if (rowEntry.DataRow.YAxis.ClipChangeable) {
     745          clippingArea = Transform.ToWorld(rectangle, rowEntry.LinesShape.Viewport, rowEntry.LinesShape.ClippingArea);
     746
     747          SetClipY(rowEntry, clippingArea.Y1, clippingArea.Y2);
     748        }
     749      }
     750
     751      userInteractionShape.RemoveShape(rectangleShape);
     752      canvasUI.Invalidate();
    753753    }
    754754
Note: See TracChangeset for help on using the changeset viewer.