|
@@ -44,8 +44,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { Pos } from "@/sdk";
|
|
|
-import { computed, onMounted, onUnmounted, watchEffect } from "vue";
|
|
|
+import { Pos, SDK } from "@/sdk";
|
|
|
+import { computed, onMounted, onUnmounted, ref, watchEffect } from "vue";
|
|
|
import { sceneSeting } from "@/store/sceneSeting";
|
|
|
import { useSDK } from "@/hook";
|
|
|
|
|
@@ -73,27 +73,26 @@ const value = computed({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+const changeRange = (sp: Pos, cp: Pos, info: { start: number; locusWidth: number }) =>
|
|
|
+ info.start + (sp.y - cp.y) / info.locusWidth;
|
|
|
+
|
|
|
+const cropApi = ref<ReturnType<SDK["scene"]["enterCropSetting"]>>();
|
|
|
+
|
|
|
watchEffect((onCleanup) => {
|
|
|
- if (props.rangeKey) {
|
|
|
+ if (props.rangeKey && cropApi.value) {
|
|
|
const name = `${props.rangeKey[0].toUpperCase()}${props.rangeKey.substring(1)}`;
|
|
|
- useSDK().scene[`enterSet${name}`]();
|
|
|
+ cropApi.value[`enterSet${name}`]();
|
|
|
onCleanup(() => {
|
|
|
- useSDK().scene[`leaveSet${name}`]();
|
|
|
+ cropApi.value[`leaveSet${name}`]();
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-const changeRange = (sp: Pos, cp: Pos, info: { start: number; locusWidth: number }) =>
|
|
|
- info.start + (sp.y - cp.y) / info.locusWidth;
|
|
|
-
|
|
|
-let quit: () => void;
|
|
|
onMounted(() => {
|
|
|
- console.log("进入裁剪");
|
|
|
- quit = useSDK().scene.enterCropSetting().quit;
|
|
|
+ cropApi.value = useSDK().scene.enterCropSetting();
|
|
|
});
|
|
|
onUnmounted(() => {
|
|
|
- console.log(quit);
|
|
|
- quit && quit();
|
|
|
+ cropApi.value && cropApi.value.quit();
|
|
|
});
|
|
|
</script>
|
|
|
|