Skip to content

Commit 32dc3ae

Browse files
committed
fix: 修复 target_offset 计算错误
fix #523
1 parent 1be98b8 commit 32dc3ae

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

source/MaaFramework/Task/Component/Actuator.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,11 @@ cv::Rect Actuator::get_target_rect(const MAA_RES_NS::Action::Target target, cons
300300
}
301301

302302
auto image = controller()->cached_image();
303-
int x = std::clamp(raw.x, 0, image.cols);
304-
int y = std::clamp(raw.y, 0, image.rows);
305-
int width = std::clamp(raw.width, 0, image.cols - x);
306-
int height = std::clamp(raw.height, 0, image.rows - y);
303+
304+
int x = std::clamp(raw.x + target.offset.x, 0, image.cols);
305+
int y = std::clamp(raw.y + target.offset.y, 0, image.rows);
306+
int width = std::clamp(raw.width + target.offset.width, 0, image.cols - x);
307+
int height = std::clamp(raw.height + target.offset.height, 0, image.rows - y);
307308

308309
return cv::Rect(x, y, width, height);
309310
}

0 commit comments

Comments
 (0)