public void mouseDragged(MouseEvent e) {
   	double xOff = my3ddata.ElementAt(my3ddata.ActiveElement).DisplayOffset[otherCanvas1.DimNr];
	double yOff = my3ddata.ElementAt(my3ddata.ActiveElement).DisplayOffset[otherCanvas2.DimNr];

    if (ROIMoveStarted)
    {
        if (! e.isControlDown())
            { ROIMoveStarted=false;ROIMoveDX=0;ROIMoveDY=0;repaint();return;}

        ROIMoveDX=(int) (XFromMouse(e.getX())-0.5)-ROIMoveStartX;
        ROIMoveDY=(int) (YFromMouse(e.getY())-0.5)-ROIMoveStartY;
        repaint();
        return;
    }

    if (myPanel.DraggedMarker != null)
    {
        myPanel.DraggedMarker.UpdatePosition(XFromMouse(e.getX())-0.5-xOff,YFromMouse(e.getY())-0.5-yOff,DimNr);
    }
    else if (! myPanel.ROIstarted && ! LineROIStarted)   // Drags the image around
    {
        //boolean wasmoved=false;
        //otherCanvas1.dadd += e.getX() - xprev;
        //wasmoved |= otherCanvas1.LimitPosition(getBounds().width);
        //otherCanvas2.dadd += e.getY() - yprev;
        //wasmoved |= otherCanvas2.LimitPosition(getBounds().height);

        if (ImgDragStarted)
        {
            boolean wasmoved=false;
            otherCanvas1.dadd += e.getX() - ximgdrag;
            wasmoved |= otherCanvas1.LimitPosition(getBounds().width);
            otherCanvas2.dadd += e.getY() - yimgdrag;
            wasmoved |= otherCanvas2.LimitPosition(getBounds().height);
            ximgdrag = e.getX();yimgdrag = e.getY();
            repaint();
            return;
        }
        else
        {
            xprev = e.getX();yprev = e.getY();
        }

    }
    else
    {
        if (myPanel.ROIstarted)
        {
            otherCanvas1.ROIe = (int) XFromMouse(e.getX());
            otherCanvas2.ROIe = (int) YFromMouse(e.getY());      
        }
        if (LineROIStarted)
        {
            otherCanvas1.LROIe = (int) XFromMouse(e.getX());
            otherCanvas2.LROIe = (int) YFromMouse(e.getY());      
        }
    }
    repaint();
    updateothers(xprev,yprev);
    //updateothers(xprev-MouseFromX(xOff),yprev-MouseFromY(yOff));
    label.CoordsChanged();  
}