FIX: adjust ortho, do not scale source image

jira: [STUDIO-12333]

Change-Id: I4fabccc9c489ed7fa4a8ad1239ed26c1710b3ee9
(cherry picked from commit 3fbb9946d1deee1855498e97cc66844e1f2e54aa)
This commit is contained in:
haolin.tian
2025-07-15 14:46:39 +08:00
committed by Noisyfox
parent b49ca90940
commit 219300277c
2 changed files with 5 additions and 3 deletions

View File

@@ -86,7 +86,8 @@ void SkipPartCanvas::LoadPickImage(const std::string & path)
image_scale = zoom_x;
else
image_scale = zoom_y;
cv::resize(src_image, pick_image_, cv::Size(), image_scale, image_scale, cv::INTER_NEAREST);
image_view_scale_ = 1 / image_scale;
pick_image_ = src_image;
std::vector<cv::Mat> channels;
cv::Mat gray; // convert to gray
cv::cvtColor(pick_image_, gray, cv::COLOR_BGR2GRAY);
@@ -399,7 +400,7 @@ inline double SkipPartCanvas::Zoom() const
inline wxPoint SkipPartCanvas::ViewPtToImagePt(const wxPoint& view_pt) const
{
return wxPoint(view_pt.x / Zoom(), view_pt.y / Zoom()) + offset_;
return wxPoint(view_pt.x * image_view_scale_ / Zoom(), view_pt.y * image_view_scale_ / Zoom()) + offset_;
}
uint32_t SkipPartCanvas::GetIdAtImagePt(const wxPoint& image_pt) const
@@ -460,7 +461,7 @@ void SkipPartCanvas::StartDrag(const wxPoint& mouse_pt)
void SkipPartCanvas::ProcessDrag(const wxPoint& mouse_pt)
{
wxPoint drag_offset = mouse_pt - drag_start_pt_;
wxPoint drag_offset = (mouse_pt - drag_start_pt_) * image_view_scale_;
SetOffset(- wxPoint(drag_offset.x / Zoom(), drag_offset.y / Zoom()) + drag_start_offset_);
Refresh();
}

View File

@@ -97,6 +97,7 @@ private:
bool left_down_{false};
ColorRGB parent_color_ = ColorRGB();
int hover_id_{-1};
double image_view_scale_{1};
void SendSelectEvent(int id, PartState state);
void SendZoomEvent(int zoom_percent);