[Uml-devel] CVS: kdesdk/umbrello/umbrello umlview.cpp,1.12,1.13
kde at office.kde.org
kde at office.kde.org
Mon Feb 3 16:34:05 UTC 2003
Update of /home/kde/kdesdk/umbrello/umbrello
In directory office:/tmp/cvs-serv5544/umbrello/umbrello
Modified Files:
umlview.cpp
Log Message:
First try for Auto-scroll.
Needs a lot of polishing.
Index: umlview.cpp
===================================================================
RCS file: /home/kde/kdesdk/umbrello/umbrello/umlview.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- umlview.cpp 2 Feb 2003 20:51:07 -0000 1.12
+++ umlview.cpp 4 Feb 2003 00:02:39 -0000 1.13
@@ -665,10 +665,50 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
void UMLView::contentsMouseMoveEvent(QMouseEvent *ome)
{
+ {//Autoscroll -- First try.
+ //
+ //This is the first experiment with autoscroll. will be fixed soon.
+
+ //FIXME: we need to keep scrolling while we are close to the border and not only
+ //when we get mouseMoveEvents. ->that means if the user leaves the cursor near to a border
+ //auto-resize could grow the canvas to infinite
+ //
+ //this is only doing autoscroll in mousemove events: when moving the cursor with the
+ //mouse button down OR when moving the cursor if we have a widget selected (mouse tracking
+ //is turned on.
+ //
+ int vx = ome->x();
+ int vy = ome->y();
+ int cx = viewportToContents(ome->pos()).x();
+ int cy = viewportToContents(ome->pos()).y();
+ int contsX = contentsX();
+ int contsY = contentsY();
+ int visw = visibleWidth();
+ int vish = visibleHeight();
+ /*kdDebug()<<"viewport: x = "<<vx<<" y = "<<vy<<endl
+ <<"contents: x ="<<cx<<" y = "<<cy<<endl<<"Visible width and height = "<<visw<<" , "<<vish<<endl
+ <<"contentsX = "<<contsX<<" ContentsY ="<<contsY<<endl
+ <<"viewport x - Conts X ="<<vx-contsX<<",for Y = "<<vy-contsY<<endl
+ <<"contents x - Conts X ="<<cx-contsX<<",for Y = "<<cy-contsY<<endl<<"*********************"<<endl;
+ */
+ int dtr = visw - (vx-contsX);
+ int dtb = vish - (vy-contsY);
+ int dtt = (vy-contsY);
+ int dtl = (vx-contsX);
+ kdDebug()<<"************************\n************************"<<endl
+ <<"distance to: top = "<<dtt<<endl<<"right = "<<dtr<<endl<<"bottom = "<<dtb<<endl<<"left = "<<dtl<<endl;
+ if(dtr < 30 ) scrollBy(30-dtr,0);
+ if(dtb < 30 ) scrollBy(0,30-dtb);
+ if(dtl < 30 ) scrollBy(-(30-dtl),0);
+ if(dtt < 30 ) scrollBy(0,-(30-dtt));
+ }
+
+
QMouseEvent *me = new QMouseEvent(QEvent::MouseMove,
- inverseWorldMatrix().map(ome->pos()),
- ome->button(),
- ome->state());
+ inverseWorldMatrix().map(ome->pos()),
+ ome->button(),
+ ome->state());
+
m_LineToPos = me->pos();
if( m_pFirstSelectedWidget ) {
if( m_pAssocLine ) {
More information about the umbrello-devel
mailing list