|
@@ -94,6 +94,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="right-handler">
|
|
<div class="right-handler">
|
|
|
|
|
+ <div v-if="hasInteractiveTool" class="handler-item viewport-size edit-tool-btn" @click="editTool">编辑工具</div>
|
|
|
<IconMinus class="handler-item viewport-size" v-tooltip="'画布缩小(Ctrl + -)'" @click="scaleCanvas('-')" />
|
|
<IconMinus class="handler-item viewport-size" v-tooltip="'画布缩小(Ctrl + -)'" @click="scaleCanvas('-')" />
|
|
|
<Popover trigger="click" v-model:value="canvasScaleVisible">
|
|
<Popover trigger="click" v-model:value="canvasScaleVisible">
|
|
|
<template #content>
|
|
<template #content>
|
|
@@ -126,7 +127,7 @@
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
import { ref, computed } from 'vue'
|
|
import { ref, computed } from 'vue'
|
|
|
import { storeToRefs } from 'pinia'
|
|
import { storeToRefs } from 'pinia'
|
|
|
-import { useMainStore, useSnapshotStore } from '@/store'
|
|
|
|
|
|
|
+import { useMainStore, useSnapshotStore, useSlidesStore } from '@/store'
|
|
|
import { getImageDataURL } from '@/utils/image'
|
|
import { getImageDataURL } from '@/utils/image'
|
|
|
import type { ShapePoolItem } from '@/configs/shapes'
|
|
import type { ShapePoolItem } from '@/configs/shapes'
|
|
|
import type { LinePoolItem } from '@/configs/lines'
|
|
import type { LinePoolItem } from '@/configs/lines'
|
|
@@ -148,8 +149,10 @@ import Popover from '@/components/Popover.vue'
|
|
|
import PopoverMenuItem from '@/components/PopoverMenuItem.vue'
|
|
import PopoverMenuItem from '@/components/PopoverMenuItem.vue'
|
|
|
|
|
|
|
|
const mainStore = useMainStore()
|
|
const mainStore = useMainStore()
|
|
|
|
|
+const slidesStore = useSlidesStore()
|
|
|
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
|
|
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
|
|
|
const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
|
|
const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
|
|
|
|
|
+const { currentSlide } = storeToRefs(slidesStore)
|
|
|
|
|
|
|
|
const getInitialViewMode = () => {
|
|
const getInitialViewMode = () => {
|
|
|
const urlParams = new URLSearchParams(window.location.search)
|
|
const urlParams = new URLSearchParams(window.location.search)
|
|
@@ -166,6 +169,23 @@ const getInitialViewMode = () => {
|
|
|
|
|
|
|
|
const viewMode = computed(() => getInitialViewMode())
|
|
const viewMode = computed(() => getInitialViewMode())
|
|
|
|
|
|
|
|
|
|
+const hasInteractiveTool = computed(() => {
|
|
|
|
|
+ const elements = currentSlide.value?.elements || []
|
|
|
|
|
+ return elements.some((el: any) => el.type === 'frame' && (el.toolType === 45 || el.toolType === 15))
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+const editTool = () => {
|
|
|
|
|
+ const elements = currentSlide.value?.elements || []
|
|
|
|
|
+ const frameElement = elements.find((el: any) => el.type === 'frame' && (el.toolType === 45 || el.toolType === 15))
|
|
|
|
|
+ if (frameElement) {
|
|
|
|
|
+ interface ParentWindowWithToolList extends Window {
|
|
|
|
|
+ toolBtn?: (action: number, id: string) => void;
|
|
|
|
|
+ }
|
|
|
|
|
+ const parentWindow = window.parent as ParentWindowWithToolList
|
|
|
|
|
+ parentWindow?.toolBtn?.(0, frameElement.id || '')
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const { redo, undo } = useHistorySnapshot()
|
|
const { redo, undo } = useHistorySnapshot()
|
|
|
|
|
|
|
|
const {
|
|
const {
|