|
@@ -80,6 +80,7 @@ export type SignProps = { tagging: Tagging; scenePos: TaggingPosition; show?: bo
|
|
|
const props = defineProps<SignProps>();
|
|
|
const emit = defineEmits<{
|
|
|
(e: "delete"): void;
|
|
|
+ (e: "changeLineHeight", val: number): void;
|
|
|
(
|
|
|
e: "changePosition",
|
|
|
val: { position: SceneLocalPos; modelId: string; normal: SceneLocalPos }
|
|
@@ -124,10 +125,6 @@ const changePos = () => {
|
|
|
watch(taggingStyle, (icon) => icon && tag.changeImage(getFileUrl(icon.icon)));
|
|
|
watchEffect(() => tag.changeMat(props.scenePos.mat));
|
|
|
watchEffect(() => tag.changeFontSize(props.scenePos.fontSize));
|
|
|
-watchEffect(() => {
|
|
|
- tag.changeLineHeight(props.scenePos.lineHeight);
|
|
|
- changePos();
|
|
|
-});
|
|
|
watchEffect(() => tag.changeTitle(props.tagging.title));
|
|
|
watchEffect(() => tag.visibilityTitle(props.tagging.show3dTitle));
|
|
|
watchEffect(() => {
|
|
@@ -142,7 +139,6 @@ const getPosition = () => ({
|
|
|
let currentPosition = getPosition();
|
|
|
let changeTimeout: any;
|
|
|
tag.bus.on("changePosition", (data) => {
|
|
|
- console.error(data);
|
|
|
clearTimeout(changeTimeout);
|
|
|
emit(
|
|
|
"changePosition",
|
|
@@ -155,6 +151,22 @@ tag.bus.on("changePosition", (data) => {
|
|
|
changePos();
|
|
|
});
|
|
|
|
|
|
+tag.bus.on("changePosition", (data) => {
|
|
|
+ clearTimeout(changeTimeout);
|
|
|
+ emit(
|
|
|
+ "changePosition",
|
|
|
+ (currentPosition = {
|
|
|
+ position: { ...data.pos },
|
|
|
+ normal: { ...data.normal },
|
|
|
+ modelId: data.modelId,
|
|
|
+ })
|
|
|
+ );
|
|
|
+ changePos();
|
|
|
+});
|
|
|
+tag.bus.on("changeLineHeight", (lineHeight) => {
|
|
|
+ emit("changeLineHeight", lineHeight);
|
|
|
+});
|
|
|
+
|
|
|
watch(getPosition, (p) => {
|
|
|
changeTimeout = setTimeout(() => {
|
|
|
if (inRevise(p, currentPosition)) {
|
|
@@ -165,6 +177,17 @@ watch(getPosition, (p) => {
|
|
|
}, 16);
|
|
|
});
|
|
|
|
|
|
+watch(
|
|
|
+ () => props.scenePos.lineHeight,
|
|
|
+ () => {
|
|
|
+ changeTimeout = setTimeout(() => {
|
|
|
+ tag.changeLineHeight(props.scenePos.lineHeight);
|
|
|
+ changePos();
|
|
|
+ }, 16);
|
|
|
+ },
|
|
|
+ { immediate: true }
|
|
|
+);
|
|
|
+
|
|
|
const [toCameraDistance] = useCameraChange(() => {
|
|
|
return tag.getCameraDisSquared && tag.getCameraDisSquared();
|
|
|
});
|