Skip to content

Commit

Permalink
Fix sampling ring positioning for picker tool
Browse files Browse the repository at this point in the history
In the QGraphicsView renderer. It didn't properly map the position to
scene coordinates before, now it does.
  • Loading branch information
askmeaboutlo0m committed Sep 29, 2024
1 parent bc0e021 commit 9cd08ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/desktop/scene/canvasview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2076,12 +2076,17 @@ void CanvasView::moveDrag(const QPoint &point)
m_dragLastPoint = point;
}

bool CanvasView::setSceneColorPick(
int source, const QPointF &posf, const QColor &color)
{
return m_scene->setColorPick(source, mapToScene(posf.toPoint()), color);
}

void CanvasView::pickColor(
int source, const QPointF &point, const QPointF &posf)
{
QColor color = m_scene->model()->pickColor(point.x(), point.y(), 0, 0);
m_pickingColor =
m_scene->setColorPick(source, mapToScene(posf.toPoint()), color);
m_pickingColor = setSceneColorPick(source, posf, color);
}

void CanvasView::touchColorPick(const QPointF &posf)
Expand Down
3 changes: 3 additions & 0 deletions src/desktop/scene/canvasview.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ public slots:
void setViewFlip(bool flip);
void setViewMirror(bool mirror);

bool
setSceneColorPick(int source, const QPointF &posf, const QColor &color);

void setLockReasons(QFlags<view::Lock::Reason> reasons);
void setLockDescription(const QString &lockDescription);
void setToolState(int toolState);
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/scene/scenewrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ void SceneWrapper::connectDocument(Document *doc)
toolCtrl, &tools::ToolController::colorUsed, m_scene,
&CanvasScene::setComparisonColor);
connect(
toolCtrl, &tools::ToolController::colorPickRequested, m_scene,
&CanvasScene::setColorPick);
toolCtrl, &tools::ToolController::colorPickRequested, m_view,
&CanvasView::setSceneColorPick);
connect(
toolCtrl, &tools::ToolController::maskPreviewRequested, m_scene,
&CanvasScene::setMaskPreview);
Expand Down

0 comments on commit 9cd08ff

Please sign in to comment.