<commit_before>#include <cmath>

#include "qniteaxes.h"
#include "qniteaxis.h"
#include "qnitemapper.h"
#include "qnitezoompainter.h"
#include "qnitezoomtool.h"

QniteZoomTool::QniteZoomTool(QQuickItem *parent)
    : QniteTool{parent}, m_minZoomFactor{4}, m_pen{new QnitePen} {
  setAcceptedMouseButtons(Qt::RightButton);

  // Default pen style
  m_pen->setFill("#6EDCDCDC");
  m_pen->setStroke("#7E7E7E");
  m_pen->setWidth(1.0);

  connect(this, &QniteZoomTool::axesChanged, this,
          &QniteZoomTool::connectAxesBoundsSignals);

  connect(this, &QniteZoomTool::minZoomFactorChanged, this,
          &QniteZoomTool::updateEnabled);
}

QniteZoomTool::~QniteZoomTool() {}

QNanoQuickItemPainter *QniteZoomTool::createItemPainter() const {
  return new QniteZoomPainter;
}

void QniteZoomTool::reset() {
  auto xAxis = axes()->axisX();
  auto yAxis = axes()->axisY();

  xAxis->setLowerBound(m_baseZoomRect.x());
  xAxis->setUpperBound(m_baseZoomRect.width());
  yAxis->setLowerBound(m_baseZoomRect.y());
  yAxis->setUpperBound(m_baseZoomRect.height());
  setEnabled(true);
  update();
  axes()->updateArtists();
}

void QniteZoomTool::setMinZoomFactor(int factor) {
  if (m_minZoomFactor != factor) {
    m_minZoomFactor = factor;
    emit minZoomFactorChanged();
  }
}

void QniteZoomTool::mousePressEvent(QMouseEvent *event) {
  if (!isEnabled()) {<commit_msg>Fix padding not applied on zoom reset<commit_after>#include <cmath>

#include "qniteaxes.h"
#include "qniteaxis.h"
#include "qnitemapper.h"
#include "qnitezoompainter.h"
#include "qnitezoomtool.h"

QniteZoomTool::QniteZoomTool(QQuickItem *parent)
    : QniteTool{parent}, m_minZoomFactor{4}, m_pen{new QnitePen} {
  setAcceptedMouseButtons(Qt::RightButton);

  // Default pen style
  m_pen->setFill("#6EDCDCDC");
  m_pen->setStroke("#7E7E7E");
  m_pen->setWidth(1.0);

  connect(this, &QniteZoomTool::axesChanged, this,
          &QniteZoomTool::connectAxesBoundsSignals);

  connect(this, &QniteZoomTool::minZoomFactorChanged, this,
          &QniteZoomTool::updateEnabled);
}

QniteZoomTool::~QniteZoomTool() {}

QNanoQuickItemPainter *QniteZoomTool::createItemPainter() const {
  return new QniteZoomPainter;
}

void QniteZoomTool::reset() {
  auto xAxis = axes()->axisX();
  auto yAxis = axes()->axisY();
  auto xPadding = axes()->xPadding();
  auto yPadding = axes()->yPadding();

  xAxis->setLowerBound(m_baseZoomRect.x() - xPadding);
  xAxis->setUpperBound(m_baseZoomRect.width() + xPadding);
  yAxis->setLowerBound(m_baseZoomRect.y() - yPadding);
  yAxis->setUpperBound(m_baseZoomRect.height() + yPadding);
  setEnabled(true);
  update();
  axes()->updateArtists();
}

void QniteZoomTool::setMinZoomFactor(int factor) {
  if (m_minZoomFactor != factor) {
    m_minZoomFactor = factor;
    emit minZoomFactorChanged();
  }
}

void QniteZoomTool::mousePressEvent(QMouseEvent *event) {
  if (!isEnabled()) {
{'fraction_non_alphanumeric': 0.15, 'fraction_numerical': 0.004861111111111111, 'mean_word_length': 5.908872901678657, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2856449', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1056, 'n_words': 156}