|
@@ -914,7 +914,29 @@ export default function useDraw(drawConfig: DrawConfig) {
|
|
|
// 合并相邻区域
|
|
|
const combinePictureConfigList = combinePictureConfig(pictureConfigs);
|
|
|
// console.log(combinePictureConfigList);
|
|
|
- return combinePictureConfigList;
|
|
|
+ return shrinkQuestionArea(combinePictureConfigList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 缩小区域
|
|
|
+ // 给定区域向中心缩小到原来的0.9倍,高度为原来的0.94倍
|
|
|
+ function shrinkQuestionArea(pictureConfigs: QuestionArea[]) {
|
|
|
+ const shrinkPictureConfigList: QuestionArea[] = [];
|
|
|
+ pictureConfigs.forEach((item) => {
|
|
|
+ const { x, y, w, h } = item;
|
|
|
+ const newX = x + w / 2;
|
|
|
+ const newY = y + h / 2;
|
|
|
+ const newW = w * 0.9;
|
|
|
+ const newH = h * 0.94;
|
|
|
+ shrinkPictureConfigList.push({
|
|
|
+ i: item.i,
|
|
|
+ x: newX - newW / 2,
|
|
|
+ y: newY - newH / 2,
|
|
|
+ w: newW,
|
|
|
+ h: newH,
|
|
|
+ qStruct: item.qStruct,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return shrinkPictureConfigList;
|
|
|
}
|
|
|
|
|
|
// 通过题卡获取试题评卷区
|