修复bug-画笔

This commit is contained in:
zdg 2024-09-04 20:43:47 +08:00
parent 70e99e69ba
commit 3a6b78bc76
3 changed files with 32 additions and 23 deletions

View File

@ -100,14 +100,14 @@ const renderPage = async (canvasobj) => {
}) })
} }
// //
const savaDataStore = (type) => { const savaDataStore = async (type) => {
if(!toolState.isToolWin){ if(!toolState.isToolWin){
toolState.isPdfWin = false toolState.isPdfWin = false
nextTick(() => { await sleep(20) //
toolState.showBoardAll = true // toolState.showBoardAll = true //
}) await sleep(50) //
if(type=='rest'){ if(type=='rest'){
ipcRenderer.invoke('tool-sphere:reset') //tool // ipcRenderer.invoke('tool-sphere:reset') //tool-
ipcRenderer.send('open-PDF:close') ipcRenderer.send('open-PDF:close')
}else{ }else{
ipcRenderer.invoke('open-PDF:minimize') ipcRenderer.invoke('open-PDF:minimize')
@ -143,22 +143,24 @@ const savaDataStore = (type) => {
} }
}) })
Promise.all(promises).then(res=>{ Promise.all(promises).then(async res=>{
toolState.isPdfWin=false toolState.isPdfWin=false
nextTick(() => { await sleep(20) //
toolState.showBoardAll=true // toolState.showBoardAll=true //
}) await sleep(50) //
// ipcRenderer.send('open-PDF:minimize') // ipcRenderer.send('open-PDF:minimize')
if(type=='rest'){ if(type=='rest'){
ipcRenderer.invoke('tool-sphere:reset') //tool // ipcRenderer.invoke('tool-sphere:reset') //tool-
ipcRenderer.send('open-PDF:close') ipcRenderer.send('open-PDF:close')
}else{ }else{
ipcRenderer.send('open-PDF:minimize') ipcRenderer.invoke('open-PDF:minimize')
} }
// ipcRenderer.send('open-PDF:close') // ipcRenderer.send('open-PDF:close')
}) })
} }
//
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
const updatePage = (canvasobj) => { const updatePage = (canvasobj) => {
renderPage(canvasobj) renderPage(canvasobj)
} }

View File

@ -38,7 +38,7 @@ export function shareStorePlugin({store}) {
// 同步数据-发送给主线程-单独 // 同步数据-发送给主线程-单独
function stateSync(storeName, key, value, state) { function stateSync(storeName, key, value, state) {
// console.log('state-change', storeName, key, value) console.log('state-change', storeName, key, value)
try { try {
const { data, keystr } = filterByKey(state, key, value) const { data, keystr } = filterByKey(state, key, value)
const jsonStr = JSON.stringify(data) // 从新组装-json数据 const jsonStr = JSON.stringify(data) // 从新组装-json数据
@ -85,7 +85,7 @@ function stateChange(store) {
const storeName = store.$id const storeName = store.$id
ipcRenderer?.on('pinia-state-set', (e, sName, jsonStr) => { ipcRenderer?.on('pinia-state-set', (e, sName, jsonStr) => {
if (sName == storeName) { // 更新对应数据 if (sName == storeName) { // 更新对应数据
// console.log('state-set', jsonStr, sName) console.log('state-set', jsonStr, sName)
const curJson = circularSafeStringify(store.$state) // 当前数据 const curJson = circularSafeStringify(store.$state) // 当前数据
const isUp = curJson != jsonStr // 不同的时候才写入,不然会导致触发数据变化监听,导致死循环 const isUp = curJson != jsonStr // 不同的时候才写入,不然会导致触发数据变化监听,导致死循环
if (!isUp) return if (!isUp) return

View File

@ -39,7 +39,7 @@
<script setup> <script setup>
// electron // electron
import { onMounted, ref, reactive, watchEffect } from 'vue' import { onMounted, ref, reactive, watchEffect, nextTick } from 'vue'
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { ElMessageBox, ElMessage, ElLoading } from 'element-plus' import { ElMessageBox, ElMessage, ElLoading } from 'element-plus'
import * as classManageApi from '@/api/classManage' import * as classManageApi from '@/api/classManage'
@ -83,8 +83,8 @@ const btnList = [ // 工具栏按钮列表
// === === // === ===
onMounted(async() => { onMounted(async() => {
if (!electron) return // if (!electron) return //
// window.test = sessionStore window.test = sessionStore
// window.test1 = toolStore window.test1 = toolStore
getClassInfo() // ex3 getClassInfo() // ex3
resetStatus() // - resetStatus() // -
}) })
@ -135,6 +135,7 @@ const logoHandle = (e,t) => {
// -穿 // -穿
const mouseChange = (bool) => { const mouseChange = (bool) => {
let resBool = false let resBool = false
if (bool == 0) return setIgnore(resBool) // 穿
if (tabActive.value == 'select') resBool = !!bool if (tabActive.value == 'select') resBool = !!bool
else { else {
if (!isShow.value) resBool = !!bool if (!isShow.value) resBool = !!bool
@ -176,15 +177,15 @@ const setIgnore = (bool) => {ipcMsgSend('tool-sphere:set:ignore', bool)}
// : | // : |
const resetStatus = () => { const resetStatus = () => {
if (toolStore.isToolWin) return // - if (toolStore.isToolWin) return // -
ipcMain?.removeHandler('tool-sphere:reset') // // -
ipcMain?.handle?.('tool-sphere:reset', () => { // ipcMain?.removeHandler('tool-sphere:reset') //
setTimeout(() => { // ipcMain?.handle?.('tool-sphere:reset', () => {
boardVueRef.value.handleMode(tabActive.value) // setTimeout(() => {
mouseChange(1) // boardVueRef.value.handleMode(tabActive.value)
}, 500) // mouseChange(1)
}) // }, 500)
// })
toolStore.isToolWin = true // toolStore.isToolWin = true //
} }
// : // :
const sideMouse = e => { const sideMouse = e => {
@ -240,6 +241,12 @@ watchEffect(() => {
// , : - // , : -
const show = !toolStore.isPdfWin && toolStore.showBoardAll const show = !toolStore.isPdfWin && toolStore.showBoardAll
if (show != isShow.value) isShow.value = show if (show != isShow.value) isShow.value = show
if (isShow.value) {
nextTick(() => {
mouseChange(1) //
boardVueRef.value.handleMode(tabActive.value)
})
}
}) })
</script> </script>