Mercurial > hg > svgui
comparison widgets/LevelPanWidget.cpp @ 927:271e729c818b tonioni
Fix to pointer-pos-to-level logic
author | Chris Cannam |
---|---|
date | Tue, 24 Mar 2015 16:40:55 +0000 |
parents | bfeabe25a1a3 |
children | 20698aa6a517 |
comparison
equal
deleted
inserted
replaced
926:bfeabe25a1a3 | 927:271e729c818b |
---|---|
174 { | 174 { |
175 double w = width(), h = height(); | 175 double w = width(), h = height(); |
176 int npan = maxPan * 2 + 1; | 176 int npan = maxPan * 2 + 1; |
177 int nlevel = maxLevel + 1; | 177 int nlevel = maxLevel + 1; |
178 double wcell = w / npan, hcell = h / nlevel; | 178 double wcell = w / npan, hcell = h / nlevel; |
179 level = int((h - loc.y()) / hcell) + 1; | 179 level = int((h - loc.y()) / hcell); |
180 if (level < 0) level = 0; | 180 if (level < 0) level = 0; |
181 if (level > maxLevel) level = maxLevel; | 181 if (level > maxLevel) level = maxLevel; |
182 pan = int(loc.x() / wcell) - maxPan; | 182 pan = int(loc.x() / wcell) - maxPan; |
183 if (pan < -maxPan) pan = -maxPan; | 183 if (pan < -maxPan) pan = -maxPan; |
184 if (pan > maxPan) pan = maxPan; | 184 if (pan > maxPan) pan = maxPan; |