summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/graph/controller/AutoScrollController.java
blob: d1e0d8dd18177aef007df82856b8c0c2b955cfa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.c2kernel.graph.controller;

import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;

import com.c2kernel.graph.view.GraphPanel;


public class AutoScrollController implements MouseMotionListener
{
    private GraphPanel mGraphPanel = null;


    public void setGraphPanel(GraphPanel graphPanel)
    {
        mGraphPanel = graphPanel;
        mGraphPanel.addMouseMotionListener(this);
    }


    public void mouseDragged(MouseEvent me)
    {
        Point mousePoint = null;


        if(mGraphPanel != null)
        {
            mousePoint = me.getPoint();
            mGraphPanel.scrollRectToVisible(new Rectangle(mousePoint.x, mousePoint.y, 1, 1));
        }
    }


    public void mouseMoved(MouseEvent me)
    {
    }
}