summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/lib/oimagezoomer.cpp
Side-by-side diff
Diffstat (limited to 'noncore/graphics/opie-eye/lib/oimagezoomer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/lib/oimagezoomer.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp
index 178fbd4..ffa3c0c 100644
--- a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp
+++ b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp
@@ -23,12 +23,16 @@ OImageZoomer::OImageZoomer( const QPixmap& pix, QWidget* par, const char* name,
OImageZoomer::OImageZoomer( const QSize& pSize, const QSize& vSize, QWidget* par,
const char* name, WFlags fl )
: QFrame( par, name, fl ), m_imgSize( pSize ),m_visSize( vSize ) {
init();
}
+OImageZoomer::~OImageZoomer() {
+
+}
+
void OImageZoomer::init() {
setFrameStyle( Panel | Sunken );
}
void OImageZoomer::setImageSize( const QSize& size ) {
m_imgSize = size;
@@ -90,25 +94,25 @@ void OImageZoomer::drawContents( QPainter* p ) {
if ( h > c.height() ) h = c.height();
p->drawRect( x, y, w, h );
}
void OImageZoomer::mousePressEvent( QMouseEvent* ) {
-
+ m_mouseX = m_mouseY = -1;
}
void OImageZoomer::mouseMoveEvent( QMouseEvent* ev ) {
int mx, my;
mx = ev->x();
my = ev->y();
if ( m_mouseX != -1 && m_mouseY != -1 ) {
- int diffx = m_mouseX-mx;
- int diffy = m_mouseY-my;
-// emit zoomAreaRel( diffx, diffy );
-// emit zoomArea(
+ int diffx = ( mx - m_mouseX ) * m_imgSize.width() / width();
+ int diffy = ( my - m_mouseY ) * m_imgSize.height() / height();
+ emit zoomAreaRel( diffx, diffy );
+ emit zoomArea(m_visPt.x()+diffx, m_visPt.y()+diffy );
}
m_mouseX = mx;
m_mouseY = my;
}