|
@@ -37,6 +37,26 @@
|
|
|
:dy="item.dy"
|
|
|
@deleteSpecialtag="(tag) => deleteSpecialtag(item, tag)"
|
|
|
/>
|
|
|
+ <div
|
|
|
+ v-if="isCustomSpecialTag"
|
|
|
+ class="image-canvas"
|
|
|
+ v-ele-move-directive.stop.prevent="{
|
|
|
+ moveStart: (event) => specialMouseStart(event, item),
|
|
|
+ moveElement: specialMouseMove,
|
|
|
+ moveStop: specialMouseStop,
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <template v-if="curSliceImagesWithTrackItem?.url === item.url">
|
|
|
+ <div
|
|
|
+ v-if="store.currentSpecialTagType === 'LINE'"
|
|
|
+ :style="specialLenStyle"
|
|
|
+ ></div>
|
|
|
+ <div
|
|
|
+ v-if="store.currentSpecialTagType === 'CIRCLE'"
|
|
|
+ :style="specialCircleStyle"
|
|
|
+ ></div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<hr class="image-seperator" />
|
|
|
</template>
|
|
@@ -66,6 +86,8 @@ import "viewerjs/dist/viewer.css";
|
|
|
import Viewer from "viewerjs";
|
|
|
import { message } from "ant-design-vue";
|
|
|
import EventBus from "@/plugins/eventBus";
|
|
|
+import { vEleMoveDirective } from "./use/eleMove";
|
|
|
+
|
|
|
type MakeTrack = (
|
|
|
event: MouseEvent,
|
|
|
item: SliceImage,
|
|
@@ -629,6 +651,100 @@ const innerMakeTrack = (event: MouseEvent, item: SliceImage) => {
|
|
|
};
|
|
|
//#endregion : 评分
|
|
|
|
|
|
+//#region : 特殊标记:画线、框
|
|
|
+const isCustomSpecialTag = $computed(() => {
|
|
|
+ return ["CIRCLE", "LINE"].includes(store.currentSpecialTagType);
|
|
|
+});
|
|
|
+
|
|
|
+let specialPoint = $ref({ x: 0, y: 0, ex: 0, ey: 0 });
|
|
|
+let curImageTarget: HTMLElement = null;
|
|
|
+let curSliceImagesWithTrackItem: SliceImage = $ref(null);
|
|
|
+
|
|
|
+const specialLenStyle = $computed(() => {
|
|
|
+ const width =
|
|
|
+ specialPoint.ex > specialPoint.x ? specialPoint.ex - specialPoint.x : 0;
|
|
|
+ return {
|
|
|
+ top: specialPoint.y + "px",
|
|
|
+ left: specialPoint.x + "px",
|
|
|
+ width: width + "px",
|
|
|
+ position: "absolute",
|
|
|
+ borderTop: "1px solid red",
|
|
|
+ zIndex: 9,
|
|
|
+ };
|
|
|
+});
|
|
|
+const specialCircleStyle = $computed(() => {
|
|
|
+ const width =
|
|
|
+ specialPoint.ex > specialPoint.x ? specialPoint.ex - specialPoint.x : 0;
|
|
|
+ const height =
|
|
|
+ specialPoint.ey > specialPoint.y ? specialPoint.ey - specialPoint.y : 0;
|
|
|
+ return {
|
|
|
+ top: specialPoint.y + "px",
|
|
|
+ left: specialPoint.x + "px",
|
|
|
+ width: width + "px",
|
|
|
+ height: height + "px",
|
|
|
+ position: "absolute",
|
|
|
+ border: "1px solid red",
|
|
|
+ borderRadius: "50%",
|
|
|
+ zIndex: 9,
|
|
|
+ };
|
|
|
+});
|
|
|
+
|
|
|
+function specialMouseStart(e: MouseEvent, item: SliceImage) {
|
|
|
+ curImageTarget = e.target.parentElement.childNodes[0];
|
|
|
+ curSliceImagesWithTrackItem = item;
|
|
|
+ specialPoint.x = e.offsetX;
|
|
|
+ specialPoint.y = e.offsetY;
|
|
|
+}
|
|
|
+function specialMouseMove({ left, top }) {
|
|
|
+ specialPoint.ex = left + specialPoint.x;
|
|
|
+ specialPoint.ey = top + specialPoint.y;
|
|
|
+}
|
|
|
+function specialMouseStop(e: MouseEvent) {
|
|
|
+ const track: SpecialTag = {
|
|
|
+ tagName: "",
|
|
|
+ tagType: store.currentSpecialTagType,
|
|
|
+ offsetIndex: curSliceImagesWithTrackItem.indexInSliceUrls,
|
|
|
+ offsetX:
|
|
|
+ specialPoint.x * (curImageTarget.naturalWidth / curImageTarget.width) +
|
|
|
+ curSliceImagesWithTrackItem.dx,
|
|
|
+ offsetY:
|
|
|
+ specialPoint.y * (curImageTarget.naturalHeight / curImageTarget.height) +
|
|
|
+ curSliceImagesWithTrackItem.dy,
|
|
|
+ positionX: -1,
|
|
|
+ positionY: -1,
|
|
|
+ };
|
|
|
+ track.positionX =
|
|
|
+ (specialPoint.x - curSliceImagesWithTrackItem.dx) / maxSliceWidth;
|
|
|
+ track.positionY =
|
|
|
+ (specialPoint.y -
|
|
|
+ curSliceImagesWithTrackItem.dy +
|
|
|
+ curSliceImagesWithTrackItem.accumTopHeight) /
|
|
|
+ theFinalHeight;
|
|
|
+
|
|
|
+ if (store.currentSpecialTagType === "LINE") {
|
|
|
+ track.tagName = JSON.stringify({
|
|
|
+ len:
|
|
|
+ (specialPoint.ex - specialPoint.x) *
|
|
|
+ (curImageTarget.naturalWidth / curImageTarget.width),
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (store.currentSpecialTagType === "CIRCLE") {
|
|
|
+ track.tagName = JSON.stringify({
|
|
|
+ width:
|
|
|
+ (specialPoint.ex - specialPoint.x) *
|
|
|
+ (curImageTarget.naturalWidth / curImageTarget.width),
|
|
|
+ height:
|
|
|
+ (specialPoint.ey - specialPoint.y) *
|
|
|
+ (curImageTarget.naturalHeight / curImageTarget.height),
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ store.currentTaskEnsured.markResult.specialTagList.push(track);
|
|
|
+ curSliceImagesWithTrackItem.tagList.push(track);
|
|
|
+ specialPoint = { x: 0, y: 0, ex: 0, ey: 0 };
|
|
|
+}
|
|
|
+//#endregion
|
|
|
+
|
|
|
//#region : 显示大图,供查看和翻转
|
|
|
const showBigImage = (event: MouseEvent) => {
|
|
|
event.preventDefault();
|
|
@@ -758,6 +874,14 @@ function scrollToFirstScore() {
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
+.image-canvas {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ z-index: 9;
|
|
|
+}
|
|
|
.double-triangle {
|
|
|
background-color: #ef7c78;
|
|
|
width: 30px;
|