diff options
author | Ken Moore <moorekou@gmail.com> | 2015-10-20 10:15:32 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-10-20 10:15:32 -0400 |
commit | 8b82c9d9c6099405cd90ef4fb38431403053c9b1 (patch) | |
tree | 92e80cb1e6d06a90053ef42bc1692a0b5316de9d /lumina-desktop | |
parent | Adjust the text adjustment routine for the applauncher a tiny bit as well so ... (diff) | |
download | lumina-8b82c9d9c6099405cd90ef4fb38431403053c9b1.tar.gz lumina-8b82c9d9c6099405cd90ef4fb38431403053c9b1.tar.bz2 lumina-8b82c9d9c6099405cd90ef4fb38431403053c9b1.zip |
Fix up the desktop plugin resize calculations. Now the "dead area" of no change is 1/4 GRID SIZE, and it properly calculates the change from center in each direction.
Diffstat (limited to 'lumina-desktop')
-rw-r--r-- | lumina-desktop/LDesktopPluginSpace.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lumina-desktop/LDesktopPluginSpace.h b/lumina-desktop/LDesktopPluginSpace.h index 2a0f97a3..b3904711 100644 --- a/lumina-desktop/LDesktopPluginSpace.h +++ b/lumina-desktop/LDesktopPluginSpace.h @@ -187,17 +187,22 @@ protected: }else{ //Resize operation - QPoint diff = grid - posToGrid(geom.center());; //need difference from center (grid) - geom = geomToGrid(geom); //convert to grid coordinates now - if(diff.x()==0 && diff.y()==0){ + QPoint diff = ev->pos() - geom.center(); //need difference from center (pixels) + if(qAbs(diff.x())<GRIDSIZE/4 && qAbs(diff.y())<GRIDSIZE/4){ ev->acceptProposedAction(); //nothing to do - but keep the drag active }else{ - if(diff.x()<0){ geom.setLeft( grid.x()); } //expanding to the left - else if(diff.x()>0){ geom.setRight( grid.x()); } //expanding to the right - if(diff.y()<0){ geom.setTop( grid.y()); } //expanding above - else if(diff.y()>0){ geom.setBottom( grid.y()); } //expanding below + //qDebug() << "Resize Plugin:" << geom << grid << posToGrid(geom.center()) << diff; + geom = geomToGrid(geom); //convert to grid coordinates now + //qDebug() << " - Grid Geom:" << geom; + if(diff.x()<0){ geom.setLeft(ev->pos().x()/GRIDSIZE); } //expanding to the left (round down) + else if(diff.x()>0){ geom.setRight( ev->pos().x()/GRIDSIZE); } //expanding to the right (round down) + if(diff.y()<0){ geom.setTop( ev->pos().y()/GRIDSIZE); } //expanding above (round down) + else if(diff.y()>0){ geom.setBottom( ev->pos().y()/GRIDSIZE); } //expanding below (round down) + //qDebug() << " - Adjusted:" << geom; + if(geom.width()<1 || geom.height()<1){ ev->ignore(); return; } //cannot have 0 size //Now convert back to pixel coords (includes edge matching/adjustments) geom = gridToGeom(geom); + //qDebug() << " - Pixels:" << geom; //Check Validity of new geom if(ValidGeometry(act.section("::::",1,50), geom)){ item->setGeometry(geom); |