|
@@ -51,7 +51,7 @@
|
|
|
import { onMounted, onUnmounted, reactive, watch, watchEffect } from "vue";
|
|
|
import { store } from "@/store/store";
|
|
|
import MarkDrawTrack from "../mark/MarkDrawTrack.vue";
|
|
|
-import type { SliceImage } from "@/types";
|
|
|
+import type { SliceImage, Track } from "@/types";
|
|
|
import { useTimers } from "@/setups/useTimers";
|
|
|
import { loadImage } from "@/utils/utils";
|
|
|
import { dragImage } from "../mark/use/draggable";
|
|
@@ -148,14 +148,30 @@ watch(
|
|
|
{ deep: true }
|
|
|
);
|
|
|
|
|
|
+const colors = ["red", "blue", "gray"];
|
|
|
+let colorMap = {};
|
|
|
+function addTrackColorAttr(tList: Track[]): Track[] {
|
|
|
+ let userIds: (number | undefined)[] = tList
|
|
|
+ .map((v) => v.userId)
|
|
|
+ .filter((x) => !!x);
|
|
|
+ userIds = Array.from(new Set(userIds));
|
|
|
+
|
|
|
+ userIds.forEach((mid, index) => {
|
|
|
+ // 双评的时候保证同一个人的轨迹颜色是一致的
|
|
|
+ colorMap[mid] = colorMap[mid] || colors[index] || "gray";
|
|
|
+ });
|
|
|
+ const isByMultMark = Object.keys(colorMap).length > 1;
|
|
|
+
|
|
|
+ tList = tList.map((item) => {
|
|
|
+ item.color = colorMap[item.userId] || "gray";
|
|
|
+ item.isByMultMark = isByMultMark;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ return tList;
|
|
|
+}
|
|
|
+
|
|
|
async function processImage() {
|
|
|
if (!store.currentTask) return;
|
|
|
- let markResult = store.currentTask.markResult;
|
|
|
- if (hasMarkResultToRender) {
|
|
|
- // check if have MarkResult for currentTask
|
|
|
- if (!markResult) return;
|
|
|
- }
|
|
|
-
|
|
|
const images = [];
|
|
|
const urls = store.currentTask.sheetUrls || [];
|
|
|
for (const url of urls) {
|
|
@@ -167,16 +183,18 @@ async function processImage() {
|
|
|
theFinalHeight = Math.max(...images.map((i) => i.naturalHeight));
|
|
|
sliceImagesWithTrackList.splice(0);
|
|
|
|
|
|
+ let trackLists = store.currentTask.questionList
|
|
|
+ .map((q) => addTrackColorAttr(q.trackList))
|
|
|
+ .flat();
|
|
|
+ let tagLists = store.currentTask.specialTagList ?? [];
|
|
|
+ tagLists = addTrackColorAttr(tagLists);
|
|
|
+
|
|
|
+ let accumTopHeight = 0;
|
|
|
+ let accumBottomHeight = 0;
|
|
|
for (const url of urls) {
|
|
|
const indexInSliceUrls = urls.indexOf(url) + 1;
|
|
|
const image = images[indexInSliceUrls - 1];
|
|
|
-
|
|
|
- const trackLists = hasMarkResultToRender
|
|
|
- ? markResult.trackList
|
|
|
- : store.currentTask.questionList.map((q) => q.trackList).flat();
|
|
|
- const tagLists = hasMarkResultToRender
|
|
|
- ? markResult.specialTagList ?? []
|
|
|
- : store.currentTask.specialTagList ?? [];
|
|
|
+ accumBottomHeight += image.naturalHeight;
|
|
|
|
|
|
const thisImageTrackList = trackLists.filter(
|
|
|
(t) => t.offsetIndex === indexInSliceUrls
|
|
@@ -195,7 +213,9 @@ async function processImage() {
|
|
|
width: (image.naturalWidth / maxImageWidth) * 100 + "%",
|
|
|
dx: 0,
|
|
|
dy: 0,
|
|
|
+ accumTopHeight,
|
|
|
});
|
|
|
+ accumTopHeight = accumBottomHeight;
|
|
|
}
|
|
|
}
|
|
|
|