| 515 | } |
| 516 | |
| 517 | void |
| 518 | TreeCanvas::timerEvent(QTimerEvent* e) { |
| 519 | if (e->timerId() == layoutDoneTimerId) { |
| 520 | if (!smoothScrollAndZoom) { |
| 521 | scaleTree(targetScale); |
| 522 | } else { |
| 523 | zoomTimeLine.stop(); |
| 524 | int zoomCurrent = static_cast<int>(scale*100); |
| 525 | int targetZoom = targetScale; |
| 526 | targetZoom = std::min(std::max(targetZoom, LayoutConfig::minScale), |
| 527 | LayoutConfig::maxAutoZoomScale); |
| 528 | zoomTimeLine.setFrameRange(zoomCurrent,targetZoom); |
| 529 | zoomTimeLine.start(); |
| 530 | } |
| 531 | QWidget::update(); |
| 532 | killTimer(layoutDoneTimerId); |
| 533 | layoutDoneTimerId = 0; |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | void |
| 538 | TreeCanvas::zoomToFit(void) { |