fix pause autofit

git-svn-id: svn://db.shs.com.ru/libs@348 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
2018-01-26 08:18:28 +00:00
parent efca49fb72
commit e340240ac7

View File

@@ -478,6 +478,8 @@ void Graphic::setPaused(bool yes) {
ui->checkPause->blockSignals(true); ui->checkPause->blockSignals(true);
ui->checkPause->setChecked(yes); ui->checkPause->setChecked(yes);
ui->checkPause->blockSignals(false); ui->checkPause->blockSignals(false);
for (int i = 0; i < graphics.size(); ++i)
graphics[i].cvrect = QRectF();
if (!pause_) { if (!pause_) {
killTimer(timer_pause); killTimer(timer_pause);
timer_pause = 0; timer_pause = 0;
@@ -488,7 +490,6 @@ void Graphic::setPaused(bool yes) {
graphics[i].polyline_pause = graphics[i].polyline; graphics[i].polyline_pause = graphics[i].polyline;
graphics[i].polyline_pause.detach(); graphics[i].polyline_pause.detach();
graphics[i].max_x_pause = graphics[i].max_x; graphics[i].max_x_pause = graphics[i].max_x;
graphics[i].cvrect = QRectF();
} }
timer_pause = startTimer(40); timer_pause = startTimer(40);
} }
@@ -589,7 +590,7 @@ void Graphic::setButtonsPosition(Graphic::Alignment a) {
void Graphic::addPoint(const QPointF & p, int graphic, bool update_) { void Graphic::addPoint(const QPointF & p, int graphic, bool update_) {
if (graphic >= graphics.size() || graphic < 0) return; if (graphic >= graphics.size() || graphic < 0) return;
GraphicType & t(graphics[graphic]); GraphicType & t(graphics[graphic]);
if (!t.cvrect.isNull()) { if (!t.cvrect.isNull() && !pause_) {
// if (graphics[graphic].cvrect.contains(p)) // if (graphics[graphic].cvrect.contains(p))
// graphics[graphic].cvrect = QRectF(); // graphics[graphic].cvrect = QRectF();
if (t.cvrect.top() < p.y()) t.cvrect.setTop(p.y()); if (t.cvrect.top() < p.y()) t.cvrect.setTop(p.y());
@@ -760,7 +761,8 @@ void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, dou
double cx, cy, maxX, minX, maxY, minY, vx; double cx, cy, maxX, minX, maxY, minY, vx;
bool isRangeX = (start_x != end_x), isRangeY = (start_y != end_y); bool isRangeX = (start_x != end_x), isRangeY = (start_y != end_y);
// bool isEmpty = true; // bool isEmpty = true;
bool fast = true, can_fast = (start_x == 0 && end_x == 0 && start_y == 0 && end_y == 0); //bool fast = true;
bool can_fast = (start_x == 0 && end_x == 0 && start_y == 0 && end_y == 0);
bool anyVisible = false, isTimeLimit = (visible_time > 0.) && !(isRangeX || isRangeY); bool anyVisible = false, isTimeLimit = (visible_time > 0.) && !(isRangeX || isRangeY);
// foreach (const GraphicType & t, graphics) { // foreach (const GraphicType & t, graphics) {
// const QPolygonF & pol(pause_ ? t.polyline_pause : t.polyline); // const QPolygonF & pol(pause_ ? t.polyline_pause : t.polyline);
@@ -807,7 +809,7 @@ void Graphic::findGraphicsRect(double start_x, double end_x, double start_y, dou
if (t.cvrect.right() < cx) t.cvrect.setRight(cx); if (t.cvrect.right() < cx) t.cvrect.setRight(cx);
if (t.cvrect.left() > cx) t.cvrect.setLeft(cx); if (t.cvrect.left() > cx) t.cvrect.setLeft(cx);
} }
fast = false; //fast = false;
} }
if (f) continue; if (f) continue;
//qDebug() << "[Graphic]" << "2 cvrect:" << t.cvrect; //qDebug() << "[Graphic]" << "2 cvrect:" << t.cvrect;