diff --git a/src/renderer/src/components/pdf/index copy.vue b/src/renderer/src/components/pdf/index copy.vue index ed14d19..48d93e3 100644 --- a/src/renderer/src/components/pdf/index copy.vue +++ b/src/renderer/src/components/pdf/index copy.vue @@ -13,10 +13,7 @@ import { onMounted, watch, reactive, - defineProps, - defineExpose, nextTick, - defineEmits } from 'vue' import { fabric } from 'fabric' import { ElMessage } from 'element-plus' diff --git a/src/renderer/src/components/pdf/index.vue b/src/renderer/src/components/pdf/index.vue index f103b75..3624e61 100644 --- a/src/renderer/src/components/pdf/index.vue +++ b/src/renderer/src/components/pdf/index.vue @@ -151,7 +151,7 @@ const savaDataStore = () => { Promise.all(promises).then(res=>{ toolState.isPdfWin=false toolState.showBoardAll=true //恢复默认值 - // ipcRenderer.send('tool-sphere:reset') //重置tool状态 + ipcRenderer.invoke('tool-sphere:reset') //重置tool状态 ipcRenderer.send('open-PDF:minimize') }) } @@ -274,7 +274,7 @@ const initPdfone = async () => { } onMounted(async () => { try { - // 获取页数 + // 创建canvas转化成图片 const pdf = await pdfjsLib.getDocument(props.pdfObj.pdfUrl).promise numPagesTotal.value = pdf.numPages // 初始化fabriccanvas @@ -292,7 +292,7 @@ onMounted(async () => { canvas1FabricVue.value = canvas2 window.test = { canvas1, canvas2 } emit('update:numPagesTotal', pdf.numPages) - //加载接口数据 + if (props.pdfObj.allPageData.length) { props.pdfObj.allPageData.forEach((a) => { if (a.pageNum == 1 || a.pageNum == 2) { @@ -305,10 +305,15 @@ onMounted(async () => { console.log(error) ElMessage.error('pdf文件错误') } + setToolStatus() // 监听2个canvas事件 // handleevent(fabriccanvas.value, imgarr) // handleevent(fabriccanvas1.value, imgarr, 'two') }) +// zdg: 设置-底部工具栏-状态 +const setToolStatus = () => { + toolState.showBoardAll = false +} // 判断元素是否加载完成 const handleMode = (vale,type)=>{ if(vale=='select'){ diff --git a/src/renderer/src/components/select-subject/index.vue b/src/renderer/src/components/select-subject/index.vue index 9071092..52f306a 100644 --- a/src/renderer/src/components/select-subject/index.vue +++ b/src/renderer/src/components/select-subject/index.vue @@ -23,7 +23,7 @@ + \ No newline at end of file diff --git a/src/renderer/src/views/tool/directive/ignore.js b/src/renderer/src/views/tool/directive/ignore.js new file mode 100644 index 0000000..63a3ca3 --- /dev/null +++ b/src/renderer/src/views/tool/directive/ignore.js @@ -0,0 +1,45 @@ +/** + * 处理元素是否穿透-窗口 + */ +import { ipcMsgSend } from '@/utils/tool' +class Ignore { + el // 绑定元素 + binding // 绑定对象(参数) + value // 绑定值 + isAuto // 是否自动控制 + constructor(el, binding) { + this.el = el + this.binding = binding + this.value = binding.value + this.isAuto = !(this.value && this.value instanceof Boolean) + } + // 设置是否穿透 + send(bool) { + ipcMsgSend('tool-sphere:set:ignore', bool) + } + // 监听元素移入移出,自动设置 + mounted() { + this.el.addEventListener('mouseenter', e => { // 进入 + this.send(false) // 元素不穿透,鼠标有效 + this.changeHandle(e) + }) + this.el.addEventListener('mouseleave', e => { // 离开 + this.send(true) // 元素穿透,鼠标无效 + this.changeHandle(e) + }) + } + changeHandle(e) { + const customEvent = new CustomEvent('ignore-mounted', {detail:{ignore: this, e}}) + this.el.dispatchEvent(customEvent) + } +} +export default { + mounted(el, binding) { + const ignore = new Ignore(el, binding) + if (ignore.isAuto) { // 自动控制 + ignore.mounted() + } else { // 手动设置 + ignore.send(ignore.value) + } + } +} \ No newline at end of file diff --git a/src/renderer/src/views/tool/sphere.vue b/src/renderer/src/views/tool/sphere.vue index f59548d..19f1db8 100644 --- a/src/renderer/src/views/tool/sphere.vue +++ b/src/renderer/src/views/tool/sphere.vue @@ -1,9 +1,11 @@