summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-21 20:54:59 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-21 20:54:59 (GMT)
commit699a1b7113221fceedad40abb0963236188d6851 (patch)
tree4b5882918685dd064227389f87e6c95070e4fc20
parent4b6d88b9f9b7529ca2598c2b99a2ac43fba3ab0f (diff)
Fix currentZoom being set to 0 if view width is a lot smaller than image width due to using floor()
-rw-r--r--kstars/fitsviewer/fitsview.cpp22
-rw-r--r--kstars/fitsviewer/fitsview.h2
2 files changed, 17 insertions, 7 deletions
diff --git a/kstars/fitsviewer/fitsview.cpp b/kstars/fitsviewer/fitsview.cpp
index b0200df..7bca317 100644
--- a/kstars/fitsviewer/fitsview.cpp
+++ b/kstars/fitsviewer/fitsview.cpp
@@ -678,20 +678,23 @@ int FITSView::rescale(FITSZoom type)
case ZOOM_FIT_WINDOW:
if ((display_image->width() > width() || display_image->height() > height()))
{
- int w = baseSize().width() - BASE_OFFSET;
- int h = baseSize().height() - BASE_OFFSET;
+ double w = baseSize().width() - BASE_OFFSET;
+ double h = baseSize().height() - BASE_OFFSET;
- if(!firstLoad){
+ if(firstLoad == false)
+ {
w = viewport()->rect().width() - BASE_OFFSET;
h = viewport()->rect().height() - BASE_OFFSET;
}
// Find the zoom level which will enclose the current FITS in the current window size
- currentZoom = floor( (w / static_cast<double>(currentWidth)) * 10.) * 10.;
+ //currentZoom = floor( (w / static_cast<double>(currentWidth)) * 10.) * 10.;
+ currentZoom = floor( (w / static_cast<double>(currentWidth)) * 100.);
/* If width is not the problem, try height */
if (currentZoom > ZOOM_DEFAULT)
- currentZoom = floor( (h / static_cast<double>(currentHeight)) * 10.) * 10.;
+ //currentZoom = floor( (h / static_cast<double>(currentHeight)) * 10.) * 10.;
+ currentZoom = floor( (h / static_cast<double>(currentHeight)) * 100.);
currentWidth = image_width * (currentZoom / ZOOM_DEFAULT);
currentHeight = image_height * (currentZoom / ZOOM_DEFAULT);
@@ -1165,6 +1168,11 @@ bool FITSView::pointIsNearWCSTargetPoint(wcs_point *wcs_coord, double target, in
return (target>nextPoint&&target<prevPoint)||(target>prevPoint&&target<nextPoint);
}
+void FITSView::setFirstLoad(bool value)
+{
+ firstLoad = value;
+}
+
QPixmap & FITSView::getTrackingBoxPixmap()
{
if (trackingBox.isNull())
@@ -1246,11 +1254,11 @@ int FITSView::findStars(StarAlgorithm algorithm)
break;
}
}
- else if (algorithm == ALGORITHM_GRADIENT)
+ /*else if (algorithm == ALGORITHM_GRADIENT)
{
QRect boundary(0,0, image_data->getWidth(), image_data->getHeight());
count = FITSData::findCannyStar(image_data, boundary);
- }
+ }*/
else
{
count = image_data->findStars();
diff --git a/kstars/fitsviewer/fitsview.h b/kstars/fitsviewer/fitsview.h
index 90e45b3..0c0bb85 100644
--- a/kstars/fitsviewer/fitsview.h
+++ b/kstars/fitsviewer/fitsview.h
@@ -163,6 +163,8 @@ public:
void setFilter(FITSScale newFilter) { filter = newFilter;}
+ void setFirstLoad(bool value);
+
protected:
void wheelEvent(QWheelEvent* event);