Commit cb91006d authored by Alexander Semke's avatar Alexander Semke

[worksheet] allow to zoom along the axis with the mouse wheel if the

axis is under the mouse, no need to select it anymore.
parent 876a3500
......@@ -496,6 +496,11 @@ void Axis::setPrinting(bool on) {
d->setPrinting(on);
}
bool Axis::isHovered() const {
Q_D(const Axis);
return d->isHovered();
}
STD_SETTER_CMD_IMPL_F_S(Axis, SetOrientation, Axis::Orientation, orientation, retransform);
void Axis::setOrientation(Orientation orientation) {
Q_D(Axis);
......@@ -2065,6 +2070,10 @@ void AxisPrivate::setPrinting(bool on) {
m_printing = on;
}
bool AxisPrivate::isHovered() const {
return m_hovered;
}
//##############################################################################
//################## Serialization/Deserialization ###########################
//##############################################################################
......
......@@ -140,6 +140,7 @@ public:
bool isVisible() const override;
void setPrinting(bool) override;
bool isHovered() const;
void setSuppressRetransform(bool);
void retransform() override;
void retransformTickLabelStrings();
......
......@@ -61,6 +61,7 @@ public:
bool swapVisible(bool);
void recalcShapeAndBoundingRect();
void setPrinting(bool);
bool isHovered() const;
bool isDefault{false};
......
......@@ -2630,7 +2630,7 @@ void CartesianPlotPrivate::retransform() {
PERFTRACE("CartesianPlotPrivate::retransform()");
prepareGeometryChange();
setPos( rect.x()+rect.width()/2, rect.y()+rect.height()/2);
setPos(rect.x() + rect.width()/2, rect.y() + rect.height()/2);
updateDataRect();
retransformScales();
......@@ -3327,7 +3327,7 @@ void CartesianPlotPrivate::wheelEvent(QGraphicsSceneWheelEvent* event) {
bool zoomX = false;
bool zoomY = false;
for (auto* axis : q->children<Axis>()) {
if (!axis->graphicsItem()->isSelected())
if (!axis->graphicsItem()->isSelected() && !axis->isHovered())
continue;
if (axis->orientation() == Axis::Orientation::Horizontal)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment